How-To_Install_Open_for_Businesses_on_SME_Server
This article is outdated. Please improve it by updating it.
The below is based on a redhat howto found at: http://www.helmuth.net/mitel-sme/ofbiz/ofbiz-howto.htm
going through the process of converting this to gentoo:
"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.
Softwares used:
- mysql 5.0 or up (because of the transactional support)
- JAVA 1.5 or up (1.4 should also work though)
- working tomcat
Make a place to download/install:
- cd /opt
- mkdir ofbiz
- cd ofbiz
Install Ant. (JAVA "Compiler")
Install ant:
emerge dev-java/ant
Install tomcat:
USE="doc" emerge tomcat cp /opt/tomcat5/server/lib/catalina-ant.jar /usr/share/ant-core/lib
Make sure to do the above before you do the Java 1.5 stuff
Configure JAVA 1.5
JAVA 1.5 should never be the system JVM, for that reason it is important to first install things like ant (since some dependencies will not compile under 1.5):
After JAVA is stable under 1.4, including ant, only then get yourself into the 1.5 trouble
java-config -L. [blackdown-jre-1.4.2.02] "Blackdown JRE 1.4.2.02" (/etc/env.d/java/20blackdown-jre-1.4.2.02) [sun-jdk-1.4.2.09] "Sun JDK 1.4.2.09" (/etc/env.d/java/20sun-jdk-1.4.2.09) * [blackdown-jdk-1.4.2.02] "Blackdown JDK 1.4.2.02" (/etc/env.d/java/20blackdown-jdk-1.4.2.02)
Then try to emerge the ebuild:
ebuild /usr/portage/dev-java/sun-jdk/sun-jdk-1.5.0.05.ebuild digest ebuild /usr/portage/dev-java/sun-jdk/sun-jdk-1.5.0.05.ebuild fetch
The last command will give you and error but will provide the download location from Sun and also the destination location, place it there (/usr/portage/distfiles) Then run the fetch and merge command for the ebuild:
ebuild /usr/portage/dev-java/sun-jdk/sun-jdk-1.5.0.05.ebuild fetch ebuild /usr/portage/dev-java/sun-jdk/sun-jdk-1.5.0.05.ebuild merge
Then have a look at the default jdk:
java-config -L [blackdown-jre-1.4.2.02] "Blackdown JRE 1.4.2.02" (/etc/env.d/java/20blackdown-jre-1.4.2.02) [sun-jdk-1.5.0.05] "Sun JDK 1.5.0.05" (/etc/env.d/java/20sun-jdk-1.5.0.05) [sun-jdk-1.4.2.09] "Sun JDK 1.4.2.09" (/etc/env.d/java/20sun-jdk-1.4.2.09) * [blackdown-jdk-1.4.2.02] "Blackdown JDK 1.4.2.02" (/etc/env.d/java/20blackdown-jdk-1.4.2.02) .
Get a copy of Ofbiz.
To be able to get that you will need the subversion version controll utility:
emerge subversion
Then go the location where you want to store the software
cd /opt svn co http://svn.ofbiz.org/svn/ofbiz/trunk ofbiz
When all goes right this should give you a whole wealth of packages in the location, you wanted them to be
Change the permissions
We want to make sure that the "tomcat" user can do what he needs to to the directory containing ofbiz:
$chown -R tomcat /opt/ofbiz $chgrp -R tomcat /opt/ofbit
After all of that the command
ls -l /opt/ofbiz
Should result in something like this:
-rwxr-xr-x 1 tomcat tomcat 175 Jan 17 16:25 ant -rw-r--r-- 1 tomcat tomcat 77 Jan 17 16:25 ant.bat drwxr-xr-x 15 tomcat tomcat 4096 Jan 17 16:22 applications drwxr-xr-x 7 tomcat tomcat 4096 Jan 17 16:25 base -rw-r--r-- 1 tomcat tomcat 10114 Jan 17 16:25 build.xml drwxr-xr-x 24 tomcat tomcat 4096 Jan 17 16:24 framework drwxr-xr-x 3 tomcat tomcat 4096 Jan 17 16:21 hot-deploy -rwxr-xr-x 1 tomcat tomcat 309 Jan 17 16:25 ij.ofbiz -rw-r--r-- 1 tomcat tomcat 2869 Jan 17 16:25 rc.ofbiz drwxr-xr-x 6 tomcat tomcat 4096 Jan 17 16:22 specialized -rw-r--r-- 1 tomcat tomcat 303 Jan 17 16:25 startofbiz.bat -rw-r--r-- 1 tomcat tomcat 801 Jan 17 16:25 startofbiz.sh -rw-r--r-- 1 tomcat tomcat 616 Jan 17 16:25 stopofbiz.sh drwxr-xr-x 12 tomcat tomcat 4096 Jan 17 16:24 website
Install the mysql
First find out which keywords are mandatory for Ofbiz. The documentation of sequoia (a project related to ofbiz) speaks about the following: http://www.sequoiaerp.org/index2.php?option=com_content&do_pdf=1&id=37
- Install MySQL using the binary installation files from the MySQL download site. When prompted, select "Transactional Database" and "Online Transactions Processing (OLTP)" so that MySQL will use the right database engine. Make sure that TCP/IP access is enabled on port 3306. MySQL will prompt you for a root user password. Write it down--you will use it later to create databases.
This made me look round of the forums for "mysql and gentoo" and I found: nothing really ?????
- OLAP (apparently needed)
- transactional (apparently needed)
Since I am not a binary person at all, I basically went for the latest Gentoo-mysql version, which should give me a nice chance of succeeding.
ACCEPT_KEYWORDS="~x86" emerge -pv mysql [ebuild N ] dev-db/mysql-5.0.18 +berkdb -big-tables -cluster -debug -extraengine -max-idx-128 -minimal +perl (-selinux) +ssl -static -utf8 0 kB ACCEPT_KEYWORDS="~x86" emerge mysql
Start MySQL:
emerge --config =mysql-5.0.18 /etc/init.d/mysql start rc-update add mysql default
Create the database ofbiz and set the permissions for root
mysql_setpermission
Run through the installation howto for the normal version:
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.
Password for user to connect to MySQL:
What would you like to do:
1. Set password for an existing user.
2. Create a database + user privilege for that database
and host combination (user can only do SELECT)
3. Create/append user privilege for an existing database
and host combination (user can only do SELECT)
4. Create/append broader user privileges for an existing
database and host combination
(user can do SELECT,INSERT,UPDATE,DELETE)
5. Create/append quite extended user privileges for an
existing database and host combination (user can do
SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,
LOCK TABLES,CREATE TEMPORARY TABLES)
6. Create/append database administrative privileges for an
existing database and host combination (user can do
SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,LOCK TABLES,
CREATE TEMPORARY TABLES,SHOW DATABASES,PROCESS)
7. Create/append full privileges for an existing database
and host combination (user has FULL privilege)
8. Remove all privileges for for an existing database and
host combination.
(user will have all permission fields set to N)
0. exit this program
Make your choice [1,2,3,4,5,6,7,0]: 5
Which database from existing databases would you like to select:
You can choose from:
- information_schema
- mysql
- ofbiz
- test
Which database will it be (case sensitive). Type * for any:
ofbiz
The database ofbiz will be used.
What username is to be created: root
Username = root
Would you like to set a password for root [y/n]: y
What password do you want to specify for root:
Type the password again:
We now need to know from what host(s) the user will connect.
Keep in mind that % means 'from any host' ...
The host please: localhost
Would you like to add another host [yes/no]: no
Okay we keep it with this ...
The following host(s) will be used: localhost.
######################################################################
That was it ... here is an overview of what you gave to me:
The database name : ofbiz
The username : root
The host(s) : localhost
######################################################################
Are you pretty sure you would like to implement this [yes/no]: yes
Okay ... let's go then ...
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
configure apache and tomcat
This is all copied from another howto: HOWTO Apache2 and Tomcat5 so only the commands are given
First make sure the java-vm is set to 1.5:
$emerge apache $emerge tomcat
Once all the compiling is finished it is safe to set the system wide vm to the 1.5 version (needed for some other stuff:
java-config -S sun-jdk-1.5.0.06
System Virtual Machine set
You may want to update your enviroment by running:
"/usr/sbin/env-update && source /etc/profile"
After the virtual machine is set it is possible to start apache and tomcat5
/etc/init.d/apache2 start rc-update add apache2 default /etc/init.d/tomcat5 start rc-update add tomcat5 default
Make sure this comes out:
* Starting Tomcat ... Using CATALINA_BASE: /opt/tomcat5 Using CATALINA_HOME: /opt/tomcat5 Using CATALINA_TMPDIR: /opt/tomcat5/temp Using JAVA_HOME: /opt/sun-jdk-1.5.0.06
For any compilation (such as ofbiz) set the java virtual machine back to 1.4. Apparently a reboot is setting this back to 1.4. This might be tricky for tomcat (since it starts automatically), an alternative would be to modify the script:
/etc/init.d/tomcat5
and add two lines like:
java-config -S sun-jdk-1.5.0.06 /usr/sbin/env-update && source /etc/profile
Set the right environment variables for the build process.
This is some Redhat legacy ??
export JAVA_HOME= "gentoo does it all for you best is the set the virtual machine to 1.5 for the apache user only" export ANT_HOME= "gentoo does it all for you" export CATALINA_HOME= "gentoo does it all for you"
Would prefer to set this variable inside a script somewhere, not from the command line
export OFBIZ_HOME="/opt/ofbiz"
Make sure you are in the "OFBIZ_HOME"
cd $OFBIZ_HOME
Run the necessary "ANT" build processes.
cd /opt/ofbiz export OFBIZ_HOME="/opt/ofbiz" echo $OFBIZ_HOME ant > ant.out & tail -f ant.out
The above will give warnings with JAVA 1.5, but it will appear clean with JAVA 1.4. The main warnings are all about reserved keywords under 1.5 Lets hope running it will be more compatible that building it.
Configure Tomcat properly
The below appears quite "redhat legacy" 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"
do not yet know where to modify this with tomcat5 and gentoo
make ofbiz use MySQL
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)
* Once the mod_webapp connector is working, I want to turn off the HTML connector on 8080. This should in effect force all connections to Apache instead of Tomcat. Mostly this is configuration and security desire on my part.
Created by NickStallman.net, Luxury Homes Australia
Real estate agents should be using interactive floor plans and real estate agent tools.
