Install jboss 7.1.1 with jdk 7 on CentOS RHEL Fedora Debian Ubuntu


JavaBeans Open Source Software Application Server (JBoss AS, or simply JBoss) is an application server that implements the Java Platform, Enterprise Edition (Java EE).
JBoss is written in Java and as such is cross-platform: usable on any operating system that supports Java.
JBoss was developed by JBoss, now a division of Red Hat. Licensed under the terms of the GNU Lesser General Public License, JBoss is free and open source software. Source

Install jboss 7.1.1 with jdk 7 on CentOS RHEL Fedora Debian Ubuntu

JBoss require JDK to be installed on your machine, so lets install it first.

# wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=http%3A%2F%2F" ""
# tar zxvf jdk-7u25-linux-x64.tar.gz
# mkdir /usr/java
# mv jdk1.7.0_25/ /usr/java/

On CentOS, RHEL. Fedora

# alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_25/jre/bin/java 2000

On Debian, Ubuntu

# update-alternatives --install /usr/bin/java java /usr/java/jdk1.7.0_25/jre/bin/java 2000

Verify java version

# java -version

java version “1.7.0_25″
Java(TM) SE Runtime Environment (build 1.7.0_25-b20)
Java HotSpot(TM) 64-Bit Server VM (build 23.7-b01, mixed mode)

If you see some other version then use alternatives --config or update-alternatives --config to select the correct version.

On CentOS, RHEL, Fedora

# alternatives --config java

There are 3 programs which provide 'java'.

Selection Command
* 1 /usr/lib/jvm/jre-1.6.0-openjdk.x86_64/bin/java
2 /usr/java/latest/jre/bin/java
+ 3 /usr/java/jdk1.7.0_25/jre/bin/java

Enter to keep the current selection[+], or type selection number: 3

As you can see that I also have openjdk 1.6 installed and active(java with [+] is currently in use). Selecting the 3rd option will make the latest 1.7 active, you can run java -version to verify it.

On Debian, Ubuntu

# update-alternatives --config java
There are 2 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status
* 0 /usr/java/jdk1.7.0_25/jre/bin/java 2000 auto mode
1 /usr/java/jdk1.7.0_25/jre/bin/java 2000 manual mode
2 /usr/lib/jvm/java-6-openjdk/jre/bin/java 1061 manual mode

Press enter to keep the current choice[*], or type selection number:

Download the latest version of JBoss AS

# cd /tmp
# wget

Untar it and move it to a destination of choice, I will use /usr/share

# tar zxvf jboss-as-7.1.1.Final.tar.gz
# mv jboss-as-7.1.1.Final /usr/share/jboss-as

Add a new user and group for jboss, if you are brave enough to run jboss as root skip this step.

# groupadd jboss-as
# useradd -s /bin/bash -g jboss-as -d /usr/share/jboss-as jboss-as

Change permissions.

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

Move the startup script provided with the package and the configuration file to respective directories.

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

Open the configuration file in an editor of choice

# vi /etc/jboss-as/jboss-as.conf



On Debian and Ubuntu, you need to perfom this additional step. Open the init script in an editor of choice

# vi /etc/init.d/jboss-as

Edit line 1 and change it to

#!/usr/bin/env bash

Also replace line 12 with the following

. /lib/lsb/init-functions

Lastly comment out line 111 and 138


Install chkconfig if as its not installed by default on Ubuntu, Debian

On Debian, Ubuntu

# apt-get install chkconfig

Start jboss server and add it to chkconfig so it automatically starts on server reboots.

# chmod 755 /etc/init.d/jboss-as
# chkconfig --add jboss-as
# chkconfig --level 234 jboss-as on
# /etc/init.d/jboss-as start

Run netstat to confirm jboss starts listening on 8080, by default the server listens on the loopback address, to change this behavior edit standalone.xml file.

# netstat -tunlp | grep 8080
tcp 0 0* LISTEN 55856/java

Open the standalone.xml file in an editor of choice

# vi /usr/share/jboss-as/standalone/configuration/standalone.xml

Change jboss bind address for management and public interfaces to ip address it should listen on. I changed it to so that it listens on every available interface.

<interface name="management">
<inet-address value="${}"/>
<interface name="public">
<inet-address value="${jboss.bind.address:}"/>
<!-- TODO - only show this if the jacorb subsystem is added -->
<interface name="unsecure">
~ Used for IIOP sockets in the standard configuration.
~ To secure JacORB you need to setup SSL
<inet-address value="${jboss.bind.address.unsecure:}"/>

At this point if you try access Jboss Management Interface at http://ipaddress-or-domainname:9990, you will be greeted with the following error.

jboss02 300x176 Install jboss 7.1.1 with jdk 7 on CentOS RHEL Fedora Debian Ubuntu

Add a new user

# cd /usr/share/jboss-as/bin/
# ./

What type of user do you wish to add?
a) Management User (
b) Application User (

Enter the details of the new user to add.
Realm (ManagementRealm) :
Username : ryan
Password :
Re-enter Password :
About to add user ‘ryan’ for realm ‘ManagementRealm’
Is this correct yes/no? yes
Added user ‘ryan’ to file ‘/usr/share/jboss-as/standalone/configuration/’
Added user ‘ryan’ to file ‘/usr/share/jboss-as/domain/configuration/’

jboss03 300x187 Install jboss 7.1.1 with jdk 7 on CentOS RHEL Fedora Debian Ubuntu

jboss04 300x187 Install jboss 7.1.1 with jdk 7 on CentOS RHEL Fedora Debian Ubuntu

By default Jboss will listen on port 8080, however you can use ip tables to route traffic from port 8080 to port 80

# iptables -t nat -A PREROUTING -p tcp -m tcp --dport 80 -j REDIRECT --to-ports 8080
# iptables -t nat -A PREROUTING -p udp -m udp --dport 80 -j REDIRECT --to-ports 8080
# service iptables save
# service iptables restart

Or run apache in front of JBoss


Install apache

# yum install httpd

Open the apache configuration file and add a virtual host.

# vi /etc/httpd/conf/httpd.conf

Append the following code to it.

<VirtualHost *:80>

ProxyRequests Off

<Proxy *>
Order allow,deny
Allow from all
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/

ErrorLog logs/jboss-apache-error_log
CustomLog logs/jboss-apache-access_log common

On Debian, Ubuntu

Install apache

# apt-get install apache2

Enable proxy modules

# a2enmod proxy
# a2enmod proxy_http

Open the default site config file in an editor

# vi /etc/apache2/sites-enabled/000-default

Add the ProxyPass and ProxyPassReverse to it.

<VirtualHost *:80>
ServerAdmin webmaster@localhost
ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/
<!--more configuration goes here>

jboss01 300x176 Install jboss 7.1.1 with jdk 7 on CentOS RHEL Fedora Debian Ubuntu