How-To Install Open for Businesses on SME Server

Author:  David S. Helmuth <dave@helmuth.net>
Contributor:
  http://www.ofbiz.org/setup/setup.html
Release supported: e-smith 4.x, SME 5.x (Done on SME 5.1.2)
License: GPL
Last updated:
Tuesday, November 12, 2002 07:03 AM
 

Problem:  You would like to install and use a JAVA Based "ERP" System on e-Smith.
Solution:
  How To for installing Open for Business.
Prerequisites:  Installed and functioning Tomcat JSP Server.  Please see http://www.helmuth.net/mitel-sme/Tomcat/tomcat-howto.htm for instructions on that.
What is Open For Business:  

"The Open For Business Project is an open source enterprise automation software project licensed under the MIT Open Source License. The goal of the project is to build a community of end users and developers that work together directly to create easy to customize business software based on best practices."

Please see http://www.ofbiz.org/ for more information.

What You Get:
A basic installation of the Open for Business Software.  It is configured to get its data from the local MySQL database.  Also, there is an extra step at the end to connect it via mod_webapp to the default SME Apache server.


STEP 1: Make a place to download/install.  (Assumes you have gotten to the command line via ssh/telnet.)

cd /root
mkdir ofbiz
cd ofbiz

STEP 2: Install Ant. (JAVA "Compiler")

rpm -Uvh http://jakarta.apache.org/builds/jakarta-ant/release/v1.5/rpms/xml-commons-1.0-0.b2.1jpp.noarch.rpm
rpm -Uvh http://jakarta.apache.org/builds/jakarta-ant/release/v1.5/rpms/xml-commons-apis-1.0-0.b2.1jpp.noarch.rpm
rpm -Uvh http://jakarta.apache.org/builds/jakarta-ant/release/v1.5/rpms/xerces-j2-2.0.2-3jpp.noarch.rpm
rpm -Uvh http://jakarta.apache.org/builds/jakarta-ant/release/v1.5/rpms/ant-1.5-4jpp.noarch.rpm

STEP 3: Get a copy of Ofbiz.

wget http://unc.dl.sourceforge.net/sourceforge/ofbiz/ofbiz-2.0-beta2.tgz
wget http://unc.dl.sourceforge.net/sourceforge/ofbiz/ofbiz-2.0-beta3-complete.tgz

STEP 4:  Extract Ofbiz.

tar -xvzf ofbiz-2.0-beta2.tgz
tar -xvzf ofbiz-2.0-beta3-complete.tgz

STEP 5:  Copy Ofbiz to the "right" location.

Note:  You can change this, but you will need to change the appropriate environment variable changes as well.

cp -Rp ofbiz /var/tomcat4/webapps

Also, we want to make sure that the "tomcat" user can do what he needs to to the directory

chown -R tomcat4:tomcat4 /var/tomcat4/webapps/ofbiz

STEP 6:  Create the database and database user that Ofbiz will use.  Note, I used "ofbiz" as the name.  You can change it, just make sure you change it everywhere.

First we create the database in MySQL.

mysqladmin -u root drop ofbiz
mysqladmin -u root create ofbiz

Then we add in the user that Ofbiz will sign in with.

mysql -u root
grant all on ofbiz.* to ofbiz@localhost identified by "somepassword";
quit

STEP 7:  Set the right environment variables for the build process.

export JAVA_HOME="/usr/java/jdk"
export ANT_HOME="/usr/bin"
export CATALINA_HOME="/var/tomcat4"
export OFBIZ_HOME="/var/tomcat4/webapps/ofbiz"

Make sure you are in the "OFBIZ_HOME"

cd $OFBIZ_HOME

STEP 8:  Run the necessary "ANT" build processes.

Note: I corrected/tweaked the build.xml file.  You will either want to use this one, or edit the existing one to copy all of the correct files over.  Another easy way to obtain this file is noted below.

mv build.xml build.xml.save
wget http://www.helmuth.net/mitel-sme/ofbiz/build.xml

Note there are two commands below.  Watch carefully for their output.  You don't want warnings or errors.

ant install
ant

STEP 8:  Changes to tomcat4.conf

Add the following lines to the bottom of the /etc/tomcat4/tomcat4.conf.  This necessary to make sure the proper environment variables are available to Ofbiz.

pico /etc/tomcat4/tomcat4.conf
export OFBIZ_HOME="$CATALINA_HOME/webapps/ofbiz"
export CATALINA_OPTS="$CATALINA_OPTS -Dofbiz.home=$OFBIZ_HOME"

STEP 9:  Changes to the entityengine.xml to make Ofbiz use MySQL.

Now we need to point Ofbiz to MySQL rather than to the default database.

pico $CATALINA_HOME/classes/entityengine.xml

There are 2 changes that we need to make.  The first change is on about line 35 we tell Ofbiz what datasource to use.

It looks something like this:

<delegator name="default" entity-model-reader="main" entity-group-reader="main">
<group-map group-name="org.ofbiz.commonapp" datasource-name="localhsql"/>
</delegator>

We want it to read:

<delegator name="default" entity-model-reader="main" entity-group-reader="main">
<group-map group-name="org.ofbiz.commonapp" datasource-name="localmysql"/>
</delegator>

Note:  We are just changing the "datasource-name" from "localhsql" to "localmysql"

The second change is on about line 122 we tell Ofbiz what database to use.

It looks something like this:

jdbc-username="ofbiz"
jdbc-password="ofbiz"

We want it to read:

jdbc-username="ofbiz"
jdbc-password="somepassword"

Note:  We are just changing the "datasource-name definition" user name from the default to the ones that we used in the above Step 6.  Feel free to make them whatever you would like.


STEP 10:  This step does not work.  It appears to break ALL mod_webapp connections.  I am investigating why, but I don't have a reason yet!! However, I am pretty sure it is related to the server.xml that is copied over during the "ant install" in step 8!

Use the mod_webapp connector to have the default server handle the HTML serving and pass the JSP/SERVLET stuff to Tomcat. Note:  I am assuming that you have followed the How-To on connecting Tomcat to Apache.  It can be found at: http://www.helmuth.net/mitel-sme/Tomcat/tomcat-v4.0_Apache-howto.htm

****

Note: I am still investigating what is going wrong.  The problem appears to be with hooking up to Ofbiz.  It might also have to do with the fact that I chose /var/ofbiz as the $OFBIZ_HOME.  For the time being, I am just "commenting" the WebAppDeploy statements out of the template.  That is working for me for the time being.  That is reflected in the statement below.  

With this server.xml file in place of /etc/tomcat4/server.xml, I am at least able to keep the original "WebApps" connected.  Either replace it with the link above, or do:

cd /etc/tomcat4
mv /etc/tomcat4/server.xml /etc/tomcat4/server.xml.ofbiz.save
wget http://www.helmuth.net/mitel-sme/ofbiz/server.xml

****

pico /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf/99TomcatWebApps

It should look basically like this:

#------------------------------------------------------------
# Tomcat WebApp Information for Apache
#------------------------------------------------------------

WebAppDeploy examples warpConnection /examples
WebAppDeploy ROOT warpConnection /ROOT
WebAppDeploy tomcat-docs warpConnection /tomcat-docs
WebAppDeploy webdav warpConnection /webdav

 We are going to add the lines necessary for OFbiz.  When you are done, it should look like this:

#------------------------------------------------------------
# Tomcat WebApp Information for Apache
#------------------------------------------------------------

WebAppDeploy examples warpConnection /examples
WebAppDeploy ROOT warpConnection /ROOT
WebAppDeploy tomcat-docs warpConnection /tomcat-docs
WebAppDeploy webdav warpConnection /webdav
# WebAppDeploy catalog warpConnection /catalog
# WebAppDeploy commonapp warpConnection /commonapp
# WebAppDeploy ecommerce warpConnection /ecommerce
# WebAppDeploy ordermgr warpConnection /ordermgr
# WebAppDeploy partymgr warpConnection /partymgr
# WebAppDeploy webtools warpConnection /webtools
# WebAppDeploy workeffort warpConnection /workeffort

Now expand the template and restart the both Tomcat and Apache.

/sbin/e-smith/expand-template /etc/httpd/conf/httpd.conf
service tomcat4 restart
service httpd restart

Watch the log files for errors and please let me know if you have any questions.

tail /var/tomcat4/logs/catalina.out
tail /var/log/httpd/error_log


Good luck and enjoy!

Please send me feedback on this.  I would like to know how it works for everyone!

To-do's: (Not necessarily in order of importance)

1