Adempiere/Libero Linux install from subversion head
Contents
Foreward
This is an attempt to correct and clarify documentation posted by a fellow employee, and update the Debian and PostgreSQL Install wiki to lenny as I use it. Where the old one works I will post the functional text without specific attribution. All text within may be assumed to be from the Debian and PostgreSQL Install, my fellow employee, myself, or wild-eyed greylings (whatever you wish) except where expressly noted otherwise.
This document also assumes you are using Debian release Lenny. This is being tested against vservers, some information may not be needed in a non-vserver install. If you verify this data, please add a line at the end of this section with this format:
'''Verified:''' distro version (kernel) <br/>'''''notes:''''' special notes <br/>~~~~username <hr/>
e.g.
Verified: InsanoFlex 0.1 (linux 2.6.23-blackmagic kernel)
notes: needed to do voodoo dance and sacrifice 3 chickens to account for blackmagic voodoo userspace limitations
JD 13:19, 24 October 2007 (EDT)JD
Don't expect this to work right now, I'm documenting it as I install it. This warning will be removed as my work is completed and I will add my own Verified line
Initial Application Server setup
We're starting off on the application server. Some of this is needed before we can set up the database, but the database is needed before we can start the application, so we'll go back and forth a little bit.
We're going to use /usr/local/src/ to store all our source code, if this dir doesn't exist you'll want to create it. The rest of this doc assumes this dir for all source, so if you use a different one you'll have to change some things. Now we create the adempiere and libero dirs in the /usr/local/src dir:
mkdir -p /usr/local/src/{adempiere,libero}
If you don't have svn, ant, and a jdk installed you'll need to get them (if you want to use ant to populate the database you'll also need postgresql-client on the app server):
aptitude install subversion sun-java5-jdk ant postgresql-client-8.2
- You may need to add non-free and contrib to the end of one of your sources lines in /etc/apt/sources.list then aptitude update and try again:
sed -i 's/\(deb .*\)/\1 non-free contrib/' /etc/apt/sources.list aptitude update aptitude install sun-java5-jdk
Next use svn to checkout from the adempiere repository:
svn checkout https://adempiere.svn.sourceforge.net/svnroot/adempiere/trunk /usr/local/src/adempiere
Now do the same for libero:
svn checkout https://adempiere.svn.sourceforge.net/svnroot/adempiere/branches/libero /usr/local/src/adempiere/libero
We need to build this in order to have the sqlj.jar file for the database server. Lets make an adempiere directory and build it:
mkdir /usr/local/adempiere export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun cd /usr/local/src/adempiere/utils_dev/ ant complete
This will create a tar.gz file inside adempiere/install, extract this to /usr/local, and make all the shell scripts executable
tar zxvf /usr/local/src/adempiere/adempiere/install/Adempiere_330.tar.gz -C /usr/local find /usr/local/Adempiere -iname '*.sh' -exec chmod u+x '{}' \;
Extract the the seed for the database and copy it over to the database server. At the same time we'll copy over the sqlj.jar. Because we use vservers we didn't need to use scp, but you probably will.
scp /usr/local/src/adempiere/sqlj/sqlj.jar /usr/local/Adempiere/data/Adempiere_pg.dmp <db server>:<where-ever you want it>
Now set up the database server
Database Server
Install postgres and development files
aptitude install postgresql-server-dev-8.2 postgresql-8.2 cvs
- If your config files don't get installed you may need to change some of your locales and rebuild your database:
export LC_ALL="POSIX" export LANG="POSIX" pg_createcluster 8.2 main
- If you're using a vserver you should probably to change the listen address in postgresql.conf to your external ip address since localhost may not be a usable address, especially if you have another postgres vserver.
install sun java5 jdk
aptitude install sun-java5-jdk
- This may require you to add contrib and non-free to your /etc/apt/sources.list (see above)
Get jdbc for your current java from here, we put it in /usr/local/lib. Remember the dir as it will be used later.
cd /usr/local/lib wget http://jdbc.postgresql.org/download/postgresql-8.2-506.jdbc3.jar
return to your compile dir, we used /usr/local/src so as not to make a mess
cd /usr/local/src
Get pljava from cvs:
cvs -d :pserver:anonymous@gborg.postgresql.org:/usr/local/cvsroot/pljava login (password is anonymous) cvs -d :pserver:anonymous@gborg.postgresql.org:/usr/local/cvsroot/pljava checkout org.postgresql.pljava
Compile and install (it will automatically install to your postgresql lib dir):
cd org.postgresql.pljava export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun make make install
edit the postgresql.conf and add the following lines
custom_variable_classes = 'pljava'
# define the class path that the JVM will use when loading the
# initial library. Only meaningful for non GCJ installations
pljava.classpath='/usr/lib/postgresql/8.2/lib/pljava.jar'
# Set the size of the prepared statement MRU cache
# ... that's server side caching of stuff
# (What are the units on this? Is K, or M, or Ardvarks, or Mass/The speed of light?
# I can't find any docs. Someone please comment)
pljava.statement_cache_size = 10
# If true, lingering savepoints will be released on function exit. If false,
# the will be rolled back
#
pljava.release_lingering_savepoints = true
# Define startup options for the Java VM.
# (sun docs suggest the commented one, this wiki doesn't specify.
# Anyone who's tried different options, input would be helpful. )
#pljava.vmoptions = '-Xmx64M'
pljava.vmoptions = ''
# Setting debug to true will cause the postgres process to go
# into a sleep(1) loop on its first call to java. This variable is
# only useful if you want to debug the PL/Java internal C code.
#
pljava.debug = false
- Much of this is cut and paste from postgres with direction from the old debian wiki.
And add the JAVA_HOME environment variable to the environment file:
JAVA_HOME='/usr/lib/jvm/java-1.5.0-sun'
Add the application and database servers to your pg_hba.conf
host all all <application>/32 trust hostnossl all all <db>/32 md5 host all all <your net & cidr> md5
Restart postgres
/etc/init.d/postgresql-8.2 restart
Now export your CLASSPATH (re-export your JAVA_HOME if you've logged out since the last time) so we can run the next command
export CLASSPATH='/usr/local/src/org.postgresql.pljava/build/deploy.jar:/usr/local/lib/postgresql-8.2-506.jdbc3.jar'
Now we install pljava support in the main cluster with the following:
su postgres -c "export JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun; /usr/bin/psql -d template1 \ -f /usr/local/src/org.postgresql.pljava/src/sql/install.sql"
- If you're using amd64 you'll need to add libjvm to your ld path otherwise you'll get several errors generally ending in 'ERROR: language "java" does not exist'
echo "$JAVA_HOME/jre/lib/amd64/server/" > /etc/ld.so.conf.d/postrgresql ldconfig
Create a user for Adempiere to run as:
useradd -d /nonexistant -s /usr/bin/psql adempiere
create user and database for adempiere:
su postgres -c "createuser adempiere -s -P; createdb adempiere --encoding=unicode"
- Remember the password you entered for adempiere, you will need it later
This prepares the database for pljava (according to wgth, donno if it's really needed or not)
java org.postgresql/pljava.deploy.Deployer -install -user adempiere -password <passwd> -host <db ip> -database adempiere
Dump the adempiere seed SQL into the database. This assumes the dmp was moved to root's home.
cat ~/Adempiere_pg.dmp | su postgres -c "psql adempiere"
I copied over sqlj.jar into root's home, so now I'm going to put it in a more logical location
mv ~/sqlj.jar /var/lib/postgresql/
Now install sqlj.jar and test it out
su - postgres psql adempiere
from inside postgres:
select sqlj.install_jar('file:/var/lib/postgresql/sqlj.jar','sqlj',true); SELECT sqlj.set_classpath('adempiere', 'sqlj'); SET search_path TO adempiere,public; select bpartnerRemitLocation (118);
If this last command returns 120 you can safely log out as postgres and begin running the migration sql code. We'll do this in the next section.
Now we should be able to return to the application server.
Finishing the Application and Database Servers
edit /usr/local/src/adempiere/migration/postgresql.properties:
#PostgreSQL home folder postgresql.home=/usr #PostgreSQL pgdata folder postgresql.pgdata= #adempeire database name postgresql.database=adempiere #adempiere database login postgresql.user=adempiere #adempiere database password postgresql.password=<password> postgresql.host=<db ip> postgresql.port=5432
Finish the db server by running the sql patches, fortunately ant can take care of that for us
cd /usr/local/src/adempiere/migration/330-trunk/postgresql ant
Now we take the AdempiereEnvTemplate.properties and copy it to AdempiereEnv.properties, then edit it so it matches our environment (most we don't need to change, I'll omit much of that):
ADEMPIERE_HOME=/usr/local/Adempiere/ JAVA_HOME=/usr/lib/jvm/java-1.5.0-sun #we have a lot of ram, so we're goint to bump this a bit ADEMPIERE_JAVA_OPTIONS=-Xms512M -Xmx1536M #Database server host name ADEMPIERE_DB_SERVER=<db ip> #Database user password ADEMPIERE_DB_PASSWORD=<password>
#make sure you change this to the ip/hostname #people will connect to you from, #not just where it is relative to you ADEMPIERE_APPS_SERVER=<ip> #Keystore setting ADEMPIERE_KEYSTORE=/usr/local/Adempiere/keystore
#Certificate details #Common name, default to host name ADEMPIERE_CERT_CN=adempiere #Organization, default to the user name ADEMPIERE_CERT_ORG=<org> #Organization Unit, default to 'AdempiereUser' ADEMPIERE_CERT_ORG_UNIT=AdempiereUser #town ADEMPIERE_CERT_LOCATION=<town> #state ADEMPIERE_CERT_STATE=<state> #2 character country code ADEMPIERE_CERT_COUNTRY=<country>
Now we can do a silent install and not have to worry about install any xutils:
./RUN_silentsetup.sh
Start up the server (you have to go to the dir, because, unfortunately, the util scrips appear to use relative paths).
cd /usr/local/Adempiere/utils/
nohup ./RUN_Server2.sh&
todo: write init script for Adempiere.
Adding Libero
libero is broken right now, this should be removed when it works
Build libero:
cd /usr/local/src/adempiere/libero ant
This produces a zip in /usr/local/src/adempiere/libero/2pack. Move this to a system with X on it and run Adempiere. Login as System using the system password supplied in the setup.
follow the instructions found here