In this tutorial, I will demonstrate how to download, install, start
and stop a JBoss EAP 6.0.0 server on Red Hat Enterprise Linux 6.3. We use OracleJDK 6 for
this tutorial. This is the same installation procedure for CentOS and
Fedora. All steps in this tutorial must be performed as root.
Step 1: JDK Installation
The first step before installing JBoss EAP 6, is to install a JDK.
Any JDK can be used, such as OracleJDK, OpenJDK, IBM JDK etc. I chose OracleJDK 6 for this tutorial.
Note: JDK 7 and above can also be used with JBoss. A JRE is also
sufficient to run JBoss EAP 6, however a JRE does not include some of
the additional feature of a JDK.
Installing OracleJDK:
Download oracleJDK 6 from oracle.
http://www.oracle.com/technetwork/java/javasebusiness/downloads/java-archive-downloads-javase6-419409.html#jdk-6u33-oth-JPR
or
http://download.oracle.com/otn/java/jdk/6u33-b04/jdk-6u33-linux-x64.bin
We used OracleJDK 6u33
Issue the following command to install the JDK:
$chmod 755 jdk-6u33-linux-x64.bin
$./jdk-6u33-linux-x64.bin
follow the steps.
$mkdir /usr/java
$mv jdk1.6.0_33 /usr/java
Set JAVA_HOME
$vi /etc/profile.d/java.sh
add following lines
###########
export JAVA_HOME=/usr/java/jdk1.6.0_33
export PATH=$PATH:/usr/java/jdk1.6.0_33/bin
export JAVA_OPTS="-Xms2048m -Xmx2048m -XX:MaxPermSize=512m"
###########
save and exit
$source /etc/profile.d/java.sh
Confirming the install:
Use following command to confirm that the proper version of the JDK is on your classpath:
$ java -version
Step 2: Download JBoss and the installation procedure
The next step is to download the appropriate version of JBoss EAP 6.
We will download the .zip version of JBoss AS EAP 6.0.0, and install it.
Downloading JBoss EAP 6.0.0:
jboss-eap-6.0.0.zip can also be downloaded with your favorite browser
from the
https://access.redhat.com/jbossnetwork/restricted/listSoftware.html.
Installing JBoss EAP 6.0.0:
Next, we issue the following unzip command to finally install jboss-eap-6.0.0 in the /usr/local/stack directory:
$ unzip jboss-eap-6.0.0.zip -d /usr/local/stack
Alternatively, any directory can be chosen for the JBoss 6 installation.
Step 3: Add the appropriate user for JBoss
Now that JBoss EAP 6 is installed, we need to make sure that we
create a user with the appropriate privileges. It is never a good idea
to run JBoss as root for various reasons.
Create the new user:
We create a new user called jboss by issuing the following command:
$ adduser jboss
Alternatively, any username can be used. However, the username must be specified in the jboss-as.conf file.
Change ownership of the installation directory:
We need to assign the appropriate ownership to the installation
directory for the newly created jboss user by issuing the command:
$ chown -fR jboss:jboss /usr/local/stack/jboss-eap-6.0/
Change directory to the jboss bin directory:
Now, lets change directories to the JBoss bin directory. This
dorectory contains the necessary scripts to start, stop and manage your
JBoss installation.
$ cd /usr/local/stack/jboss-eap-6.0/bin
Add a jboss management user:
The final step before we install the service, is to add a management
user. This is an internal JBoss management user, necessary to access the
new JBoss management console.
$ ./add-user.sh
You should see the following message on the console after executing the command:
What type of user do you wish to add?
a) Management User (mgmt-users.properties)
b) Application User (application-users.properties)
(a): a
We select “a”, next you should see the following message:
Enter the details of the new user to add.
Realm (ManagementRealm) :
Username : jboss
Password :
Re-enter Password :
* hit enter for Realm to use default, then provide a username and password
We select the default value for the Realm (ManagementRealm), by hitting
enter, and select “jboss” as our username. By default, we supply “jbo55”
as our password, of course, you can provide any password you prefer
here.
Step 4: Create the JBoss EAP 6.0.0 standalone service:
Now that JBoss EAP 6 are configured with the admin user, we can proceed with creating the JBoss service.
Link the jboss-as-standalone.sh script to init.d:
We need create a symbolic into init.d. The name of the target is the name of the service, which in this example is jboss-as:
$ /bin/ln -s -T /usr/local/stack/jboss-eap-6.0/bin/init.d/jboss-as-standalone.sh /etc/init.d/jboss-as
Link the jboss-as installation directory to /usr/local/stack/jboss-as:
/bin/ln -s -T /usr/local/stack/jboss-eap-6.0 /usr/local/stack/jboss-as
Create the /etc/jboss-eap directory:
$ mkdir /etc/jboss-as
Change ownership of the /etc/jboss-as directory:
$ chown jboss:jboss /etc/jboss-as
Link the jboss-as.conf file to /etc/jboss-as:
There is also a jboss-as.conf file that is included with the JBoss
EAP 6 Service script. this file is extremely useful in configuring the
init.d service with the username, startup and shutdown wait time, and
the location of the console log file.
$ /bin/ln -s -T /usr/local/stack/jboss-eap-6.0/bin/init.d/jboss-as.conf /etc/jboss-as/jboss-as.conf
Add the “jboss” user to the jboss-as.conf file:
Edit the “jboss-as.conf” to update the “jboss” user we created:
$ vi /etc/jboss-as/jboss-as.conf
Change the default “jboss-as” user to the “jboss” user we created:
#JBOSS_USER=jboss-as
To:
JBOSS_USER=jboss
Step 5: Setup the server to listen on all interfaces:
Once the appropriate JBoss service is created, we will configure the
server to listen on all interfaces for the management and public
interfaces.
Edit the default standalone.xml file:
Step 1:
Edit the /usr/local/stack/jboss-as/
standalone/configuration/
standalone.xml file in your favorite text editor.
Step 2:
Next, update the following section:
From:
<interface name=”management”>
<inet-address value=”${jboss.bind.address:
127.0.0.1″/>
</interface>
<interface name=”public”>
<inet-address value=”${jboss.bind.address:127.0.0.1}”/>
</interface>
To:
<interface name=”management”>
<inet-address value=”${jboss.bind.address:0.
0.0.0}”/>
</interface>
<interface name=”public”>
<inet-address value=”${jboss.bind.address:0.0.0.0}”/>
</interface>
Note: By default, JBoss EAP 6 will only bind to localhost (127.0.0.1). This does
not allow any remote access to your jboss server. For network installation, we define the jboss.bind.address property as 0.0.0.0 and
jboss.bin.address.management property to 0.0.0.0 as well. This allows us
to access the JBoss instance over the network (LAN/WAN).
Step 6: Activate the JBoss EAP 6.0.0 standalone service:
Now that we have the setup completed, and the appropriate links
created, we can activate our JBoss EAP 6 service and register it.
Activate the JBoss EAP 6, standalone service:
In order to activate our service, the first step is to add the
service to the system configuration by executing the following using the
chkconfig command:
$ chkconfig –add jboss-as
Configure the JBoss EAP 6 service to automatically start and stop:
Next, we issue the following command to start the JBoss EAP 6
standalone service at boot time, and stop it gracefully when the server
is shutdown or restarted using the chkconfig command:
$ chkconfig jboss-as on
Step 7: Start the JBoss EAP 6 standalone service:
Once the JBoss EAP 6 standalone service has been setup, we are now
ready to start our new JBoss EAP 6 server. We can do this either by
restarting our Operating System, or by starting the service manually for
the first time. Subsequent Operating System restarts will of course be
handled trasparently by the service we added.
Manually startup the JBoss EAP 6 standalone service for the first time:
To manually startup your JBoss EAP 6 service, execute the following command:
$ /sbin/service jboss-as start
Test your JBoss EAP 6 installation:
A good indication of a successful startup is that you can login to
the JBoss admin console. Type in the following in your browser window,
where your IP should be replaced with the address of your server IP:
http://your-IP::9990/
You can also easily check the startus by executing the status command:
$ /sbin/service jboss-as status
Step 8: Stop the JBoss EAP 6 standalone service:
After successfully starting up JBoss EAP 6, lets demonstrate how to shut your JBoss server down in this section.
Manually shutdown the JBoss EAP 6 standalone service:
To shutdown your JBoss EAP 6 service, execute the following command:
$ /sbin/service jboss-as stop
Step 9: Restart the JBoss EAP 6 standalone service:
Your JBoss EAP 6 service can also be easily restarted with one command. This is demonstrated in this section.
Restart the JBoss EAP 6 standalone service:
To shutdown your JBoss EAP 6 service, execute the following command:
$ /sbin/service jboss-as restart