Install JBoss on CentOS 6.x

This guide is to install JBoss 7.1.1 in standalone mode not domain mode.

JBoss 7.1.1 will work with JDK 6 or JDK 7.
Start by creating a directory:

~# mkdir /usr/java
~# cd /usr/java

Then install java for 64 or 32 bit OS:

~# wget –no-cookies –no-check-certificate –header “Cookie:; oraclelicense=accept-securebackup-cookie” “”

~# wget –no-cookies –no-check-certificate –header “Cookie:; oraclelicense=accept-securebackup-cookie” “”

Extract it in the /usr/java directory:
~# tar -zxf jdk-7u79-linux-x64.tar.gz

This will create the directory, /usr/java/jdk1.7.0_79 this will be the JAVA_HOME.

~# ls – should give the tarball and the jdk1.7.0_79 directory
~# cd jdk1.7.0_79
~# pwd – should be /usr/java/jdk1.7.0_79

Now download and install JBoss 7.1.1 application server:

~# cd /usr/share
~# wget
~# unzip -q
~# mv jboss-as-7.1.1.Final jboss-as

The JBOSS_HOME is ‘/usr/share/jboss-as’.

~# cd jboss-as
~# pwd – should be /usr/share/jboss-as

Create a new group, jboss, and then create the user jboss and add the user to the jboss group.

~# groupadd jboss
~# useradd -s /bin/bash -g jboss jboss

Change ownership of the JBoss home directory, /usr/share/jboss-as so all files are owned by the user jboss we have created.

~# chown -Rf jboss.jboss /usr/share/jboss-as/

Now, we need to put java into the path of the users jboss and root (you can add to other users as well).

The JAVA_HOME is where we installed the JDK above: /usr/java/jdk1.7.0_79

Add the following to the bottom of .bash_profile of the user jboss and the root user:

~# ~/.bash_profile

export JAVA_HOME
export PATH

~# java -version – should give the version that we have installed.
java version “1.7.0_79”
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

Switch to the user jboss and issue ‘java -version’ to verify that Java is now in the path of user jboss.

~# su – jboss
~# java -version
java version “1.7.0_79”
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

To create a JBoss script, you will need to copy the script located under /usr/share/jboss-as/bin/init.d

As root, copy to /etc/init.d and rename it jboss

~# cd /usr/share/jboss-as/bin/init.d
~# cp /etc/init.d/jboss

change line #5 from it’s original ‘# chkconfig: – 80 20’ to ‘# chkconfig: 234 80 20’ The second was to set the JBOSS_USER.

To set the JBOSS_USER, add the following lines to script:


You can add the lines just under ‘export JAVA_HOME’ on line 18 or so below. So the beginning of your script will look like this:

# chkconfig: 234 80 20

export JAVA_HOME

To run JBoss as a service and enable start up at boot, make the script we created above executable and add it to our chkconfig so it starts at boot.

~# cd /etc/init.d
~# chmod 755 jboss
~# chkconfig –add jboss
~# chkconfig –level 234 jboss on

You should now be able to Start, Stop, and Restart JBoss as a service.

Start JBoss (JBoss can take a little time to start)

~# service jboss start or /etc/init.d/jboss start
Starting jboss-as: [ OK ]
~# service jboss stop or /etc/init.d/jboss stop
Stopping jboss-as: *** JBossAS process (25794) received TERM signal ***
[ OK ]

By default, JBoss 7.1.1 is bound to the loopback IP of, so if you want to make it available on the web, you need to:

Locate standalone.xml under /usr/share/jboss-as/standalone/configuration/.

Open standalone.xml in vi or nano and look for the public interfaces node as shown below.

To make JBoss publicly accessible, change to either to allow access on all interfaces or to your public IP.

Save your changes, start up JBoss, and check it is publicly accessible via http://your_IP:8080


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s