Installing JBoss Portal
May 22, 2009 Posted in: Software Development, Development Tools, System AdministrationToday I finished a successful fresh install of JBoss Portal. Below is the process I followed.
Versions
- JBoss Portal — 2.7.2 (bundled with JBoss AS 4.2.3)
- JavaSE — 5.0 Update 19
- MySQL — 5.1.34 (Community Edition)
- Linux Flavor — Red Hat Enterprise Linux Server 5.2 (64 bit)
Step 1 – Downloads
- I grabbed the Java installer from here http://java.sun.com/javase/downloads/index_jdk5.jsp. The downloaded file was called
jdk-1_5_0_19-linux-amd64-rpm.bin - I grabbed the Portal binaries from here http://www.jboss.org/jbossportal/download/index.html. The downloaded file was called
jboss-portal-2.7.2-bundled.zip - I grabbed the MySQL binary from here http://dev.mysql.com/downloads/mysql/5.1.html#linux-rhel5-x86-64bit-rpms. I downloaded the server (
MySQL-server-community-5.1.34-0.rhel5.x86_64.rpm) and the client (MySQL-client-community-5.1.34-0.rhel5.x86_64.rpm) RPMs - I grabbed the MySQL JDBC driver from this page http://dev.mysql.com/downloads/connector/j/5.1.html. The downloaded file was called
mysql-connector-java-5.1.7.tar.gz
Step 2 – Install JavaSE
-
I made the installer executable
$ chmod +x jdk-1_5_0_19-linux-amd64-rpm.bin
-
Then executed the installer
$ ./jdk-1_5_0_19-linux-amd64-rpm.bin
- I paged through endless legal boilerplate and accepted it by typing yes and hitting enter (hopefully I didn’t sell my soul)
-
The installer extracted the RPM file and installed it.
I double checked the package was installed by querying the RPM database:$ rpm -q jdk
jdk-1.5.0_19-fcs
$This RPM installed all of the files into
/usr/java/jdk1.5.0_19 -
I edited the
/etc/profilefile to make theJAVA_HOMEenvironment variable and Java binaries available to everyone on the box. I added the following lines to achieve thisexport JAVA_HOME=/usr/java/jdk1.5.0_19
export PATH=$PATH:$JAVA_HOME/bin - I double checked it all worked
Step 3 – Deploy Portal Binaries
-
I am never sure the correct place in a Linux distribution to put 3rd party stuff, but I went with /usr/local this time
This created the directory
/usr/local/jboss-portal-2.7.2 -
Once again, I edited the
/etc/profilefile to add the JBoss environment to it by adding the following lineexport JBOSS_HOME=/usr/local/jboss-portal-2.7.2Then I tested it
Step 4 – Change Default Port (Optional)
For my install I have no need to run Apache in front of JBoss, so I want JBoss to listen (or more correctly, have Tomcat listen) directly on port 80 – by default it listens on 8080.
-
I opened the
$JBOSS_HOME/server/default/deploy/jboss-web.deployer/server.xmlfile, (which is a standard Tomcat configuration file) in an editor. -
I changed the port of the HTTP connector to 80 (you can find it by searching for 8080). I also change the HTTPS connector to use 443 (you can find this one by searching for 8443). I then changed the value of the
redirectPortattribute of the HTTP connector to match.
Step 5 – Change Portal to be the root web app. (Optional)
For my install, the Portal will be the main application on the server, so I want it to be accessible from the root of the server, and not have to enter the portal context path all of the time.
- First, I disabled the current root application
-
I opened the
$JBOSS_HOME/server/default/deploy/jboss-portal.sar/portal-server.war/WEB-INF/jboss-web.xmlfile, in an editor. -
I found the
<context -root>tag and changed the vallue to be just a single forward slash character.<context-root>/</context-root> - I saved the file and exited the editor.
Step 6 – Install MySQL
By default, JBoss Portal will use a Hypersonic database for all of its internal data. My environment will be a production environment, so I want to use something more robust.
-
I Installed the MySQL binaries by using a normal RPM install
$ rpm -ivh MySQL-server-community-5.1.34-0.rhel5.x86_64.rpm
$ rpm -ivh MySQL-client-community-5.1.34-0.rhel5.x86_64.rpmThe installation process started the
mysqldservice automatically. It also installed MySQL as a service automatically. -
I checked that it was running
$ mysqladmin version
mysqladmin Ver 8.42 Distrib 5.1.34, for unknown-linux-gnu on x86_64
Copyright 2000-2008 MySQL AB, 2008 Sun Microsystems, Inc.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL licenseServer version 5.1.34-community
Protocol version 10
Connection Localhost via UNIX socket
UNIX socket /var/lib/mysql/mysql.sock
Uptime: 5 hours 29 min 16 secThreads: 1 Questions: 5 Slow queries: 0 Opens: 15 Flush tables: 1 Open tables: 8 Queries per second avg: 0.0
$
There are a lot of things you might want to do to a base MySQL install before putting it into production, but that is beyond the scope of this document. I would start with this link for some of the things you need to consider: http://dev.mysql.com/doc/refman/5.1/en/unix-post-installation.html
Step 7 – Point the Portal at MySQL
- I connected to the MySQL server running on localhost, as the current user (which happened to be root in my case).
-
I created a Database instance for the Portal to use
mysql> CREATE DATABASE jbossportal;
Query OK, 1 row affected (0.00 sec) -
Then I created a user for the Portal to connect as
mysql> CREATE USER ‘portal’@'localhost’ IDENTIFIED BY ‘portalpassword’;
Query OK, 0 rows affected (0.00 sec) -
Then I granted all privileges for the
jbossportalDatabase to the user I just createdmysql> GRANT ALL ON jbossportal.* TO ‘portal’@'localhost’;
Query OK, 0 rows affected (0.00 sec)At this point I quit the MySQL interpreter.
- Next, I untared the MySQL JDBC driver
-
Then I copied the driver jar file to the
$JBOSS_HOME/server/default/lib/directory -
Next I disabled the original Hypersonic datasource
$ mv $JBOSS_HOME/server/default/deploy/portal-hsqldb-ds.xml $JBOSS_HOME/server/default/deploy/portal-hsqldb-ds.xml.bak
-
Then I deployed a datasource descriptor for MySQL. There is an example datasource descriptor in the JBoss Portal binary distribution
$ cp $JBOSS_HOME/setup/portal-mysql5-ds.xml $JBOSS_HOME/server/default/deploy
I double checked the username, password and database name settings in the file were correct
Step 9 – Check Your Work
Now I checked my handy work before moving on to the next step.
- I made the JBoss run script executable
$ chmod +x $JBOSS_HOME/bin/run.sh
- Next I ran the script
$ $JBOSS_HOME/bin/run.sh
It will take a while but, eventually the server will finish booting.
- Now I hit the basic JBoss AS home page at this URL: http://myserver/ and made sure it looked OK.
- Then I hit the JBoss Portal page at this URL: http://myserver/portal and checked it as well.
If you have trouble accessing your URL, there could be an issue with the address that JBoss is listening on. This can be caused by various issues with your server setup (hostname, hosts file etc.). One quick thing to try is to pass -b 0.0.0.0 as an argument to the run.sh script – this tells JBoss to listen on all addresses, which might help you figure out where the issue is.
Step 10 – Setup JBoss Portal as a Service
-
I opened the file
$JBOSS_HOME/bin/jboss_init_redhat.shin an editor. -
First I double checked the environment variables set at the top of the file (particularly
JBOSS_HOMEandJBOSS_USER) were correct. -
Then at the very top of the file, below the shebang line, I added the following 3 lines to make the script compatible with the
chkconfigsystemI saved the file and exited the editor.
-
Then I made it executable
$ chmod +x $JBOSS_HOME/bin/jboss_init_redhat.sh
-
Next I linked the script into the
init.ddirectory$ ln -s $JBOSS_HOME/bin/jboss_init_redhat.sh /etc/init.d/jboss -
Then I ran
chkconfigto register the script for the correct run levels$ chkconfig –add jboss -
I then started the server by hand to double check my work and also just to get the server up and running without having to do a reboot
$ service jboss start
- Then I hit the JBoss Portal page once again and checked that it came up properly
Step 11 – Have A Beer
It is always appropriate to reward yourself with a craft, micro-brewed or home-brewed beer!

Hi Craig,
nice posting!
Does “service jboss stop” work for you?
It keeps telling me “No JBossas is currently running”.
Mojo
Hi Mojo, thanks for the comment. Looking at the JBoss startup script, there is a function called procrunning that determines the pid of the running JBoss instance, if it doesn’t find a running instance, then you will see the message you are seeing. So it sounds like for some reason that function is not seeing the JBoss running instance. Try executing the statements in that function by hand and see what kind of values you are getting.
Craig,
Great posting!
I could install liferay 6.0.1 (with Jboss 5.1.0) following your instruction. I
had to change following for new version of Jboss
* Change Default Port
There is no need to run Apache in front of JBoss for dev environment. So have Tomcat directly listen on port 80 – by default it listens on 8080. – open the $JBOSS_HOME/server/default/deploy/jbossweb.sar/server.xml file and change the port of the HTTP connector to 80.
* Change Portal to be the root web app.
As the Portal will be the main application on the server, it can be accessible from the root of the server, and not have to enter the portal context path all of the time. It can be done by disabling the current root application by renaming $JBOSS_HOME/server/default/deploy/ROOT.war/index.html index.html.old
Brian Ko