source:
How to Install JBOSS 7.1.1 Step by Step on CentOS
First install JAVA SDK 7
# yum -y groupinstall 'Development Tools'
Then Download
Java 7 SDK. I used the rpm release to install it. If you wish to install from source download the tar file. Install it using the rpm command
# rpm -ivh jdk-7u79-linux-x64.rpm
Then execute the following commands
# export JAVA_HOME=/usr/java/jdk1.7.0_79
# export JAVA_HOME
# PATH=$JAVA_HOME/bin:$PATH
# export PATH
Now, ensure the path has been set correctly with below command,
# echo JAVA_HOME
Will shows JAVA_HOME path
To check java Version:
# java -version
Now to install JBOSS after completing the installation of Java SDK.
Download JBOSS 7 Final
# wget http://download.jboss.org/jbossas/7.1/jboss-as-7.1.1.Final/jboss-as-7.1.1.Final.zip
Extract that files and move the folder
# unzip -q jboss-as-7.1.1.Final.zip
# mv jboss-as-7.1.1.Final /usr/share/jboss-as
Create a user jboss
# groupadd jboss
# useradd -s /bin/bash -g jboss jboss
Add this to the .bash_profile of the created jboss user. The command is as below...
# sudo -u jboss vim /home/jboss/.bash_profile
Then add the content before "export PATH" line
export JAVA_HOME=/usr/java/jdk1.7.0_79
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
Symlink the config file for JBoss.
# mkdir /etc/jboss-as
# ln -s /etc/jboss-as/jboss-as.conf /usr/share/jboss-as/bin/init.d/jboss-as.conf
Then edit the config. Set it like below...
# General configuration for the init.d scripts,
# not necessarily for JBoss AS itself.
# The username who should own the process.
#
JBOSS_USER=jboss
# The amount of time to wait for startup
#
# STARTUP_WAIT=30
# The amount of time to wait for shutdown
#
# SHUTDOWN_WAIT=30
# Location to keep the console log
#
JBOSS_CONSOLE_LOG=/home/jboss/log/console.log
Symlink the start/stop/restart script for JBoss.
ln -s /etc/init.d/jboss /usr/share/jboss-as/bin/init.d/jboss-as-standalone.sh
To start JBOSS run from command line
# /etc/init.d/jboss start
To check if running...
# netstat -anp | grep 8080
tcp 0 0 127.0.0.1:8080 0.0.0.0:* LISTEN 12710/java
Using "top" command the JAVA service should be ran by
jboss user, not root.
Now to make it run on boot
# chkconfig --add jboss
# chkconfig --level 234 jboss on