How to Run ADempiere on OpenSolaris
This article is based on Solaris 10.
Contents
Introduction
If you're interested in running ADempiere on OpenSolaris and don't know how, well, this page is for you! Since OpenSolaris libraries differ from Linux, we should do some tricks to setup the environment and libraries.
Pre-assumptions
The only pre-assumption of this article is that "You are using BASH" as the command shell. If not you can be simply doing so by typing
% bash
at command line.
Preparing the enviroment
In order to run ADempiere on OpenSolaris, there are some libraries and softwares that must be installed. This guide is arranged in the way that may be run within a single terminal and there's no need to close the terminal after each step -in fact, it is recommended in order to avoid setting the PATH variable each time you open terminal.
Required source packages
- GNU make (version I used: 3.81).
- GNU binutils (version I used: 2.17)
- PostgreSQL (version I used: 8.2.3)
- GCC (version I used: 4.1.2)
- PLJava (version I used: 1.3.1). I'd strongly recommend getting the source from PLJava CVS.
Setting up directories
First we must make some directories to install the new softwares into.
$ su root -c 'install -d -m 777 -u bin -g bin /opt/gnu; install -d -m 777 -u bin -g bin /opt/pgsql-8.2.3;' $ su root -c 'install -d /var/lib/pgsql; chown -R postgres:postgres /var/lib/pgsql; chmod -R 700 /var/lib/pgsql'
Installing GNU make
We need GNU make to be able to build other softwares. Extract the archive and CD into the new directory then issue the followings at the command line.
$ ./configure --prefix=/opt/gnu $ dmake $ dmake install $ export PATH=/opt/gnu/bin:$PATH
Installing GNU binutils
Utilities such as archiver, assembler and linker are vital to compiling GCC. Extract the archive and CD into the new directory then issue the followings at the command line.
$ export PATH=$PATH:/usr/sfw/bin:/usr/ccs/bin $ ./configure --prefix=/opt/gnu $ make $ make install
Installing PostgreSQL
It's time for the sweet OS RDBMS. Extract the archive and CD into the new directory then issue the followings at the command line. GNU readline library caused Java textboxes/areas to act strangely so I omitted installing it.
$ ./configure --prefix=/opt/pgsql-8.2.3 --without-readline $ make $ make install
Initialising the database
An uninitialised PostgreSQL database is like a honeyless bee!! Let's provide our bee with some honey :-) Issue the followings at the command line.
$ su postgres
If you haven't set a password for postgres user yet you may do so with
$ su root -c 'passwd postgres'
After logging in as postgres:
% bash # export PATH=/opt/pgsql-8.2.3/bin:$PATH # cd /var/lib/pgsql # initdb -D data # echo "listen_addresses = '*'" >> data/postgresql.conf # pg_ctl -D data -w -l logfile start # psql
Now you should be logged in to PostgreSQL instance. Type \q to quit psql.
# pg_ctl -D data -w -l logfile stop # logout %logout
Installing GCC
Mighty GCC is required to compile PL/Java. Extract the archive and CD into the new directory then issue the followings at the command line. If you'd like to add more languages to be supported, add them to the configure command, but I won't guarantee that GCC will be compiled if you change the switches.
$ ./configure --prefix=/opt/gnu --enable-languages=c --disable-shared --with-java-home=/usr/java --disable-libgcj $ make
By the way, it's time to have a cup of tea or take a shower as the process takes about 15~20 mins and produces hundreds of warnings!
$ make install
Installing PL/Java
And the last software is the tricky PL/Java. In fact, most of the above softwares are installed just to compile PL/Java! So, don't hesitate; let's get it done!
$ su root -c 'cd /usr; ln -s /usr/jdk/instances/jdk1.5.0 java;' $ su root -c 'crle -u -l /opt/gnu/lib:/usr/sfw/lib' $ export JAVA_HOME=/usr/java $ export PATH=/opt/pgsql-8.2.3:$PATH
Extract the PL/Java archive and CD into the new directory.
$ make $ make install $ cp src/sql/*.sql /opt/pgsql-8.2.3/share
The library and the jar files are copied to /opt/pgsql-8.2.3/lib.
Installing PL/Java into PostgreSQL
Yet not done with PL/Java. Now we need to tell PostgreSQL how to use it.
$ su root -c 'crle -u -l /usr/java/jre/lib/i386:/usr/java/jre/lib/i386/client:/usr/java/jre/lib/i386/native_threads' $ su postgres % bash # cd /var/lib/pgsql # echo "custom_variable_classes = 'pljava'" >> data/postgresql.conf # echo "dynamic_library_path = '\$libdir:/opt/pgsql-8.2.3/lib'" >> data/postgresql.conf # echo "pljava.classpath = '/opt/pgsql-8.2.3/lib/pljava.jar'" >> data/postgresql.conf # pg_ctl -D data -w -l logfile start
Now we install PL/Java into the ADempiere database.
# psql -d adempiere -U adempiere -f /opt/pgsql-8.2.3/share/install.sql # logout % logout
Importing ADempiere database
Extract the ADempiere archive and CD into the new directory.
$ cp lib/sqlj.jar /opt/pgsql-8.2.3/share $ unzip -d /tmp data/Adempiere_pg.jar $ psql -d adempiere -U adempiere -f /tmp/Adempiere_pg.dmp
Here we install ADempiere sqlj Jar file into the ADempiere database.
$ psql -d adempiere -U adempiere adempiere=# CREATE SCHEMA AUTHORIZATION adempiere; adempiere=# SELECT sqlj.install_jar('file:///opt/pgsql-8.2.3/share/sqlj.jar', 'sqlj', true); adempiere=# SELECT sqlj.set_classpath('adempiere', 'sqlj'); adempiere=# SET search_path TO adempiere, public; adempiere=# \q
Running ADempiere
Ah! Finally the last step! CD into ADempiere directory.
$ chmod +x *.sh $ chmod +x utils/*.sh $ ./RUN_setup.sh $ cd utils $ ./RUN_Server2.sh
Open a new terminal and CD into ADempiere directory.
$ export ADEMPIERE_HOME=`pwd` $ ./RUN_Adempiere.sh
That's done it! Congratulations! You're now running ADempiere on OpenSolaris.
Running ADempiere 3.53 on OpenSolaris 2008.05 with Glassfish Application Server
To run Adempiere on OpenSolaris 2008.05 with Glassfish, all the steps mentioned above apply. Except perhaps for the PL/Java part. If you are using Postgres 8.3 or later, you may not need PL/Java. Assuming you have installed Postgres and want to run Adempiere Glassfish installation on OpenSolaris you need to -
- Download and install Glassfish
- Go to Adempiere home directory i.e. the directory where you unzipped Adempiere and run Run_setup.sh.
- You will be presented with the ADempiere installation screen, choose Glassfish as your application server as shown in the image below
ADempiere installation on OpenSolaris with Glassfish as Application Server:
- Continue with the installation, when installation is over you will find a directory named glassfish in your ADempiere home.
- The next few steps mentioned here can also be found in the readme.txt that is created in your glassfish directory.Copy AdempiereSlib.jar and Adempiere.jar into the lib directory right under your Glassfish installation directory.
- Open login.conf in your domain's config directory. If you are using the defaults in the Glassfish installation, you will have domain1 created in your domains folder. Open ${Glassfish-home}/domains/domain1/config/login.conf and add the following line at the bottom -
adempiere { org.adempiere.as.glassfish.AdempiereLoginModule required; };
- Open domain.xml located in the config folder of your domain and search for <security-service. You will find a number of <auth-realm elements under <security-service elements. Add the following element under <security-service -
<auth-realm name="adempiere" classname="org.adempiere.as.glassfish.AdempiereRealm"> <property name="jaas-context" value="adempiere" /> <property name="auth-type" value="adempiere" /> </auth-realm>
- In domain.xml search for <java-config element. You will find a number of <jvm-options> element under <java-config. Add this line below <java-config -
<jvm-options>-DADEMPIERE_HOME=YourAdempiereHome</jvm-options>
Of course you need to replace YourAdempiereHome with the path of your Adempiere home.
- That's about it. You can start the Glassfish server through command line by going to your Glassfish installation directory and typing
./bin/asadmin start-domain
- To keep track of Adempiere deployment you may also do a tail -f of the log file which is
${Glassfish-home}/domains${your-domain}/logs/server.log
- Once you have the server running OpenSolaris, you can access it from any networked browser client using
http://<server-name>:<glassfish-port>/adempiere
- More screenshots of Adempiere on OpenSolaris and Glassfish can be found here.
See Also
Screenshots:
The following links were of much help: