Thursday, December 27, 2007

How do you install Adempiere with PostgreSQL on Debian/Ubuntu?

Having to repeat these steps over and over again (to help friends, I myself don't know anything -yet- about Adempiere or ERP in general), I better put this down here.

I know that there are great clues from adempiere's wiki (http://adempiere.com/wiki/index.php), but these steps are what is convinient for me, most are the same as in wiki.

First thing's first, download Adempiere package from sourceforge. I got this one:
Adempiere_331b

Install sun-java5-* packages (hint: aptitude install sun-java5-*, I choose to install all packages)

Configure pljava support for postgresql:
- Download the precompiled binaries package:
for postgresql-8.1: from pgfoundry.org
for postgresql-8.2: http://www.posterita.org/share/pljava.zip

- Configure so that postgres user is trusted (edit pg_hba.conf and do postgresql server restart after) While you're at it, remember to also configure adempiere user access in pg_hba.conf (I just set it to trust for local access)

- Copy pljava.so and pljava.jar from the pljava package to /usr/lib/postgresql/VERSION/lib

- Link libjvm.so (without it, pljava install will fail, I choose linking than adding entries to ld.so.conf) :
ln -s /usr/lib/jvm/java-1.5.0-sun/jre/lib/i386/server/libjvm.so /usr/lib/libjvm.so

- Add the following lines to end of postgresql.conf :
custom_variable_classes = 'pljava'
pljava.classpath='/usr/lib/postgresql/8.1/lib/pljava.jar'
pljava.statement_cache_size = 10
pljava.release_lingering_savepoints = true
pljava.vmoptions = ' '
pljava.debug = false
- Then to environment (/etc/postgresql/VERSION/main/environment)
JAVA_HOME = '/usr/lib/jvm/java-1.5.0-sun'
- Copy install.sql to /tmp, for run by postgres user (hint: su to root then su - postgres), so that we could just run it by:
psql template1 -f /tmp/install.sql

while we're at it, remember to also create adempiere user:
createuser adempiere

- Restart postgresql server

Now after postgresql preparation ready let's go to adempiere. I usually just prepare an Adempiere directory on user's home. And make this setup:

/home/USER/Adempiere/Server
/home/USER/Adempiere/Client

Also do this:
export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
export ADEMPIERE_HOME=/home/arief/Adempiere

and remember to put those lines on the end of ~/.bashrc too.

Then I extract the Adempiere package to the Server directory. Then copy and extract the AdempiereClient.zip (you may get it from Server/lib/AdempiereClient.zip) on Client directory.

on Server, I do:
chmod 755 *.sh utils/*.sh

Then execute: Server/RUN_setup.sh

On the configuration setup screen, I usually setup webserver port to: 8080 and 4433, so that I could run Adempiere as regular user. For database, don't forget to set it to postgresql. If on testing the configuration you failed to connect to the web or database, try changing the host to '127.0.0.1' or localhost or your computer name and re-test.

If test all passed, you can save the config (click the Save button) then just wait for the setup to finish.

After setup we can now import the database structure (also with some demo data) by running:
Server/utils/RUN_ImportAdempiere.sh

If all's fine with the postgres-pljava setup, we should move along just fine here. And when it's all done. We could start the Adempiere Server with:
Server/utils/RUN_Server2.sh

And then we could start client by:
Client/RUN_Adempiere.sh

at first run it will ask for configuration. Just fill it the values you put on the server setup.

After that, Client should started up and showing nice graphs and dashboards. This is where I get amazed and confused and pressed the Quit button :-)

Oh, for easier launch, I usually add these two files:

/home/USER/Adempiere/server_start.sh
/home/USER/Adempiere/client_start.sh

With contents like these:
#!/bin/sh
# server_start.sh
#
export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun

cd /home/USER/Adempiere/Server/utils/
ADEMPIERE_HOME=/home/USER/ADempiere/Server /home/USER/Adempiere/Server/utils/RUN_Server2.sh


#!/bin/sh
# client_start.sh
#
export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun

cd /home/USER/Adempiere/Server/utils/
ADEMPIERE_HOME=/home/USER/ADempiere/Client /home/USER/Adempiere/Client/RUN_Adempiere.sh

Then I could create nice launchers for them and put it on panel or desktop. Remember to set to run server_start.sh inside a terminal.

Hope I didn't missed anything.

4 comments:

Jose said...

great help, thanks but it fails to me here:
custom_variable_classes = 'pljava'
pljava.classpath='/usr/lib/postgresql/8.1/lib/pljava.jar"
when i stop ant restart postgresql it doesnt start. i'm using postgresql 8.3 on ubuntu 8.04 under vbox.
Thanks

Arief said...

Hi Joser,

Haven't checked, but I think you would need to install and use postgresql-8.3-pljava-gcj package in Ubuntu 8.04.

This guide may provide furthere references: http://www.adempiere.com/wiki/index.php/Install_on_Ubuntu_8.04

All the best.

Anonymous said...

i'll try when i get home.
Thanks for your answer

John Rose said...

Arief,

I liked your idea of installing Adempiere as Client & Server on same machine. One point is that AdempiereClient.zip doesn't seem to in extracted libs directory of 3.4.2s or 3.5.3a versions. Could you clarify?

John