Setup/Install JBoss Application Server AS7 – Jason Rogers

Working with JBoss version 4, 5 and 6 over the years. I finally wanted to upgrade a server to JBoss version AS7. I will describe how to do a base setup of JBoss AS 7 on a Linux platform, in less than 15 minutes. I have found that JBoss 7 on Linux as a very small imprint on system resources, and the admin console, is has a drastic change for the good over prevoius versions.

1: Download version AS 7 from the JBoss site located here:
http://download.jboss.org/jbossas/7.0/jboss-as-7.0.2.Final/jboss-as-web-7.0.2.Final.tar.gz

2: Download Java 1.7 or higher from here:
http://www.oracle.com/technetwork/java/javase/downloads/jre-7u2-download-1377135.html

3: Download ANT from here:
http://ant.apache.org/bindownload.cgi

Untar ANT and JBoss to your standard installation directory. For this example, we will use “/usr/local”

4: Install the java rpm and perform a “which Java” or “java -version” command to ensure that
the new version is currently the working version. Inside of /usr/java you should see something like the below.
Ensure that the softlinks point back to the new version of java we just installed.

default -> /usr/java/latest
dk1.7.0_02
latest -> /usr/java/jdk1.7.0_02

5: Setting up the environment variables. That are a couple of ways to do this, everyone has their preference. Mine, is to set them in the “/etc/profile”. So do the following.

nano /etc/profile

ADD NEAR LINE 45


export JBOSS_HOME=/usr/local/jboss-as-web-7.0.2.Final
export JAVA_HOME=/usr/local/jdk1.7.0_02
export ANT_HOME=/usr/local/apache-ant-1.8.2
export PATH=$JAVA_HOME/bin:$ANT_HOME/bin:$PATH

VERSION Numbers change, so ensure that the above match your version number. You will need to logout and log back into shell at this point.

6: Not good to run as root, so let’s create a user and group for JBoss to run as.
groupadd -g 502 jboss
useradd -u 502 -g jboss -c "JBoss App" jboss

Set all of the file permission for our install to user jboss.

7: Let’s create a simple startup script.

nano jb7start

ADD THE BELOW

LOGFILE=/var/log/jboss.log
RUNOPTIONS="-b domain/IP"
cd $JBOSS_HOME/bin
nohup ./standalone.sh $RUNOPTIONS >$LOGFILE 2>&1 &

See THIS POST to setup as a Linux Service.

8: Startup JBoss by initiating the ./jb7start script file.

At this point, JBoss should be up and running. Let’s check to see if where are running by navigating to http://domain:8080 – You should see a nice JBoss AS splash page. You will not be able to get to the administration page unless you login locally to the server you installed JBoss on. Who installs a GUI on Linux anyway, so to overcome this, edit the standalone.xml configuration file inside of “$JBOSS_HOME/standalone/configuration/

Find the lines that show






AND CHANGE IT TO THE SERVER IP OF THE HOST.







You will need to setup some security around this, not covering it in this topic.

Restart JBoss and you should now be able to navigate to the administration page.

9: We can now deploy a test war file to ensure everything is going good. Here is a simple hello world
test file you can use. Two ways to deploy, either do it inside of the administration console or you can just
just drop the test war file in the “/home/jboss/jboss-as-web-7.0.2.Final/standalone/deployments” directory.

Navigate to http://IP:8080/helloworld/hi.jsp

and you should see our hello world page.

JBoss AS 7 is now installed. For those of you wanting to pass port 8080 through apache on port 80.

Do the following

nano /etc/httpd/conf/httpd.conf

AND ADD AT THE BOTTOM


# ServerAlias www.myjbosssite.com
DocumentRoot /usr/local/jboss-as-web-7.0.2.Final/docs
Options Indexes +FollowSymLinks
ProxyPreserveHost On
ProxyPass / http://IP:8080/
ProxyPassReverse / http://IP:8080/

Restart apache. You should now be able to navigate to our hello world page without port 8080 – http://IP/helloworld/hi.jsp

That’s all, a fast and simple setup of JBoss AS 7 in less that 15 minutes including a simple ProxyPass in apache.

I write these tutorials to how I can understand, some have problems, but hey, we all do not think the same.

Enjoy,
Jason Rogers
Linux/Web Systems Engineer

, , , , , ,

3 Comments

  • John says:

    Thank you for the tutorial of the setup of JBoss 7. I found this today after looking a couple of days for a simple JBoss setup and this is exactly what I was looking for.

  • Rick says:

    I come across your blog from time to time. I see you tag your post with Charlotte. Are you located in Charlotte, NC? Would you entertain working for a fortune 500 company here in Charlotte?

  • Jason says:

    I am located in Charlotte, NC. No recruiters please – I will only talk to direct companies. Jason.Rogers@RogersIT.net is my contact.