Chapter 2. Installation

Thomas Heute

2.1. Getting the files

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 get JBoss 4.0.0 http://sourceforge.net/project/showfiles.php?group_id=22866&package_id=16942 from Sourceforge.

2.1.2. JBoss portal

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

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 http://www.mysql.com

2.1.4. JDBC connector

The MySQL JDBC connector is available at http://dev.mysql.com/downloads/connector/j/3.0.html

2.2. Windows

2.2.1. Setting up your environment

2.2.1.1. Database

2.2.1.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.0.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. JBoss AS

If you need a custom setup of JBoss AS, you should read the documentation about JBoss application server. Here we will use the standard configuration shipped with JBoss AS 4.0.0. At this stage you should have the jboss-4.0.0.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.

2.2.2. Deploying JBoss Portal

2.2.2.1. From the binaries

The downloaded archive contains the following files:

  • portal-core.sar
  • portal-forums.ear
  • portal-ds.xml
  • cms-content.zip
  • setup.ddl

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

The second step is to unarchive the content of the file cms-content.zip into the directory $JBOSS_HOME/server/standard/data, this setup the default content of the CMS. If this is the first time you use that JBoss instance, the directory data should not exist, in that case you have to create it. Normally you should have the following structure for the CMS:

[$JBOSS_HOME/server/standard/data]
 +-portal
  +-webdav
   +-store
   +-work

Now it is time to deploy the rest in JBoss. Just copy the files portal-core.sar, portal-forums.ear and portal-ds.xml into the directory $JBOSS_HOME/server/standard/deploy

2.2.2.2. From the sources

Like a real open source programmer you want to do it by yourself. Now it is time to build JBoss Portal, 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.

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.

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 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

Before you deploy the application by itself, you will need to have the database deployment descriptor (portal-ds.xml) in the $JBOSS_HOME\server\standard\deploy directory. To do so just create that file with the following content (you can also copy this file from jboss-portal-2.0\core\src\resources\setup\portal-ds.xml):

<?xml version="1.0" encoding="UTF-8"?>
<datasources>
  <local-tx-datasource>
    <jndi-name>PortalDS</jndi-name>
    <connection-url>jdbc:mysql://localhost:3306/jbossportal</connection-url>
    <driver-class>org.gjt.mm.mysql.Driver</driver-class>
    <user-name>portal</user-name>
    <password>portalpassword</password>
  </local-tx-datasource>
</datasources>

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

Copy $JBOSS_HOME\server\all\lib\jgroups.jar and $JBOSS_HOME\server\all\lib\jboss-cache.jar into $JBOSS_HOME\server\standard\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 core directory and by typing build deploy. It will deploy JBoss Portal in the standard 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.2.3. Running Jboss Portal

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

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.3. Linux

2.3.1. Setting up your environment

2.3.1.1. Database

2.3.1.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.

Note

To install Mysql, if you are using Debian:

root# apt-get install mysql-server

root# apt-get install mysql-client

By default on Debian, networking access is forbidden you have to edit the file /etc/mysql/my.cnf and comment out (add a # at the beginning of the line) skip-networking, then restart the MySQL server by typing root# /etc/init.d/mysql restart.

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

Note

You should change the root password by typing: user# mysqladmin -u root password 'myN3wPassw0rd'

Now you can log on MySQL by typing: user# 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.3.1.2. JBoss AS

If you need a custom setup of JBoss AS, you should read the documentation about JBoss application server. Here we will use the standard configuration shipped with JBoss AS 4.0.0. At this stage you should have the jboss-4.0.0.tar.gz 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 type in a console: export JBOSS_HOME=/home/user/jboss-4.0.0 (Don't forget to change this path to your real path).

2.3.2. Deploying JBoss Portal

2.3.2.1. From the binaries

The downloaded archive contains the following files:

  • portal-core.sar
  • portal-forums.ear
  • portal-ds.xml
  • cms-content.zip
  • setup.ddl

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

The second step is to unarchive the content of the file cms-content.zip into the directory $JBOSS_HOME/server/standard/data, this setup the default content of the CMS. If this is the first time you use that JBoss instance, the directory data should not exist, in that case you have to create it. Normally you should have the following structure for the CMS:

[$JBOSS_HOME/server/standard/data]
 +-portal
  +-webdav
   +-store
   +-work

Now it is time to deploy the rest in JBoss. Just copy the files portal-core.sar, portal-forums.ear and portal-ds.xml into the directory $JBOSS_HOME/server/standard/deploy

2.3.2.2. From the sources

Like a real open source programmer you want to do it by yourself. Now it is time to build JBoss Portal, 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.

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.

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): root# mysql -u portal -p jbossportal < jboss-portal-2.0/core/output/resources/setup/setup.ddl 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

Before you deploy the application by itself, you will need to have the database deployment descriptor (portal-ds.xml) in the $JBOSS_HOME/server/standard/deploy directory. To do so just create that file with the following content (you can also copy this file from jboss-portal-2.0/core/src/resources/setup/portal-ds.xml):

<?xml version="1.0" encoding="UTF-8"?>
<datasources>
  <local-tx-datasource>
    <jndi-name>PortalDS</jndi-name>
    <connection-url>jdbc:mysql://localhost:3306/jbossportal</connection-url>
    <driver-class>org.gjt.mm.mysql.Driver</driver-class>
    <user-name>portal</user-name>
    <password>portalpassword</password>
  </local-tx-datasource>
</datasources>

You will also need to put the jar file of your database connector in $JBOSS_HOME/server/standard/lib.

Copy $JBOSS_HOME/server/all/lib/jgroups.jar and $JBOSS_HOME/server/all/lib/jboss-cache.jar into $JBOSS_HOME/server/standard/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 core directory and by typing ./build.sh deploy. It will deploy JBoss Portal in the standard 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.3.3. Running Jboss Portal

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

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.