This is a short step-by-step setup guide for JBoss 7.0.2 on Linux ((Debian). Nowadays there is still no official Debian package for JBoss 7 out there, so we have to do a couple of steps manually.
1. download and prepare
Start by download the currently available version (7.0.2) of the JBoss 7.
#Web Profile version download.
wget http://download.jboss.org/jbossas/7.0/jboss-as-7.0.2.Final/jboss-as-web-7.0.2.Final.tar.gz
Extracting files to the final location using tar.
tar zxvf jboss-as-web-7.0.2.Final.tar.gz -C /usr/local/
Now your JBoss 7 is placed inside /usr/local/jboss-as-web-7.0.2.Final/
. I don’t like that name. It’s just cosmetics, but I prefer to rename the last part of the path.
cd /usr/local/
mv jboss-as-web-7.0.2.Final/ jboss-7.0.2
Now basic security, we don’t want to start JBoss with root rights.
Therefore we need to create new user and new group named jboss
. Make them owners of your JBoss files:
addgroup jboss
useradd -g jboss jboss
chown -R jboss:jboss /usr/local/jboss-7.0.2/
Your JBoss 7 is almost installed now.
2. Configuration and the first test
Start your brand new JBoss 7 server with:
sudo -u jboss sh /usr/local/jboss-7.0.2/bin/standalone.sh &
Now it is testable on your local machine with http://localhost:8080
But if you trying to install JBoss on the remote machine and want to access this installation remotely, you need to enable the remote interface of your JBoss. I assume we start by standalone configuration, so you have to edit /usr/local/jboss-7.0.2/standalone/configuration/standalone.xml
file. The easiest way is to search for <interfaces>
section and replace the 127.0.0.1 address with <any-address/>
<interfaces>
<interface name="management">
<any-address/>
</interface>
<interface name="public">
<any-address/>
</interface>
</interfaces>
Beware of what you doing here, you expose also the management console to the public. Now you can access your jboss from anywhere. The console is bounded to interface named=“management” by default.In production environments, you have to put more attention to this.
3. JBoss as Service
Now we have a basic configured JBoss, but I want to maintain it as a service. Unfortunately, JBoss archive has no predefined init.d
scripts, so I have to to it on my own. But this is not a big problem, just straightforward following some Debian conventions and useful scripts.
Ok, let’s create JBoss maintenance script.
touch /etc/init.d/jboss
chmod 755 /etc/init.d/jboss
Ready! Now put the following inside.
#!/bin/sh
#BEGIN INIT INFO
#Provides: jboss
#Required-Start: $localfs $remotefs $network $syslog
#Required-Stop: $localfs $remotefs $network $syslog
#Default-Start: 2 3 4 5
#Default-Stop: 0 1 6
#Short-Description: Management of JBoss AS v7.x
#END INIT INFO
#Defining JBOSS_HOME
JBOSS_HOME=/usr/local/jboss-7.0.2
case "$1" in
start)
echo "Starting JBoss AS7..."
sudo -u jboss sh ${JBOSSHOME}/bin/standalone.sh &
;; stop)
echo "Stopping JBoss AS7..."
sudo -u jboss sh ${JBOSSHOME}/bin/jboss-admin.sh --connect command=:shutdown
;; log)
echo "Showing server.log..."
tail -1000f ${JBOSS_HOME}/standalone/log/server.log
;; *) echo "Usage: /etc/init.d/jboss {start|stop|log}"
exit 1
;; esac exit 0
This file is ready to use. You can use itself for the manual start and stop of your JBoss, you also can follow the server.log by using “log” parameter.
But let’s make it to the end, as an automatic starting service. It’s easy with update-rc.d
script:
update-rc.d jboss defaults
Now your ready and your JBoss will be shut down on machine shutdown and it should start on machine start-up.
Of course, this is not the only way to start using JBoss 7. Your ideas are welcome!