Pentaho is an amazing open source tool for Business Intelligence and the other day I succesfully got it working with some help from the guys over at ##pentaho @ irc.freenode.net. So here is a tutorial on how to get Pentaho 1.7 running on a Ubuntu Hardy webserver or local box!

HOW TO INSTALL PENTAHO 2.0 ON MYSQL WiTH LINUX GUIDE IS HERE!

Resources which are handy when it comes to Pentaho:

Extra props to to bugg from ##pentaho!

Assumptions

Before you begin your installation I will assume that you have installed and have running:

If someone gets the time maybe they can write out the above two stepsĀ :)

Directory Structure

When setting up my pentaho install I decided to layout my directory similar to this:

  • /opt/tomcat_dir - your tomcat installation directory
  • /opt/pentaho - holds pentaho related folders
  • /opt/pentaho/pentaho-solutions - holds the pentaho solution files

Step 1: Install and configure the JAVA JDK and JRE

The first step is to first install the latest Java JDK & JRE (1.6 for this tutorial). To install the latest version of the JAVA JDK and JRE, at the terminal prompt type:

   $terminal > sudo apt-get install sun-java6-jdk sun-java6-jre

You will be prompted to install the necessary files, just hit the Y key. Ubuntu will automatically install the JAVA JDK and JRE in the following directory

   /usr/lib/jvm/java-6-sun-1.6.0.06/

To check if it all went well type this at the terminal prompt, it should let you know what version of JAVA you have installed on your Ubuntu box.

   $terminal > java -version

Now before we continue we have to set the JAVA_HOME as an evironment variable (for Tomcat), you can do this two ways:

Method 1 (On the fly)

   $terminal> export JAVA_HOME = "/usr/lib/jvm/java-6-sun-1.6.0.06"

Method 2 (On startup)

   $terminal> sudo vi /etc/profile or /etc/.bashrc

Paste this line at the end

   export JAVA_HOME = "/usr/lib/jvm/java-6-sun-1.6.0.06"

Now we have the JAVA JDK and JRE installed and configured! Lets move onto Tomcat..

Step 2: Installation and configuration of Tomcat

For this tutorial I will be using Tomcat 5.5. Before we install Tomcat, lets create a working directory to dump all the new .tars and .zips we will be downloading.

   $terminal> sudo mkdir work
   $terminal> cd work

To install Tomcat 5.5 at the terminal prompt type the following command, however if you want to download the .tar file directly or from another mirror click here (http://tomcat.apache.org/download-55.cgi):

   $terminal> sudo wget http://apache.mirror.aussiehq.net.au/tomcat/tomcat-5/v5.5.26/bin/apache-tomcat-5.5.26.tar.gz

The next step is to extract the .tar.gz we just downloaded:

   $terminal> sudo tar xvf apache-tomcat-5.5.26.tar.gz

You will now have a directory labelled “apache-tomcat-5.5.26″, lets move this to a more sensible location. If you don’t have /opt/ directory create it by typing the following at the terminal prompt:

   $terminal> sudo mkdir /opt

Then copy the “apache-tomcat-5.5.26″ folder to the /opt/ directory by typing the following at the terminal prompt (make sure you are still in your work directory):

   $terminal> sudo mv apache-tomcat-5.5.26 /opt

The last step is to chmod 777 this new directory, why? I had alot of issue installing at the root level on my ubuntu box in regards to permissions etc, chmod’ing 777 everything fixes it up.

   $terminal> sudo chmod 777 -R /opt/apache-tomcat-5.5.26
  • The -R is a recursive function which chmods all sub directories under the main directory.

Phew! So now we have installed the JAVA JDK and JRE and Tomcat, lets move on to getting Pentaho up and running!

Step 3: Installing and configuring Pentaho

We will need to download 4 packages to get our Pentaho installation working on this configuration:

  • pentaho_j2ee_deployments-1.7.1.zip
  • pentaho_solutions-1.7.1.zip
  • Pentaho MySql .sql Sample Script - here
  • MySql connector JAVA 5.1.6 - here

Firstly lets download the Pentaho related packages. If you don’t want to use the wget command you can just visit this page and download the above files or just type the following commands at the terminal prompt (make sure you are in your work directory):

   $terminal> sudo wget http://internode.dl.sourceforge.net/sourceforge/pentaho/pentaho_j2ee_deployments-1.7.1.zip
   $terminal> sudo wget http://internode.dl.sourceforge.net/sourceforge/pentaho/pentaho_solutions-1.7.1.zip

Creating the MySql databases

First download the MySql Pentaho Sample .sql script by clicking finding the latest version from here or by running this command (within the work directory):

   $terminal> sudo wget http://source.pentaho.org/svnroot/legacy/pentaho-data/branches/1.7/mysql5/SampleDataDump_MySql.sql

Before logging into MySql to run the script make sure you are in the same directory where the .sql file is located then log into mysql:

   $terminal> mysql -u[username] -p[password]

Then from the mysql prompt type the following in:

   $mysql> source .sql;

This will run the .sql script and create 3 databases:

  1. hibernate
  2. quartz
  3. sampledata

To check if these databases were created run this command:

   $mysql> show databases;

Now exit out of MySql:

   $mysql> exit

Install the MySql Connector

Download the MySql connector from this link or type this at the command prompt (in your work directory):

   $terminal> sudo wget http://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-5.1.6.tar.gz/from/http://mysql.mirrors.ilisys.com.au/

Once that has downloaded into your work directory, extract the tar.gz file:

   $terminal> sudo tar xvf mysql-connector-java-5.1.6.tar.gz

Now we will need to copy the mysql-connector-java-5.1.6-bin.jar file to the /opt/apache-tomcat-5.5.26/common/lib/ directory:

   $terminal> sudo cp mysql-connector-java-5.1.6-bin.jar /opt/apache-tomcat-5.5.26/common/lib/

Installing the Pentaho packages

Firstly, lets unzip both the zip files we just downloaded (make sure you in your working directory):

   $terminal> sudo unzip pentaho_j2ee_deployments-1.7.1.zip
   $terminal> sudo unzip pentaho_solutions-1.7.1.zip

If you don’t have UNZIP installed, you can install it by typing this command:

   $terminal> sudo apt-get unzip

Now we will need to user ANT to build our .wars for deployment on Tomcat, navigate to the pentaho_j2ee_deployments directory:

   $terminal> cd pentaho_j2ee_deployments

Now run the following commands from the terminal prompt, after each command is complete you should see a “BUILD SUCCESFUL” message.

   $terminal> ant ant zip-pentaho-style-war
   $terminal> ant zip-pentaho-steel-wheels-style-war
   $terminal> ant zip-pentaho-portal-layout-war
   $terminal> ant war-pentaho-tomcat-mysql

This will create the 4 .wars, now we will need to copy these to our /opt/apache-tomcat-5.5.26/webapps/ directory, to do this run the following commands at the terminal prompt (make sure you are in the pentaho_j2ee_deployments directory when running these):

   $terminal> sudo cp /build/pentaho-wars/*.wars /opt/apache-tomcat-5.5.26/webapps/
   $terminal> sudo cp /build/pentaho-wars/tomcat/mysql/*.wars /opt/apache-tomcat-5.5.26/webapps/

To check if that was succesful type:

   $terminal> ls /opt/apache-tomcat-5.5.26/webapps/

You should see the following files:

  1. pentaho.war
  2. sw-style.war
  3. pentaho-portal-layout.war
  4. pentaho-style.war

To deploy these .wars we are going to quickly start up tomcat and shut it down, at the terminal prompt navigate to the /opt/apache-tomcat-5.5.26/bin/ directory and run the ./startup.sh script.

   $terminal> cd /opt/apache-tomcat-5.5.26/bin
   $terminal> ./startup.sh
   $terminal> ./shutdown.sh

Now you will notice that the following directories under the /webapps folder have been created:

  1. pentaho/
  2. sw-style/
  3. pentaho-portal-layout/
  4. pentaho-style/

Setting up Pentaho Solutions Navigate back to our work directory and move the “pentaho_solutions” folder to a directory of choice, as you can see at the start of this tutorial I have decided to use the /opt/pentaho directory. So to start off type this at the command prompt:

   $terminal> sudo mv pentaho-solutions/ /opt/pentaho/

Next chmod 777 this directory (it will cause a lot of headaches if you don’t!)

   $terminal> sudo chmod 777 -R /opt/pentaho/pentaho-solutions

Configurations

We are so close! Now we need to tweak a couple configuration settings.

Pentaho configuration

We will need to make sure that Pentaho points to right directory when loading up pentaho-solutions, to do this, navigate to the WEB_INF/ directory under your opt/apache-tomcat-5.5.26/webapps/pentaho/ location.

   $terminal> cd /opt/apache-tomcat-5.5.26/webapps/pentaho/WEB_INF

Then open up the web.xml file for editing

   $terminal> sudo vi web.xml

Find the following passages and make the changes to the bold areas Change this to the directory where you have uncompressed the pentaho-solutions.zip, in this example it is /opt/pentaho/pentaho-solutions

   <context-param>
   <param-name>solution-path</param-name>
   <param-value>/opt/pentaho/pentaho-solutions</param-value>
   </context-param>

If you are accessing your Pentaho installation remotely or if it is installed on a web server change the “localhost” to your server’s ip if not just leave it as “localhost”.

   <context-param>
   <param-name>base-url</param-name>
   <param-value>http://localhost:8080/pentaho/</param-value>
   </context-param>

Pentaho data sources configuration

The first one is to edit the data sources so they point our locally hosted mysql database, navigate to the /conf/ directory under your tomcat directory:

   $terminal> cd /opt/apache-tomcat-5.5.26/conf/

Then open up the server.xml file for editing

   $terminal> sudo vi server.xml

We will need to paste the following piece of code before the </Host> tags (found at the bottom). But before pasting make sure you change the following:

  1. Any references to “myserver” to your mysql’s ip or just to “localhost”
  2. Replace any instances of username=”pentaho_user” password=”password” to your databases username i.e. root and password for that user.
 <Context path="/pentaho" docbase="webapps/pentaho/">
 <Manager className="org.apache.catalina.session.PersistentManager" saveOnRestart="false"/>
 <Resource name="jdbc/Hibernate" auth="Container" type="javax.sql.DataSource" maxActive="20"
   maxIdle="5" maxWait="10000" username="hibuser" password="password" validationQuery="Select 1"
   factory="org.apache.commons.dbcp.BasicDataSourceFactory" driverClassName="com.mysql.jdbc.Driver"
   url="jdbc:mysql://myserver/hibernate" testOnBorrow="true" testWhileIdle="true" timeBetweenEvictionRunsMillis="10000"
   maxEvictableIdleTimeMillis="60000"/>
 <Resource name="jdbc/SampleData" auth="Container" type="javax.sql.DataSource" maxActive="20"
   maxIdle="5" maxWait="10000" username="pentaho_user" password="password" validationQuery="Select 1"
   factory="org.apache.commons.dbcp.BasicDataSourceFactory" driverClassName="com.mysql.jdbc.Driver"
   url="jdbc:mysql://myserver/sampledata" testOnBorrow="true" testWhileIdle="true" timeBetweenEvictionRunsMillis="10000"
   maxEvictableIdleTimeMillis="60000"/>
 <Resource name="jdbc/Quartz" auth="Container" type="javax.sql.DataSource" maxActive="20"
   maxIdle="5" maxWait="10000" username="pentaho_user" password="password" validationQuery="Select 1"
   factory="org.apache.commons.dbcp.BasicDataSourceFactory" driverClassName="com.mysql.jdbc.Driver"
   url="jdbc:mysql://myserver/quartz" testOnBorrow="true" testWhileIdle="true" timeBetweenEvictionRunsMillis="10000"
   maxEvictableIdleTimeMillis="60000"/>
 <Resource name="jdbc/Shark" auth="Container" type="javax.sql.DataSource" maxActive="20"
   maxIdle="5" maxWait="10000" username="pentaho_user" password="password" validationQuery="Select 1"
   factory="org.apache.commons.dbcp.BasicDataSourceFactory" driverClassName="com.mysql.jdbc.Driver"
   url="jdbc:mysql://myserver/shark" testOnBorrow="true" testWhileIdle="true" timeBetweenEvictionRunsMillis="10000"
   maxEvictableIdleTimeMillis="60000"/>
 <Resource name="jdbc/SampleDataAdmin" auth="Container" type="javax.sql.DataSource" maxActive="20"
   maxIdle="5" maxWait="10000" username="pentaho_user" password="password" validationQuery="Select 1"
   factory="org.apache.commons.dbcp.BasicDataSourceFactory" driverClassName="com.mysql.jdbc.Driver"
   url="jdbc:mysql://myserver/sampledata" testOnBorrow="true" testWhileIdle="true" timeBetweenEvictionRunsMillis="10000"
   maxEvictableIdleTimeMillis="60000"/>
 <Resource name="jdbc/solution1" auth="Container" type="javax.sql.DataSource" maxActive="20"
   maxIdle="5" maxWait="10000" username="pentaho_user" password="password" validationQuery="Select 1"
   factory="org.apache.commons.dbcp.BasicDataSourceFactory" driverClassName="com.mysql.jdbc.Driver"
   url="jdbc:mysql://myserver/sampledata" testOnBorrow="true" testWhileIdle="true" timeBetweenEvictionRunsMillis="10000"
   maxEvictableIdleTimeMillis="60000"/>
 <Resource name="jdbc/solution2" auth="Container" type="javax.sql.DataSource" maxActive="20"
   maxIdle="5" maxWait="10000" username="pentaho_user" password="password" validationQuery="Select 1"
   factory="org.apache.commons.dbcp.BasicDataSourceFactory" driverClassName="com.mysql.jdbc.Driver"
   url="jdbc:mysql://myserver/sampledata" testOnBorrow="true" testWhileIdle="true" timeBetweenEvictionRunsMillis="10000"
   maxEvictableIdleTimeMillis="60000"/>
 <Resource name="jdbc/solution3" auth="Container" type="javax.sql.DataSource" maxActive="20"
   maxIdle="5" maxWait="10000" username="pentaho_user" password="password" validationQuery="Select 1"
   factory="org.apache.commons.dbcp.BasicDataSourceFactory" driverClassName="com.mysql.jdbc.Driver"
   url="jdbc:mysql://myserver/sampledata" testOnBorrow="true" testWhileIdle="true" timeBetweenEvictionRunsMillis="10000"
   maxEvictableIdleTimeMillis="60000"/>
 <Resource name="jdbc/solution4" auth="Container" type="javax.sql.DataSource" maxActive="20"
   maxIdle="5" maxWait="10000" username="pentaho_user" password="password" validationQuery="Select 1"
   factory="org.apache.commons.dbcp.BasicDataSourceFactory" driverClassName="com.mysql.jdbc.Driver"
   url="jdbc:mysql://myserver/sampledata" testOnBorrow="true" testWhileIdle="true" timeBetweenEvictionRunsMillis="10000"
   maxEvictableIdleTimeMillis="60000"/>
 <Resource name="jdbc/solution5" auth="Container" type="javax.sql.DataSource" maxActive="20"
   maxIdle="5" maxWait="10000" username="pentaho_user" password="password" validationQuery="Select 1"
   factory="org.apache.commons.dbcp.BasicDataSourceFactory" driverClassName="com.mysql.jdbc.Driver"
   url="jdbc:mysql://myserver/sampledata" testOnBorrow="true" testWhileIdle="true" timeBetweenEvictionRunsMillis="10000"
   maxEvictableIdleTimeMillis="60000"/>
 <Resource name="jdbc/datasource1" auth="Container" type="javax.sql.DataSource" maxActive="20"
   maxIdle="5" maxWait="10000" username="pentaho_user" password="password" validationQuery="Select 1"
   factory="org.apache.commons.dbcp.BasicDataSourceFactory" driverClassName="com.mysql.jdbc.Driver"
   url="jdbc:mysql://myserver/sampledata" testOnBorrow="true" testWhileIdle="true" timeBetweenEvictionRunsMillis="10000"
   maxEvictableIdleTimeMillis="60000"/>
 <Resource name="jdbc/datasource2" auth="Container" type="javax.sql.DataSource" maxActive="20"
   maxIdle="5" maxWait="10000" username="pentaho_user" password="password" validationQuery="Select 1"
   factory="org.apache.commons.dbcp.BasicDataSourceFactory" driverClassName="com.mysql.jdbc.Driver"
   url="jdbc:mysql://myserver/sampledata" testOnBorrow="true" testWhileIdle="true" timeBetweenEvictionRunsMillis="10000"
   maxEvictableIdleTimeMillis="60000"/>
 <Resource name="jdbc/datasource3" auth="Container" type="javax.sql.DataSource" maxActive="20"
   maxIdle="5" maxWait="10000" username="pentaho_user" password="password" validationQuery="Select 1"
   factory="org.apache.commons.dbcp.BasicDataSourceFactory" driverClassName="com.mysql.jdbc.Driver"
   url="jdbc:mysql://myserver/sampledata" testOnBorrow="true" testWhileIdle="true" timeBetweenEvictionRunsMillis="10000"
   maxEvictableIdleTimeMillis="60000"/>
 <Resource name="jdbc/datasource4" auth="Container" type="javax.sql.DataSource" maxActive="20"
   maxIdle="5" maxWait="10000" username="pentaho_user" password="password" validationQuery="Select 1"
   factory="org.apache.commons.dbcp.BasicDataSourceFactory" driverClassName="com.mysql.jdbc.Driver"
   url="jdbc:mysql://myserver/sampledata" testOnBorrow="true" testWhileIdle="true" timeBetweenEvictionRunsMillis="10000"
   maxEvictableIdleTimeMillis="60000"/>
 <Resource name="jdbc/datasource5" auth="Container" type="javax.sql.DataSource" maxActive="20"
   maxIdle="5" maxWait="10000" username="pentaho_user" password="password" validationQuery="Select 1"
   factory="org.apache.commons.dbcp.BasicDataSourceFactory" driverClassName="com.mysql.jdbc.Driver"
   url="jdbc:mysql://myserver/sampledata" testOnBorrow="true" testWhileIdle="true" timeBetweenEvictionRunsMillis="10000"
   maxEvictableIdleTimeMillis="60000"/>
  </Context>

The last data source to edit is the hibernate configuration, so navigate to the directory where the hibernate configuration file is located:

   $terminal> cd /opt/apache-tomcat-5.5.26/webapps/pentaho/WEB-INF/classes/

Then open up the hibernate.cfg.xml file for editing

   $terminal> sudo vi hibernate.cfg.xml

Find the following areas in the file and edit them (seen in bold below):

  1. Any references to “myserver” to your mysql’s ip or just to “localhost”
  2. Change hibuser to your MySql username i.e. root
  3. Change password to your MySql password
   <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
   <property name="connection.url">jdbc:mysql://myserver:3306/hibernate</property>
   <property name="dialect">org.pentaho.repository.MySQL5InnoDBDialect</property>
   <property name="connection.username">hibuser</property>
   <property name="connection.password">password</property>
   <property name="connection.pool_size">10</property>
   <property name="show_sql">false</property>
   <property name="hibernate.jdbc.use_streams_for_binary">true</property>

Step 4: Running Pentaho

Finally we are here! Navigate to the bin directory under your Tomcat installation:

   $terminal> cd /opt/apache-tomcat-5.5.26/bin

Then issue the ./startup.sh command

   $terminal> ./startup.sh
   Now, open up a web browser and type in:
  1. http://localhost:8080/pentaho (if you are hosting locally)
  2. http://yourip:8080/pentaho (if you are hosting remotely)

You should now have a working installation of Pentaho deployed with Tomcat on a MySql database!

Finishing Notes

I would like to thank bugg_tb for his contribution to the inital version of this wiki. If you are experiencing maxpermsize errors run the following commands or put them in your ./profile ./bashrc files:

JAVA_OPTS="$JAVA_OPTS -Xms128m -Xmx512m -XX:PermSize=32m -XX:MaxPermSize=128m -Xss2m"
JAVA_OPTS="$JAVA_OPTS -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled"

Don’t forget to sudo!