Installing and setting-up JAVA & JBoss 7 Final on a CentOS 6 Linux VPS


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.

UPDATE THE SYSTEM

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

INSTALL JAVA

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-2.4.7.1.el6_5-i386 u55-b13)
OpenJDK Client VM (build 24.51-b03, mixed mode, sharing)

INSTALL JBOSS

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

CONFIGURE JBOSS

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:127.0.0.1}"/>-->
    <any-ipv4-address/>
</interface>
<interface name="public">
    <!--<inet-address value="${jboss.bind.address:127.0.0.1}"/>-->
    <any-ipv4-address/>
</interface>

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

JBOSS_HOME=/opt/jboss-as-7.1.1.Final
JBOSS_CONSOLE_LOG=/var/log/jboss-console.log
JBOSS_USER=jboss

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).

example:

## 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.

Tutorials
Install CachetHQ on CentOS 7
Tutorials
Password Protecting Directories With Nginx
Tutorials
How to install CubeCart on Ubuntu 14.04
  • Dale Murray

    These instructions do not mention opening holes in the firewall for 8080 and 9990


  • asset protection services

    Reading this article gave me many things to think about. You have some quality information here that any reader would enjoy. I share many of your views in this article.


  • Ryan Cox

    Ryan CoxRyan Cox

    Author Reply

    Thank you for this… Straight forward and had me up and running in 10 minutes.


  • Manii

    ManiiManii

    Author Reply

    Hi … could you please share how to stop JBoss 7.1.1 ….


    • admin

      adminadmin

      Author Reply

      Try with: service jboss stop


  • luca

    lucaluca

    Author Reply

    Hi, please, may you add a short guide to setup jboss to be reached through https protocol and how to add an existing certificate?
    Thanks in advance ;-)


    • admin

      adminadmin

      Author Reply

      Hi Luca, the plan to write an article about that topic is already in motion. Thanks for your suggestion.