Install on Ubuntu 8.04
Document created: Gabriel 17:42, 15 September 2008 (EDT)
(I think this is extremely important when documenting something that is likely to change within a year or so)
This document has a lot of common with Debian_and_PostgreSQL_Install as Ubuntu and Debian have a lot of common too :)
Let's assume you have Ubuntu 8.04 installed (32 bit for now). Install sudo and wget packages, we will need them.
sudo apt-get install sun-java6-jdk postgresql-8.3 postgresql-server-dev-8.3
This will most likely install some other packages as well (enter root password for sudo, say yes).
Let's check this:
gabriel@erpdev:~$ dpkg -l|grep postgres ii postgresql-8.3 8.3.3-0ubuntu0.8.04 object-relational SQL database, version 8.3 ii postgresql-client-8.3 8.3.3-0ubuntu0.8.04 front-end programs for PostgreSQL 8.3 ii postgresql-client-common 87 manager for multiple PostgreSQL client versi ii postgresql-common 87 PostgreSQL database-cluster manager ii postgresql-doc-8.3 8.3.3-0ubuntu0.8.04 documentation for the PostgreSQL database ma ii postgresql-server-dev-8.3 8.3.3-0ubuntu0.8.04 development files for PostgreSQL 8.3 server- gabriel@erpdev:~$ dpkg -l|grep java ii java-common 0.28ubuntu3 Base of all Java packages ii sun-java6-bin 6-06-0ubuntu1 Sun Java(TM) Runtime Environment (JRE) 6 (ar ii sun-java6-jdk 6-06-0ubuntu1 Sun Java(TM) Development Kit (JDK) 6 ii sun-java6-jre 6-06-0ubuntu1 Sun Java(TM) Runtime Environment (JRE) 6 (ar
Okay, now something harder:
cd /tmp wget http://pgfoundry.org/frs/download.php/1585/pljava-src-1.4.0.tar.gz tar zxf pljava-src-1.4.0.tar.gz cd pljava-1.4.0/ make
Hm, this will give us a lot of errors. We need jdk-5 to do the compile.
sudo apt-get install sun-java5-jdk
Java 5 is installed as well. Now test which java is used?
java -version
No good, Java6 is still used.
sudo update-alternatives --config javac
Now choose Java 5.
sudo update-alternatives --config java
Now choose Java 5 again.
Test again:
java -version
Hah! Java 5 is used. Good! Go back and retry:
cd pljava-1.4.0/ make
Almost okay, complaining about JAVA_HOME Now set JAVA_HOME:
export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun
Try again:
make
Oh yeah, compiling! (Ok, sorry, I've assumed you have gcc,make and maybe some other packages already installed). Complete package list: Ubuntu804PackageList
Under directory build you have pljava.jar, deploy.jar, examples.jar
Now let's install pljava libraries:
sudo su -
You are root from now, so take care!
Create a file named /etc/ld.so.conf.d/jvm.conf and add the following: /Note that for other platforms the i386 will be different!/
/usr/lib/jvm/java-1.5.0-sun/jre/lib/i386 /usr/lib/jvm/java-1.5.0-sun/jre/lib/i386/server /usr/lib/jvm/java-1.5.0-sun/jre/lib/i386/native_threads
Run ldconfig
ldconfig -v|grep jvm
If you see libjvm, then it's all right. Don't bother about lib64 ... :)
export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun cd /tmp/pljava-1.4.0/ make install
Edit /etc/postgresql/8.3/main/postgresql.conf and add at the end:
custom_variable_classes = 'pljava' pljava.classpath='/usr/lib/postgresql/8.3/lib/pljava.jar' pljava.statement_cache_size = 10 pljava.release_lingering_savepoints = true pljava.vmoptions = ' ' pljava.debug = false
Edit /etc/postgresql/8.3/main/environment and add at the end:
JAVA_HOME = '/usr/lib/jvm/java-1.5.0-sun'
Edit /etc/postgresql/8.3/main/pg_hba.conf and add at the end:
host all postgres 192.168.1.0/24 md5 host all adempiere 192.168.1.0/24 md5
(of course replace the given IP and netmask with your own.
Restart postgresql:
/etc/init.d/postgresql restart
Now you should exit from the root shell:
exit
Now let's install the SQL parts into the database. Please note that you have to install PLJava's SQL part into every database where you would like to use it! Of course if you install it into template1 then every database what you create afterwards will contain PLJava as well.
cd /tmp/pljava-1.4.0/src/sql
Become postgres user and then run psql
su - root su - postgres psql
We are in psql, now connect to template1:
\c template1
Now run install :
\i install.sql
Alternatively you can use the provided deploy.jar, although then you will have to copy the PostgreSQL JDBC driver into build directory.
You can check if the schema was created by
\dn
in psql. If sqlj is there, then you are all set.
( ... to be continued ... )