Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

Sponsored Links

Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs

Continuous integration with Hudson

Open source CI server offers easy setup and configuration

  • Print
  • Feedback

Page 4 of 7

Note that there are several ways to install JBoss; in the technique outlined here, you'll create a dedicated jboss user. This is considered a best practice, and is preferable to installing JBoss in your own home directory. The procedure outlined here has been condensed from a useful description at the Ubuntu forums.

First, you need to download the JBoss 4.2.3.GA package. Look for the file named jboss-4.2.3.GA.zip.

Next, you will need to create a user, a home directory, and a group, all named jboss. The group is a convenience not explored in this article; it will allow you to extend JBoss privileges to other users on your Ubuntu server.

Listing 1 shows the commented commands to create the jboss home directory, user, and group, and then install the JBoss server. Some commands are prefixed with sudo because they are root-privileged commands.

Listing 1. Creating the jboss account and installing the server

echo Create the jboss group
sudo groupadd jboss
echo Create the jboss user, define bash as the user's default shell and /home/jboss as the home directory
echo and make the user jboss part of the group jboss
sudo useradd -s /bin/bash -d /home/jboss -m -g jboss jboss
echo Copy the jboss-4.2.3.GA file to /home/jboss or download directly into that directory
sudo mv jboss-4.2.3.GA /home/jboss
echo Change the owner of the file to jboss
sudo chown jboss:jboss /home/jboss/jboss-4.2.3.GA
echo Log into the jboss account
sudo su jboss
echo Go to the jboss home directory
cd 
echo Unzip the file jboss-4.2.3.GA
unzip jboss-4.2.3.GA
echo Create a symbolic link "jboss" for "jboss-4.2.3.GA".
echo This allows you to change JBoss versions with minimal changes
ln -s jboss-4.2.3.GA jboss

If the unzip command is not already installed, enter the following command (while logged in as a sudo-enabled user) to install it:

Sudo apt-get install unzip

The JBoss server is now basically installed. You could start the server using the following command:

/home/jboss/jboss/bin/run.sh

In this example, however, you will instead install an auto startup script so that the service starts up automatically when the host starts. The JBoss download comes with three different int.d scripts, but each needs to be tweaked; you can download the jboss-init.sh script, which will enable the automatic start and stop of the server. Then run the commands shown in Listing 2.

Listing 2. Installing the autostart script for JBoss

echo Move the jboss-init.sh file to /etc/init.d/ and rename it to jboss
sudo mv jboss-init.sh /etc/init.d/jboss
echo Change the owner of the /etc/init.d/jboss file to root
sudo chown root:root /etc/init.d/jboss
echo Make the /etc/init.d/jboss file executable
sudo chmod ug+x /etc/init.d/jboss
echo Activate the /etc/init.d/jboss file in the rc.d lifecycle process.
sudo update-rc.d jboss defaults

Now you can start the JBoss server as a background process (which will not terminate when you log out) with the following command:

sudo /etc/init.d/jboss start

To verify that JBoss is running (it may take up to a few minutes to start), point your browser to http://localhost:8080/jmx-console. Figure 9 shows the JBoss JMX console that should appear.

  • Print
  • Feedback

Resources

Downloads

  • Get the latest Hudson WAR file here or here.
  • Download apache-tomcat-6.0.18.exe to install Tomcat on your Windows machine. Download JBoss 4.2.3.GA for a Linux environment (look for the file named jboss-4.2.3.GA.zip).
  • Ant is the build tool used for examples in this article.
  • jboss-init.sh enables the automatic start and stop of the JBoss server.
  • If your Hudson server cannot connect to outside resources, you can download the plugins you need from the Hudson Website.

Learn more

More from JavaWorld