How To Run ADempiere on FreeBSD

From ADempiere
Jump to: navigation, search
This Wiki is read-only for reference purposes to avoid broken links.


This document describes how to install and run ADempiere on FreeBSD operating system. Although it may be possible that the instructions here also apply to other BSD flavours such Open/NetBSD, it has not been tested.

Notice that this is just a simple setup how-to to start running and developing ADempiere in an experimental environment and is not intended as a deployment scenario since many steps such as operating system, database and application server securing/tuning are skipped over for the sake of simplicity.


  • A '#' at the beginning of a command shows that it's a command that should be run by root.
  • A '>' at the beginning of a command shows that it's a command that may be run by a normal user.

Software Requirements

Following this document all you need to start with, is a FreeBSD (i386) 6.2, 7.x or 8.0 installation with X and networking working; every other thing necessary will be fetched and built from the ports tree automatically.

NOTE: PL/Java will not compile on Java JDK1.6 - you need JDK 1.4 or 1.5 installed!

If you're too impatient to read the rest of the document, the following will be installed:

  • JDK 1.5.0 or Diablo JDK 1.5.0 (This is essential to run PL/Java regardless of whatever ADempiere release you plan to run)
  • JDK 1.6.0 (If you plan to run 3.5.1a or newer releases)
  • PostgreSQL 8.3 or 8.2
  • PL/Java
  • ADempiere

Preparing the environment

If you have already installed PostgreSQL and Java you can skip over to Installing PL/Java.

As a privileged user type the following in a terminal:

 # portsnap fetch
 # portsnap extract
 # portsnap update

Installing Java

As a privileged user type the following in a terminal:

 # cd /usr/ports/java/jdk15
 # make

You'll notice that instead of the 'make' process starting, there are some instructions on how to manually download different parts of JDK sources and binaries from different places and move them to '/usr/ports/distfiles'. That's because of some licensing issues Java (i.e. Sun) has on FreeBSD. Download the parts and type the following:

 # make && make install && make clean

Building Java is awfully time-consuming so you have about 3-6 hours of time to kill; happy killing!

Loading Java Shared Libraries Into Memory

In order to install PL/Java, Java shared objects (so) should be loaded into memory. Change the '/etc/rc.conf' as follows:

 # echo ldconfig_paths=\"/usr/lib/compat /usr/X11R6/lib /usr/local/lib /usr/local/lib/compat/pkg /usr/local/diablo-jdk1.5.0/jre/lib/i386 /usr/local/diablo-jdk1.5.0/jre/lib/i386/client /usr/local/diablo-jdk1.5.0/jre/lib/i386/native_threads\" >> /etc/rc.conf

Note: If there is already a ldconfig_paths entry in rc.conf you only need to add the addresses of the above command which start with '/usr/local/diablo-jdk1.5.0' to the existing ldconfig_paths entry.

Now load the new shared objects.

 # /etc/rc.d/ldconfig restart


Installing PostgreSQL


Welcome back! Installing the mighty database is straight-forward and easy.

 # cd /usr/ports/databases/postgresql82-server
 # make config

You may choose whatever options you like your database to be compiled with. Below is a sample configuration:

GNU GetOpts ON
MIT Kerberoes5 OFF
Heimdal OFF
Optimized CFlags ON
ThreadSafe OFF
Tests OFF
Debug OFF


 # make && make install && make clean

The make process installs both client and server. If you want the mighty database to be started when you boot up your FreeBSD, just do this:

 # echo enable_postgresql=\"YES\" >> /etc/rc.conf


For guides on setting up a PostgreSQL database, refer to PostgreSQL online documentation (Creating A Database Cluster).


Installing PL/Java


And the tricky PL/Java. Fetch the latest source from CVS repository and compile it. When asked for a password just hit ENTER.

 > cvs -d login
 > cvs -d checkout org.postgresql.pljava
 > setenv JAVA_HOME /usr/local/diablo-jdk1.5.0
 > cd org.postgresql.pljava/
 > gmake

Put the result in a standard place.

 > mkdir -p /usr/local/pljava/lib
 > cp build/objs/ /usr/local/pljava/lib
 > cp build/*.jar /usr/local/pljava
 > cp src/sql/*.sql /usr/local/pljava

Changing PostgreSQL Configuration

Add the followings to the end of the postgresql.conf file which can be found in $PG_DATA directory (normally this is /usr/local/pgsql/data).

 custom_variable_classes = 'pljava'
 dynamic_library_path = '$libdir:/usr/local/pljava/lib'
 pljava.classpath = '/usr/local/pljava/pljava.jar'
 pljava.vmoptions = '-XX:+UseAltSigs'

Restart the database server. You can do so by:

 # /usr/local/etc/rc.d/postgresql restart


 # pg_ctl -d /usr/local/pgsql/data -w -l logfile restart

Installing PL/Java Into Database

 > psql -d template1 -U pgsql
 template1# \i /usr/local/pljava/install.sql

That's done it!


Problem: When I try to install it into database I get the following error:

 ERROR:  could not load library "/usr/local/pljava/lib/": dlopen (/usr/local/pljava/lib/ failed: 
 /usr/local/jdk1.5.0/jre/lib/i386/client/ Undefined symbol "pthread_create"

Solution: You should map libpthread library to either libthr or libc_r threading libraries. You can do so by changing /etc/libmap.conf as follows:

# echo >> /etc/libmap.conf
# echo >> /etc/libmap.conf
# echo >> /etc/libmap.conf
# echo >> /etc/libmap.conf

Installing ADempiere Database

Now that you have PL/Java installed, the rest is just a piece of cake. Assuming that you have already downloaded ADempiere bundle and extracted it in some location -which we call ADEMPIERE_HOME-, first we have to create ADempiere database.

 > psql -d postgres -U pgsql
 postgres# CREATE USER adempiere SUPERUSER ENCRYPTED PASSWORD 'WhateverPasswordYouLike';
 postgres# CREATE DATABASE adempiere OWNER=adempiere ENCODING='UTF8';
 postgres# \c adempiere adempiere

You're logged in to the initial database. It's time to import the database and install SQLJ libraries. Don't forget to replace $ADEMPIERE_HOME with the real path since psql doesn't recognise environment variables.

 adempiere# \i $ADEMPIERE_HOME/data/Adempiere_pg.dmp
 adempiere# SET search_path TO adempiere;
 adempiere# SELECT sqlj.install_jar('file:///$ADEMPIERE_HOME/lib/sqlj.jar', 'sqlj', true);
 adempiere# SELECT sqlj.set_classpath('adempiere', 'sqlj');

Running The Server/Client

The Server

The first step is to configure the server.
Note: In tcsh -the default shell on FreeBSD- you can set an environment variable by using the setenv command. On bash it would be export. Don't forget the manpages if you have any problem.

# cd $ADEMPIERE_HOME && chmod +x *.sh
# ./

This is the setup wizard of ADempiere. The parameters you supply here will mainly be used to configure the server. Change the values to suite your configuration and then hit the Test button. If there appears a OK at the bottom right corner of the window, then hit the Save button, otherwise there's something wrong with the configuration parameters.
After a successful setup -which takes some minutes-, you can run the server.

> cd $ADEMPIERE_HOME/utils
> ./

The client

It's straight-forward:

> ./

That's it! You've got it running.


Caveat Emptor

  1. As of today, PL/Java doesn't run on JDK 1.6.

See Also

External Links