Chapter 2. Installation

Thomas Heute

2.1. Install Overview

There are a couple of archives that you will need to download in order to install JBoss Portal.

2.1.1. JBoss Application Server

Of course you will need to install JBoss Application Server prior to install JBoss portal, if you didn't do so yet, please install JBoss 4.0.1 SP1 from Sourceforge.

2.1.2. Getting the JBoss Portal files

You can download JBoss portal in different ways, packaged in binaries, sources or from the CVS.

  • Packaged: From the JBoss portal project page
  • CVS Version 2.0 RC: cvs -d :pserver:anonymous@anoncvs.forge.jboss.com:/cvsroot/jboss co -r JBoss_Portal_2_0_0_RC1 jboss-portal-2.0
  • CVS Version HEAD (The most up to date sources at your own risks): cvs -d :pserver:anonymous@anoncvs.forge.jboss.com co jboss-portal-2.0

Warning

Do not attempt to get the jboss-portal module. The latest release is jboss-portal-2.0

2.1.3. Database

You will need a database to store the data of the system, you can use any database supported by Hibernate. In this document we will consider that you are using MySQL, you can download it at MySQL.com

2.1.4. JDBC connector

Last but not least, you also need to get the JDBC connector for your database, the MySQL JDBC connector is available here, the postgreSQL JDBC connector is available here.

2.2. Setting up your environment

2.2.1. Database

2.2.1.1. MySQL

If you didn't do so already you will need to create a MySQL database. For testing you will want to create a database called "jbossportal", with a user called "portal" and a password "portalpassword". Here are the explanations to do so. If you are familiar with MySQL, feel free to create this database and user yourself and skip this part.

Get the binaries from http://dev.mysql.com/downloads/mysql/4.1.html, unpack them and install them according to the MySQL documentation

Note

You should change the root password by typing: C:\mysql\bin> mysqladmin -u root password 'myN3wPassw0rd'

Now you can log on MySQL by typing: C:\mysql\bin> mysql -u root -p (if you didn't set a password just press enter when it asks for one or don't put the -p option)

Create the jbossportal database: (you can change the name if you want)

In the MySQL console type:

mysql> CREATE DATABASE jbossportal;

The output should be:

Query OK, 1 row affected (0.01 sec)

Add a user (pick any name if you don't like portal as username:

mysql> GRANT ALL PRIVILEGES ON jbossportal.* TO 'portal'@'localhost' IDENTIFIED BY 'portalpassword' WITH GRANT OPTION;

The output should be:

Query OK, 0 rows affected (0.00 sec)

2.2.1.2. Other database

Note

You should read the MySQL instructions as there is useful information that may apply to yout favorite flavour of DB.

JBoss portal leverage the use of Hibernate, so any database supported by Hibernate is also supported by JBoss Portal. DB2, Firebird, FrontBase, Hypersonic, Ingres, Interbase, MySQL, Oracle, PostgreSQL, SAPDB, SQLServer, Sybase are some of them.

2.2.2. JBoss AS

If you need a custom setup of JBoss AS, you should read the documentation about JBoss application server. In our case, we will use the default configuration shipped with JBoss AS 4.0.1sp1.

At this stage you should have the jboss-4.0.1sp1.zip or any other archive of the same version. First you need to setup JBOSS_HOME environment variable otherwise you won't be able to compile JBoss Portal. To do so go to Start > Settings > Control Panel > System > Advanced > Environment Variables, and add the JBOSS_HOME environment variable. Or do export JBOSS_HOME=/path/to/your/jboss/directory on a Unix-like system.

2.3. Deploying JBoss Portal

2.3.1. From the binaries

The downloaded archive contains the following files:

  • jboss-portal.sar
  • portal-forums.ear
  • portal-ds.xml
  • cms-content.zip
  • setup.ddl
  1. The first step is to setup the default data for the portal, this is done in 2 steps. First you have to execute the content of the file setup.ddl in the database.

    >mysql -u portal -p
    mysql> use jbossportal
    Database changed
    mysql> source setup.ddl
    Query OK, 0 rows affected, 1 warning (0.06 sec)
    ...
    Query OK, 1 row affected (0.00 sec)
    mysql> exit
    Bye
  2. Then you should populate the database to create two users, one with login user and password user who is a regular user and one administrator with admin as username and admin as password. To do so type the following command:

    root# mysql -u portal -p jbossportal < jboss-portal-2.0\core\output\resources\setup\setup.sql
  3. The second step is to unarchive the content of the file cms-content.zip into the directory $JBOSS_HOME/server/default/data, this setup the default content of the CMS. If this is the first time you use that JBoss instance, the directory data may not exist, in that case you have to create it. You should have the following structure for the CMS:

    $JBOSS_HOME/server/default/data
     +-portal
      +-webdav
       +-store
       +-work
  4. Now we deploy the rest in JBoss. Just copy the files portal-core.sar and portal-ds.xml into the directory $JBOSS_HOME/server/default/deploy

2.3.2. From the sources

  1. First define which database you want to use by specifying it in $PORTAL_HOME/build/local.properties. By changing the value of portal.database JBoss Portal will be ready to use the specified one. As of today only mySQL and postreSQL are accepted values but to add any Hibernate supported database you just need to add a file into $PORTAL_HOME/build/etc with your database information. (See below)

    Check and modify if needed the file corresponding to your database in $PORTAL_HOME/build/etc. Here is what it looks like for mySQL:

    hibernate.dialect=net.sf.hibernate.dialect.MySQLDialect
    portal.datasource.driver=org.gjt.mm.mysql.Driver
    portal.datasource.url=jdbc:mysql://localhost:3306/jbossportal?useServerPrepStmts=false
    portal.datasource.username=portal
    portal.datasource.password=portalpassword

    Adding another database would be as easy as adding such a file, specifying the Hibernate dialect, the datasource url, the username and the password. A list of supported Hibernate dialects can be found here.

  2. Now is time to build the sources, go to jboss-portal-2.0/build and type sh build.sh, you should read BUILD SUCCESSFUL at the end of the operation.

    Warning

    Make sure that JBOSS_HOME is still defined in the environment or it will not work.

  3. Now you will need to build the DDL file to be able to create the required tables in your database. To do so go to jboss-portal-2.0/core and type sh build.sh ddl. It will create the file jboss-portal-2.0\core\output\resources\setup\setup.ddl.

  4. To feed your database just type the following line and enter portalpassword as password when asked (or whatever you used while setting up your database):

    C:\mysql\bin> mysqladmin -u portal -p jbossportal < jboss-portal-2.0\core\output\resources\setup\setup.ddl
  5. Then you should populate the database to create two users, one with login user and password user who is a regular user and one administrator with admin as username and admin as password. To do so type the following command:

    root# mysql -u portal -p jbossportal < jboss-portal-2.0\core\output\resources\setup\setup.sql
  6. Before you deploy the application by itself, you will need to have the database deployment descriptor (portal-ds.xml) in the $JBOSS_HOME\server\default\deploy directory. To do so copy in that directory the file $PORTAL_HOME\core\output\resources\setup\portal-ds.xml.

  7. You will also need to put the jar file of your database connector in $JBOSS_HOME\server\default\lib.

Warning

Make sure that JBOSS_HOME is still defined in the environment or it will not deploy.

Finally, you can deploy JBoss Portal by going into the build directory and by typing build deploy. It will deploy JBoss Portal in the default configuration of JBoss.

Note

During the deploy, the cms data are copied to your JBoss data directory, copying the portal.sar file is not enough if it is your first deployment.

2.4. Running JBoss Portal

Now you can start JBoss AS by going into $JBOSS_HOME/bin and typing run.

Warning

If the forums portlet is not installed, the link to the forums page will not work, see the forums portlet chapter of this document for the installation instructions.

Using your browser, navigate to http://localhost:8080/portal and you should see the portal.

2.5. Customizing your installation

2.5.1. Changing the port

It is common to have a server running on the port 80 instead of the default port 8080, to change that you will need to change it at two levels:

  • To change it at the server level, you need to edit the file $JBOSS_HOME/server/default/deploy/jbossweb-tomcat50.sar/server.xml and change the port value of the HTTP Connector to the same value as you defined in the portal.

  • Next, you will need to modify the web.xml descriptor in the CMSPortlet for it to be able to find the webDAV server. You can find more information about how to do this here.

Note

You can also change in those same files, the value of the SSL port, by default it is set to 8443

Now you can restart JBoss and use the new port that you defined. On systems like Linux, you need privileges to be able to run a server on a port lower than 1000, starting JBoss on the port 80 as a regular user will not work, for testing you can log as root but is not recommended if the server is public as it could be a security breach in your system.

2.5.2. Changing the context path

By default, the "main" page of JBoss portal will be accessible at http://localhost:8080/portal/index.html. You may want to change that either to a different name or to http://localhost:8080/index.html.

Note

To do so, edit the file $PORTAL_HOME/build/local.properties and change portal.context-root to anything you want.

Now you can rebuild JBoss portal and redeploy it tfor the context path changes to take effect.