Installing Apache Active MQ on Ubuntu

By: 

After creating a Sales Demonstration system for an industry trade show using Ubuntu 10.10, I decided to create a personal development system based on one of my personal favorite free operating systems, Ubuntu. An old laptop was pressed into service as a meager server on which I could refresh my admin skills and provide a target for testing prototype concepts rambling around my brain. One of the first services this little laptop will host is Apache Active MQ 5.4.2 which was released December of 2010. (Authors Note: This article has been updated to support Ubuntu 11 and ActiveMQ 5.5)

Although Ubuntu has a large collection of software available in many repositories, there is no way, currently, to perform an apt-get for Active MQ. It has to be installed by hand. Fortunately, this is a relatively simple matter. There are a couple of stumbling blocks which prevented a smooth install for me so I thought this article might help others avoid them.

Ensure you have Java installed

I prefer to have have the sun-java6-bin and sun-java6-jre packages for this purpose. I’m currently testing the free versions which come with Ubuntu. I have a separate link which describes installing sun-java on Ubuntu. It’s like 5 commands; no big deal.

Initial Install

Go to the download page for Apache Active MQ and select the latest available release tarball and extract it on your server.

tar xzf apache-activemq-5.5.0-bin.tar.gz


Move it to /opt where optional software package are intended to be placed.

sudo mv apache-activemq-5.5.0 /opt


The activemq scripts expect to find Active MQ installed in /opt/activemq. I personally do not like having a non-versioned directory like that. Moving the package to /opt/activemq as would be expected by the scripts can make it difficult months down the line to upgrade. What version is installed? Will you remember? Now, this is a personal preference, but I like to know at any time what versions of software I have installed so I generally create a sym-link so the script finds things where it expects and I can see what version is installed. It is also easier to switch versions by simply linking/opt/activemq to another directory containing a different version. If it works fine, I can delete the old version, if not, I can switch the like back all this happens without changing any of the scripts. Here is how I did it:

sudo ln -sf /opt/apache-activemq-5.5.0/ /opt/activemq

 

Add Non-Privileged Account

It’s never a good idea to run a service as root, so it is a common practice to add a dedicated user account which doesn’t have much authority and run the service as this account. This will have the added benefit of making the process easier to identify with tools such as ps and top.

sudo adduser -system activemq


Some (many?, most?) systems will give a system user a false login shell. This will keep theactivemq script from running so you will have to make sure the account uses the bash shell. First, open the /etc/passwd file in your favorite editor. Don’t forget to use sudo as it is a privileged file. Here is the line when using vi:

sudo vi /etc/passwd


Go to the end of the list of accounts and make sure the shell for this account looks something like the following line. Don’t worry about the numbers and such, but make sure the last argument contains /bin/bash and not something like /bin/false, for example, the line should look something like the following:

activemq:x:116:65534::/home/activemq:/bin/bash


Recursively change the ownership of the entire activemq directory to the activemq user you just added.

sudo chown -R activemq: /opt/apache-activemq-5.5.0/


Next, sym-link the init script provided by Active MQ to /etc/init.d/activemq:

sudo ln -sf /opt/activemq/bin/activemq /etc/init.d/


Tell Ubuntu to start Active MQ on boot:

sudo update-rc.d activemq defaults


At this point you will probably get a warning about missing LSB information. LSB information is a block of information which directs how the links are made. See http://wiki.debian.org/LSBInitScriptsfor more details.

Now, let’s build a default configuration file:

sudo /etc/init.d/activemq setup /etc/default/activemq


Change the owner and group of the config file:

sudo chown root:nogroup /etc/default/activemq


Change the file permissions so its read-write by root only:

sudo chmod 600 /etc/default/activemq

 

Editing the Configuration


Unfortunately, this is where you will have to begin searching through your configuration file and make changes specific to your version of software and setup. There have been some changes between releases of Active MQ so the instructions may not match what you see in your files.

Edit the newly generated /etc/default/activemq file. I’ll use vi:

sudo vi /etc/default/activemq


You’re looking for ACTIVEMQ_USER="". Enter the name of your activemq user name between the quotes.

Now we will configure the Active MQ broker to listen for JMX connections. Further down the file, un-comment the JMX configuration lines:

ACTIVEMQ_SUNJMX_START=”-Dcom.sun.management.jmxremote.port=11099 ”
ACTIVEMQ_SUNJMX_START=”$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.password.file=${ACTIVEMQ_CONFIG_DIR}/jmx.password”
ACTIVEMQ_SUNJMX_START=”$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.access.file=${ACTIVEMQ_CONFIG_DIR}/jmx.access”
ACTIVEMQ_SUNJMX_START=”$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote.ssl=false”
ACTIVEMQ_SUNJMX_START=”$ACTIVEMQ_SUNJMX_START -Dcom.sun.management.jmxremote”


The above configuration lines enable JMX on port 11099 and use two file to control access through JMX.

The next section will specify how the shutdown script will connect to the broker (via JMX) and log into the management console to issue the shutdown command. This line will connect to broker via port 11099 and log in as controlRole with a password of abcd1234. Keep these values (or whatever you change them to) in mind as you will need to make sure they are registered in thedata/jmx.password and data/jmx.access files in the next steps.

ACTIVEMQ_SUNJMX_CONTROL=”–jmxurl service:jmx:rmi:///jndi/rmi://127.0.0.1:11099/jmxrmi –jmxuser controlRole –jmxpassword abcd1234″
# ACTIVEMQ_SUNJMX_CONTROL=””
# Specify the queue manager URL for using “browse” option of sysv initscript
ACTIVEMQ_QUEUEMANAGERURL=”–amqurl tcp://localhost:61616″


Save your changes to the configuration file and exit the editor.

Now, you must edit the conf/jmx.password and conf/jmx.access files. Use the sample data they provide in the comments immediately above the lines. Remember to use the values you specified (or left alone) int the --jmxuser and --jmxpassword of the ACTIVEMQ_SUNJMX_CONTROL configuration line above.

Ensure that these JMX access control files are readable by only the activemq user account!

sudo chmod 600 /opt/apache-activemq-5.5.0/conf/jmx.password
sudo chmod 600 /opt/apache-activemq-5.5.0/conf/jmx.access


Doing that enables the init script to connect to the locally running software via JMX, a management console. Without this configured correctly you’re looking at issuing a shutdown command and seeing a ton of Java errors followed by thirty seconds (configurable) of timeout before the script finally issues a KILL on the process.

Now run the service

sudo /etc/init.d/activemq start


Then look in the /opt/activemq/data directory for the PID and log files. You can tail the log file to see what is happening:

sudo tail -f /opt/activemq/data/activemq.log

 

All Done!

The Active MQ broker should be running. You can test this in a variety of ways including using thetelnet command to connect to the broker on 61616, the JMX port on 11099 or more simply by opening a browser connection to the HTTP management port: http://localhost:8161

 

Copy From: http://servicebus.blogspot.com/2011/02/installing-apache-active-mq-on-ubuntu.html

Install Apache + PHP + MySQL in Ubunut

We can Install Apache, PHP and MySQL in Ubuntu 3 types as bellow:

  1. When install Ubuntu Screen, please select ( [x] LAMP SERVER)
  2. Go to terminal :
    sudo apt-get install lamp-server^
  3. Install all application one by one as:

 

1 Preliminary Note

In this tutorial I use the hostname server1.example.com with the IP address 192.168.0.100. These settings might differ for you, so you have to replace them where appropriate.

I’m running all the steps in this tutorial with root privileges, so make sure you’re logged in as root:

sudo su

 

2 Installing MySQL 5

First we install MySQL 5 like this:

apt-get install mysql-server mysql-client

You will be asked to provide a password for the MySQL root user – this password is valid for the user root@localhost as well as root@server1.example.com, so we don’t have to specify a MySQL root password manually later on:

New password for the MySQL “root” user: <– yourrootsqlpassword
Repeat password for the MySQL “root” user: <– yourrootsqlpassword

 

3 Installing Apache2

Apache2 is available as an Ubuntu package, therefore we can install it like this:

apt-get install apache2

Now direct your browser to http://192.168.0.100, and you should see the Apache2 placeholder page (It works!):

Click to enlarge

 

Apache’s default document root is /var/www on Ubuntu, and the configuration file is /etc/apache2/apache2.conf. Additional configurations are stored in subdirectories of the /etc/apache2 directory such as /etc/apache2/mods-enabled (for Apache modules), /etc/apache2/sites-enabled (for virtual hosts), and/etc/apache2/conf.d.

 

4 Installing PHP5

We can install PHP5 and the Apache PHP5 module as follows:

apt-get install php5 libapache2-mod-php5

We must restart Apache afterwards:

/etc/init.d/apache2 restart

 

5 Testing PHP5 / Getting Details About Your PHP5 Installation

The document root of the default web site is /var/www. We will now create a small PHP file (info.php) in that directory and call it in a browser. The file will display lots of useful details about our PHP installation, such as the installed PHP version.

vi /var/www/info.php

<?php
phpinfo();
?>

Now we call that file in a browser (e.g. http://192.168.0.100/info.php):

Click to enlarge

 

As you see, PHP5 is working, and it’s working through the Apache 2.0 Handler, as shown in the Server API line. If you scroll further down, you will see all modules that are already enabled in PHP5. MySQL is not listed there which means we don’t have MySQL support in PHP5 yet.

 

6 Getting MySQL Support In PHP5

To get MySQL support in PHP, we can install the php5-mysql package. It’s a good idea to install some other PHP5 modules as well as you might need them for your applications. You can search for available PHP5 modules like this:

apt-cache search php5

Pick the ones you need and install them like this:

apt-get install php5-mysql php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl

Now restart Apache2:

/etc/init.d/apache2 restart

Xcache is a free and open PHP opcode cacher for caching and optimizing PHP intermediate code. It’s similar to other PHP opcode cachers, such as eAccelerator and APC. It is strongly recommended to have one of these installed to speed up your PHP page.

Xcache can be installed as follows:

apt-get install php5-xcache

Now restart Apache:

/etc/init.d/apache2 restart

Now reload http://192.168.0.100/info.php in your browser and scroll down to the modules section again. You should now find lots of new modules there, including the MySQL module:

Click to enlarge

 

 

7 phpMyAdmin

phpMyAdmin is a web interface through which you can manage your MySQL databases. It’s a good idea to install it:

apt-get install phpmyadmin

You will see the following questions:

Web server to reconfigure automatically: <– apache2
Configure database for phpmyadmin with dbconfig-common? <– No

Afterwards, you can access phpMyAdmin under http://192.168.0.100/phpmyadmin/:

Reference by:

http://www.howtoforge.com/installing-apache2-with-php5-and-mysql-support-on-ubuntu-13.04-lamp

http://www.liberiangeek.net/2013/05/want-lamp-linux-apache-mysql-in-ubuntu-13-04/

Creating a Home Media Streaming Center with Ubuntu

By: mdkelsh

Let’s face it. Discs are a thing of the past, and external hard drives are bulky and inconvenient. With this guide, I will show you how to create a Home Media Center, capable of streaming movies and music straight to you PC. The best thing is, this is free, or cheap, project!

Step 1: Gathering the Supplies

Picture of Gathering the Supplies
Ubuntu-logo.gif
What we will need

    • An unused PC
    • Ubuntu 9.04 Desktop Edition
    • A DVD-R(optional)
    • Media

You can replace the DVD with a USB flash drive, but for this guide i will be using the DVD

Step 2: Download Ubuntu 9.04

Picture of Download Ubuntu 9.04
virtual_installing_ubuntu_as_virtual_machine_04.jpg
Can be acquired here http://www.ubuntu.com/getubuntu/download. I have a fairly decent internet speed, so it took me about an hour to download. Download time may vary, so sit back, relax, grab a cup of coffee, or learn the metric system.

Step 3: Burning the ISO

Picture of Burning the ISO
ImgBurn-portable.png
After you are done downloading the file, we must burn it to a disc.http://www.imgburn.com/index.php?act=download is a pretty good program for the job. If you know how to burn an ISO, then you are on the right track. Once you have burnt the disc, it is time to install!

Step 4: Installing Ubuntu

Picture of Installing Ubuntu
Ubuntu-logo.gif
I won’t go over this step, for it is pretty self explanatory, but if you need assistance, it can be found here https://help.ubuntu.com/community/GraphicalInstall

Step 5: SSH

Once you have installed Ubuntu, it is time to configure you server! In the upper left-hand corner, click on Applications>Accessories>Terminal. A window should pop up, similar to Mac OS X terminal, or Windows CMD Prompt.

In this window, type

sudo apt-get update

Then

sudo apt-get upgrade

Reboot the install OpenSSH-Server in terminal using

sudo apt-get install openssh-server

Find your local IP address. MIne is under eth1.

On another Linux machine, ssh into the client using

ssh your_username@local_ip 

On Ubuntu 9.04, ssh has been replaced with OpenSSH, which comes pre-installed
If you are using a Windows machine, or Mac, go grab a copy of puttyhttp://www.chiark.greenend.org.uk/%7Esgtatham/putty/ which serves as a ssh client.

Step 6: Configuring Samba

Picture of Configuring Samba
Install Samba in terminal using,

sudo apt-get install samba

and

sudo apt-get install samba smbfs

Stop Samba

sudo /etc/init.d/samba stop 

Move

sudo mv /etc/samba/smb.conf /etc/samba/smb.conf.orig 

Create

sudo touch /etc/samba/smb.conf 

Edit

sudo pico /etc/samba/smb.conf 

Copy this filehttp://rubbervir.us/projects/ubuntu_media_server/smb.txt into the window

Replace “YOUR_HOSTNAME” with “Media”

Replace “YOUR_WORKGROUP” with the name of your Windows workgroup

Replace “/media/samba/” with “/”

Replace “YOUR_USERNAME” with your username

Save

Hit CTRL+X, Y, Enter

Set permissions

sudo chmod 0777 /

Restart Samba

sudo /etc/init.d/samba start

Add/edit/delete network users

Add user

sudo smbpasswd -a system_user (system_user, being the user you created in the installation”

sudo pico /etc/samba/smbusers

Insert following line into new file

system_username = “network username”‘

Save

Edit user

sudo smbpasswd -a system_username (system username being the one you chose in the installation)

Delete user

sudo smbpasswd -x system_username

Reconfigure Sharing

sudo pico /etc/samba/smb.conf

and add this to the file

[Media]
path = /mediaserver
browseable = yes
read only = no
guest ok = yes
create mask = 0644
directory mask = 0755

Now Restart Samba

sudo /etc/init.d/samba stop

sudo /etc/init.d/samba start”‘

Step 7: Add Media

Picture of Add Media
Find you Media server over the network, login, find the folder “Media”. And drag and drop the media you want into the folder.

Step 8: Adding Server Dependencies

First we must install some web-server dependencies.

Run each of these separately (DO NOT COPY AND PASTE THE WHOLE BLOCK OF TEXT!!!)

sudo apt-get install apache2

sudo apt-get install php5

sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

sudo apt-get install php5-gd

Step 9: Getting the files to play nice

In you ssh window, run this command

wget http://filenice.com/demo/fileNice.zip 

Next we need to unzip the folder

unzip fileNice

Now we need to put it in the files at the web-root directory

sudo cp -a fileNice /var/www

you can now test your server by navigating to your server via web browser using the url

web_server_local_ip/fileNice
(replace web_server_local_ip with the ip assigned to your server by your router)

Step 10: Customizing you Prefs

Now to get you server working the way you want it, you must customize some code, allowing for certain file types and directories. To do so, run this command in the ssh terminal

sudo cd /var/www/fileNice/fileNice

then

sudo pico prefs.php

Find the line that says $embedTypes, and add the file extensions you want to the list.For mp3s, you simply remove it from the “$embedTypes” and add it to the “$miscTypes” list array. This makes it easier for a mobile device to use the mp3 file.

Press Ctrl+X, Y, then Enter

Step 11: Add Files

Picture of Add Files
in the ssh terminal run this command

sudo /etc/samba/smb.conf

And add this block of text to the bottom of the file

[Streaming]
path = /var/www/fileNice
browseable = yes
read only = no
guest ok = yes
create mask = 0644
directory mask = 0755

[MediaStreaming]
path = /MediaStreaming
browseable = yes
read only = no
guest ok = yes
create mask = 0644
directory mask = 0755

Press Ctrl+X,Y,Enter
Restart Samba

sudo service samba restart

Now you can browse it over the network, and transfer files to your server. You make need the run these commands in the terminal to obtain the proper folder permissions.

sudo chmod 775 /MediaStreaming
sudo chmod 775 /var/www

Step 12: (optional)Create a domain name with no-ip

Picture of (optional)Create a domain name with no-ip
Untitled-1.png
Go to http://no-ip.com and create a free account, and a domain for your server. Next in your ssh terminal type:

sudo apt-get install no-ip

then

noip2 -C

Follow the prompt, and then you should be able to use that domain name to connect to your server.

Step 13: Setting Up Darwin Streaming Server

Many of us have phones and iTouches, some like me are lucky enough to have an iPhone. In any case, Darwin Server will satisfy your general streaming needs. Unlike before in which we used progressive download, I believe that DSS will enable you to have true streaming capabilities.

First we must create the necessary user requirements

Enter these commands in the terminal
sudo addgroup -system qtss

and

sudo adduser -system -no-create-home -ingroup qtss qtss

This will add the user and user groups needed by DSS
Now enter the directory we need

cd /usr/local/src/

Download the latest version of DSS

http://github.com/lstoll/dss/tarball/master

Now decompress the file

tar -xvf lstol*

Enter the new directory

cd lstoll*

Build it!!

./Buildit install

Now sit back and enter the matrix, this step may take a while, so sit back, relax and enjoy. I recommend these comics here,here and here

When it is done

cd DarwinStreamingSrvr6.0.3-Linux

Then install (If you haven noticed, case sensitivity is important!)

./Install

Follow the prompts for a Admin username and pass. When it is completely installed, visit your new server at server_ip:1220, enter your username and pass you just created, and configure your server, making /MediaStreaming your streaming directory.

Step 14: Creating a Start/Stop Script

Picture of Creating a Start/Stop Script
We must now create a script which will allow you to start/stop your sever. First, we must create the script file.http://www.instructables.com/id/edit?instructableId=E2YCHZ6FXA2ZASS#

sudo touch /etc/init.d/dss

Then edit it

sudo pico /etc/init.d/dss

Courtesy of ruman of Ubuntu Forums, we have a script to use. Paste this into your terminal
#——————————————————————————————-
#!/bin/sh
#
# chkconfig: 35 92 12
# description: Quicktime Streaming Media Server
#
# init script to start up the quicktime (Darwin) streaming server

case “$1” in
start)
if test -r /var/lock/dssd
then
echo “Lockfile /var/lock/dssd exists. Server not started.”
failure
else
echo “Starting Darwin Streaming Server: ”
/usr/local/sbin/streamingadminserver.pl
touch /var/lock/dssd
echo “Darwin Streaming Server started…”
fi
;;

stop)
echo “Stopping Darwin Streaming Server: ”
[-f /var/lock/dssd] || exit 0
echo “stopping…”
killall streamingadminserver.pl
rm -f /var/lock/dssd
echo
;;

restart)
$0 stop
sleep 1
$0 start
;;

*)
echo “Usage: $0 [start|stop|restart]”
exit 1
esac
exit 0
#————————————————————————————————–

Make it executable

sudo chmod +x /etc/init.d/dss

And make it start at boot

update-rc.d dss defaults

Like before, you can drag files from any computer on your network to your server, courtesy of samba, which will automatically show up on your servers.

Step 15: Adding Playlists to DSS

Go to server_ip:1220 in your browser, and in the left-hand bar, click “Playlists”. Name it and add files, be sure to un-check Send this Playlist to a broadcast server, unless you plan to create a broadcast server, or already have one. After you finish, push the play button next to the playlist to stream it.

Now you can view your streaming in Quicktime Player by entering you streaming URL into the player, the URL should be in this format,

rtsp:// server_ip /MediaStreaming/ file_you_want_to_stream

Step 16: Enjoy

Picture of Enjoy
The sky is the limit, Google to find out more about streaming, and the potential things you can do. Your media is worldwide now, just create a proper firewall so that hackers do turn your friendly media server, into an evil hack machine. If you have stuck with this guide, kudos to you, it will prover to be worth it.
Now go outside, play some games, or do something fun, you’ll probably need a pick-me-up after the tediousness of this guide.

Login as Root in Ubuntu

By: .

For new users who just starting with Ubuntu and wanting to know about the root account, here’s a brief post that gives you a little insight about the root account and how / why to use it.  You see, every Ubuntu edition comes with a root account.

The root account is also known as the administrator account. Think of the root account as an account with god-like rights. It can delete any file, any folder and make any change to the system. The power of the root account is limitless.

Because the root account is so powerful, it is automatically created with a password value with no possible encrypted match on the system, which makes it unusable to sign on with. So instead of directly logging on with the root account, users are encouraged to use the sudo command.

The sudo command allows authorized users to temporary elevate their privileges using their own password without knowing the root password or using the root account.

If you still want to enable and logon with the root account for other unknown reasons, simply give it a password. This will enable the root account.

sudo passwd

The commands above will enable the root account but to sign on as the root user, you must enable manual logon since it’s now been disabled in Ubuntu. The manual logon option allows for users to type their logon name as well as the password for the account instead of just selecting an account from the logon screen.

To enable manual logon with Ubuntu 13.10, open the config file by running the commands below

sudo gedit /etc/lightdm/lightdm.conf.d/50-unity-greeter.conf
Create lightdm.conf in Ubuntu 14.04
sudo gedit /etc/lightdm/lightdm.conf

Then add the line below as shown in the image.

greeter-show-manual-login=true

ubuntu-root-logon_thumb[1]

Save the file and restart your computer.

For earlier versions of Ubuntu, you may find this config file in a different location under /etc/lightdm. It may be called lightdm.conf.

On the logon screen, you can then type the root username with password to sign on.

ubuntu-root-logon-1_thumb[1]

If you want to lock / disable the root account, run the commands below.

sudo passwd -l root

Change Root Password

$ sudo passwd root 

Disable Guess Login, add this into file: 50-unity-greeter.conf

user-session=ubuntu
allow-guest=false
greeter-show-remote-login=false

 

Copy From: http://www.liberiangeek.net/2012/05/login-as-root-in-ubuntu-12-04-precise-pangolin/

Config ISCSI Drive to Local Drive in Ubuntu for Fixed 403 when you change Document Root in Apache2

By Sochinda,

When you connect iscsi initiator that using open-iscsi already in to your server you will get drive as:

/media/root/drivename

***root: is a user name that you have connected to iscsi

and when you change Document Root in Apache2 to that drive, you will got 403 Error.

For fix this error:

sudo umount /dev/sda3
mkdir /media/DriveD
sudo ntfs-3g /dev/sda3 /media/DriveD

Finally, you can use /media/DriveD instead /media/root/drivename

Connect to the iSCSI targets by Open-iSCSI Initiator on Ubuntu Linux

This section shows you how to use Linux Open-iSCSI Initiator on Ubuntu to add the iSCSI target (QNAP NAS) as an extra partition. Before you start to use the iSCSI target service, make sure you have created an iSCSI target with a LUN on the NAS and installed the correct iSCSI initiator for your OS.

 

About Linux Open-iSCSI Initiator
The Linux Open-iSCSI Initiator is a built-in package in Ubuntu 8.04 LTS (or later). You can connect to an iSCSI volume at a shell prompt with just a few commands. More information about Ubuntu is available at http://www.ubuntu.com and for information and download location of Open-iSCSI, please visit:http://www.open-iscsi.org

 

Before you start
Install the open-iscsi package. The package is also known as the Linux Open-iSCSI Initiator.

 

# sudo apt-get install open-iscsi

 

Now follow the steps below to connect to an iSCSI target (QNAP NAS) with Linux Open-iSCSI Initiator.

You may need to modify the iscsid.conf for CHAP logon information, such as node.session.auth.username & node.session.auth.password.

# vi /etc/iscsi/iscsid.conf

 

Save and close the file, then restart the open-iscsi service.

# /etc/init.d/open-iscsi restart

 

Discover the iSCSI targets on a specific host (the QNAP NAS in this example), for example, 10.8.12.31 with default port 3260.

# iscsiadm -m discovery -t sendtargets -p 10.8.12.31:3260

 

Check the available iSCSI node(s) to connect.

# iscsiadm -m node

 

** You can delete the node(s) you do not want to connect to when the service is on with the following command:

# iscsiadm -m node –op delete –targetname THE_TARGET_IQN

 

Restart open-iscsi to login all the available nodes.

# /etc/init.d/open-iscsi restart

 

You should be able to see the login message as below:

Login session [iface: default, target: iqn.2004-04.com:NAS:iSCSI.ForUbuntu.B9281B, portal: 10.8.12.31,3260] [ OK ]

 

Check the device status with dmesg.

# dmesg | tail

 

Enter the following command to create a partition, /dev/sdb is the device name.

# fdisk /dev/sdb

 

Format the partition.

# mkfs.ext3 /dev/sdb1

 

Mount the file system.

# mkdir /mnt/iscsi

 

# mount /dev/sdb1 /mnt/iscsi/

 

You can test the I/O speed using the following command.

# hdparm -tT /dev/sdb1

 

Below are some “iscsiadm” related commands.

Discover the targets on the host:

# iscsiadm -m discovery –type sendtargets –portal HOST_IP

 

Login a target:

# iscsiadm –m node –targetname THE_TARGET_IQN –login

 

Logout a target:

# iscsiadm –m node –targetname THE_TARGET_IQN –logout

 

Delete a Target:

# iscsiadm –m node –op delete –targetname THE_TARGET_IQN

 

Copy from: http://docs.qnap.com/nas/en/index.html?connect_iscsi_targets_linux.htm

Adding Jasperserver as Service in Ubuntu

By Sochinda

After install jasper report server in Ubuntu server, using terminal as bellow:

  • Create file called jasperserver in init.d

#sudo nano /etc/init.d/jasperserver

  • Insert this text:
#!/bin/sh
### BEGIN INIT INFO
# Provides: jasperserver
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start JasperServer at boot time
# Description: Enable service provided by JasperServer.
### END INIT INFO

JASPER_HOME="/opt/jasperreports-server-cp-4.2.1"

case "$1" in
 start)
 if [ -f $JASPER_HOME/ctlscript.sh ]; then
 echo "Starting JasperServer"
 $JASPER_HOME/ctlscript.sh start
 fi
 ;;
 stop)
 if [ -f $JASPER_HOME/ctlscript.sh ]; then
 echo "Stopping JasperServer"
 $JASPER_HOME/ctlscript.sh stop
 fi
 ;;
 restart)
 if [ -f $JASPER_HOME/ctlscript.sh ]; then
 echo "Restarting JasperServer"
 $JASPER_HOME/ctlscript.sh restart
 fi
 ;;
 status)
 if [ -f $JASPER_HOME/ctlscript.sh ]; then
 $JASPER_HOME/ctlscript.sh status
 fi
 ;;
 *)
 echo $"Usage: $0 {start|stop|restart|status}"
 exit 1
 ;;
esac

  • Set jasperserver in init.d as execute permission

#sudo chmod +x /etc/init.d/jasperserver

  • Update jserperserver as default service in Ubuntu

#sudo update-rc.d jasperserver defaults

Finally, we can use command as:

#sudo service jasperserver start|stop|restart

Reference from: http://community.jaspersoft.com/questions/541044/auto-start-boot