jboss_logoIn the following tutorial we will walk you through the steps of installing and setting up JAVA and JBoss 7 Final using one of our CentOS 6 linux virtual servers.

What is JBoss?

It is an open-source application server developed by RedHat based on the J2EE platform for developing and deploying enterprise Java applications, Web applications, Services, Portals and more. The J2EE allows applications to be standardized and modular allowing JAVA to handle many programming aspects when developing an application.


Make sure you are in a screen session and your CentOS 6 VPS is up-to-date by running:

## screen -U -S jboss-screen
## yum update


First thing to do is to install and set-up JAVA on your CentOS 6 system. JBoss supports Java 6 or Java 7 and in this case we will be using the open-source implementation of Java 7.

Install it by running the command below in your terminal:

## yum install java-1.7.0-openjdk

Verify JAVA is successfully installed by running:

## java -version

java version "1.7.0_55"
OpenJDK Runtime Environment (rhel- u55-b13)
OpenJDK Client VM (build 24.51-b03, mixed mode, sharing)


Next, download the latest stable version of JBoss 7.1.x and install it in /opt directory using:

## wget http://download.jboss.org/jbossas/7.1/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final.tar.gz -P /var/tmp
## tar -zxf /var/tmp/jboss-as-7.1.1.Final.tar.gz -C /opt
## cd /opt/jboss-as-7.1.1.Final

Remove the downloaded archive if you don’t need it:

## rm -f /var/tmp/jboss-as-7.1.1.Final.tar.gz


We need to configure the JBoss AS so it will run without root privileges because running it as root is a big security risk. The best way to run JBoss is by using a dedicated system user which will run the JBoss server using the sudo powers.

So let’s set this up, shall we?

## useradd -r jboss -d /opt/jboss-as-7.1.1.Final
## chown jboss: -R /opt/jboss-as-7.1.1.Final

Ok, with all that in place we are somewhat ready to start the JBoss server. Before doing so, let’s fine-tune some stuff, like enable access to the JBoss web interface and set it up to run as a system service, so that it can automatically start on system start-up and you can use service jboss [start|stop] etc to manage the Jboss service.

– enable access to JBoss interface:

## vim /opt/jboss-as-7.1.1.Final/standalone/configuration/standalone.xml

<interface name="management">
    <!--<inet-address value="${jboss.bind.address.management:}"/>-->
<interface name="public">
    <!--<inet-address value="${jboss.bind.address:}"/>-->

This will make JBoss’ public and management frontend available from anywhere (using authentication of course) so you can manage it via a browser.

– set-up Jboss to run as a service

## cp /opt/jboss-as-7.1.1.Final/bin/init.d/jboss-as-standalone.sh /etc/init.d/jboss
## chmod +x /etc/init.d/jboss
## mkdir /etc/jboss-as

add the following configuration parameters

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


start and add the JBoss server to your CentOS VPS system start-up services using the following commands:

## service jboss start
## chkconfig jboss on

Now, the console log file for your JBoss server will be located in /var/log/jboss-console.log.

– create new JBoss user accounts

In order to use the administration console you need to create new JBoss users using the add-user.sh script in the bin/ directory within your JBoss installation (which in this case is /opt/jboss-as-7.1.1.Final/bin).


## cd /opt/jboss-as-7.1.1.Final/bin
## ./add-user.sh

What type of user do you wish to add?
 a) Management User (mgmt-users.properties)
 b) Application User (application-users.properties)
(a): a

Enter the details of the new user to add.
Realm (ManagementRealm) :
Username : testuser
Password :
Re-enter Password :
About to add user 'testuser' for realm 'ManagementRealm'
Is this correct yes/no? y
Added user 'testuser' to file '/opt/jboss-as-7.1.1.Final/standalone/configuration/mgmt-users.properties'
Added user 'testuser' to file '/opt/jboss-as-7.1.1.Final/domain/configuration/mgmt-users.properties'

You can now access your JBoss administration console at http://YOUR_IP:8080/console using the newly created testuser account.

Of course you don’t have to do any of this if you use one of our Linux VPS Hosting services, in which case you can simply ask our expert Linux admins to install JAVA and JBoss 7 for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.