Today I got JBoss AS 7.1.0.CR1 fresh out of oven. The GA release is expected in next month. Full JavaEE certification is planned for this release. The following tutorial demonstrates how to set up JBoss AS7.1 on RHEL6.
Install JBoss AS7.1 on RHEL6:
Follow these five easy steps to get started with JBoss AS on RHEL6.
- Create User
/usr/sbin/groupadd -g 503 jboss /usr/sbin/useradd -u 503 -m -g jboss jboss passwd jboss
- Install Software
Before we install JBoss, make sure Java6 is installed and JAVA_HOME is set. JBoss AS7 installation is quite simple. You can just extract the compressed archive. To facilitate easy server upgrade, we should also create a softlink.
tar -xvf jboss-as-7.1.0.CR1.tar.gz chown -R jboss:jboss /opt/jboss-as-7.1.0.CR1 ln -s /opt/jboss-as-7.1.0.CR1 /opt/jboss-as
- Start server
JBoss server could be started in standalone mode by running /opt/jboss-as/bin/standalone.sh. This binds JBoss only to localhost. To bind JBoss to another IP address, to allow remote server administration, we can change the /opt/jboss-as/standalone/configuration/standalone.xml as follows.
<interfaces> <interface name="management"> <!--<inet-address value="${jboss.bind.address.management:127.0.0.1}"/>--> <inet-address value="172.xx.xxx.xx"/> </interface> <interface name="public"> <!--<inet-address value="${jboss.bind.address:127.0.0.1}"/>--> <inet-address value="172.xx.xxx.xx"/> </interface> </interfaces>
However, this is not a recommended approach. Instead of modifying the central configurations, the startup customizations should be configured in bin/standalone.conf property file. Add the following lines in the configuration file.
JAVA_OPTS="$JAVA_OPTS -Djboss.bind.address.management=172.xx.xxx.xx" JAVA_OPTS="$JAVA_OPTS -Djboss.bind.address=172.xx.xxx.xx"
By default, no users are created when you install JBoss. So lets first create a admin user with /opt/jboss-as/bin/add-user.sh. The script requires three inputs:
1. Realm – this is the name of the realm used to secure the management interfaces; default is ‘ManagementRealm’. Keep the default by pressing enter.
2. Username – the username needs to be alpha numeric. Enter ‘admin’
3. Password – Should not be same as username. Enter ‘password’.
[jboss@machine bin]$ ./add-user.sh Enter the details of the new user to add. Realm (ManagementRealm) : Username : admin Password : Re-enter Password : The username 'admin' is easy to guess Are you sure you want to add user 'admin' yes/no? yes About to add user 'admin' for realm 'ManagementRealm' Is this correct yes/no? yes Added user 'admin' to file '/opt/jboss-as-7.1.0.CR1/standalone/configuration/mgmt-users.properties' Added user 'admin' to file '/opt/jboss-as-7.1.0.CR1/domain/configuration/mgmt-users.properties'
- Admin Console
Once the server is running, you can access the JBoss admin console from your desktop with the URL http://172.xx.xxx.xx:9990/console/App.html
Use the credentials admin/password to logon.
- Start as a Service
Now that basic setup is done, lets set up JBoss as a service. The scripts required to start JBoss as a service are available with JBoss distribution in /opt/jboss-as/bin/init.d directory. First edit jboss-as.conf by adding the entry for JBoss user as JBOSS_USER=jboss. Also modify jboss-as-standalone.sh to set the right parameters e.g. change the processname to ‘jboss’ instead of ‘standalone’. Also make sure right directories are configured for logs and pid file creation.
#!/bin/sh # # JBoss standalone control script # # chkconfig: 345 80 20 # description: JBoss AS Standalone # processname: jboss
Now we can add JBoss as a service using chkconfig.
cp /opt/jboss-as/bin/init.d/jboss-as.conf /etc/jboss-as/ chmod 755 /opt/jboss-as/bin/init.d/jboss-as-standalone.sh cp /opt/jboss-as/bin/init.d/jboss-as-standalone.sh /etc/init.d/jboss chkconfig --add jboss
Once these configurations are done, JBoss can be started as a service with following commands. Make sure there are no errors in console.log.
#Start JBoss service jboss start #Stop JBoss service jboss stop #Restart JBoss service jboss restart
Conclusion:
In this introductory blog post about JBoss AS, I’ve demonstrated how to install JBoss on RHEL6 and configure JBoss as a service.
December 26, 2011 at 12:31 pm
Hi there,
If you buy the official JBoss EAP from RedHat directly, you’ll get an RPM that creates a service automatically. It’s also very convenient install or remove using an RPM.
Do you know of any project that will distribute RPM versions of JBoss 7, embedding your (excellent) instructions in pre/post-install scripts?
Also, the JBoss EAP version installs into /var/jbossas. Why did you choose for /opt/jboss?
Greets, Geert.
December 27, 2011 at 12:45 am
Why do You make a copy, not a link to .conf & .sh files at /etc?
I think, this approach is not good.
Regards,
Alexander.
March 30, 2012 at 3:45 pm
@Geert
I used Community edition which obviously doesn’t come with rpms. I don’t know any project which provides these rpm’s. Good luck!
@ArchiMage
Yes. That’s true. We should indeed use symlinks.
April 13, 2012 at 2:13 pm
Hello I’m from Ecuador
It is a good contribution to the programmers.
I need some help migrating a project Jboss 6.0.1 Final JEE has made Jboss 7.0.1.
May 17, 2012 at 4:59 pm
Hi,
I’m trying to access JBoss AS 7.1.1 Final version by specifying DNS / static IP.
As per the steps mentioned in this article, I followed the steps:
a. Modify standalone.conf – added JAVA_OPTS=”$JAVA_OPTS -Djboss.bind.address=172.xx.xxx.xx and restarted the server. When JBoss starts I see the specified IP but I can’t access the server from browser [http://172.xx.xxx.x:8080]
b. I also modified standalone.xml – interface tag like
or or 0.0.0.0
When JBoss starts I see the specified IP but I can’t access the server from browser [http://172.xx.xxx.x:8080]
Please let me know what am missing. Very critical.
Appreciate your help.
Regards,
Syed
October 1, 2012 at 2:51 pm
This article was extremely helpful!
Thank You.