Visit this site. Sign up for PayPal and start accepting credit card payments instantly.
Cheap Unlimited Webhosting by Dollar2host.com


Selasa, 03 November 2009

Installing Adempiere on Ubuntu 8.04 server

Installing on Ubuntu 8.04 server

This guide details how to install Posterita 1.7.4 on a clean Ubuntu 8.04 Server. The procedure has been tested on Amazon EC2 instances provided by alestic.

UPDATE 2008-10-13: Successfully tested on version 1.7.4 released earlier today.
Contents


* 1 Overview
* 2 Stage 1
o 2.1 Pre-requisites from repositories
o 2.2 Setting Java Environment Variables
o 2.3 PostgreSQL: Setting up Permissions, Role & Database
o 2.4 Creating the adempiere user
o 2.5 Installing PLJava
o 2.6 Importing the Database dump
* 3 Stage 2
o 3.1 SSH with X11 forwarding
o 3.2 Install Adempiere Server (GUI Setup)
o 3.3 Run Adempiere Server

Overview

The installation is logically divided into two main stages:

1. Pre-X11: Installing and setting-up the pre-requisites as users root, postgres and adempiere. (Section 2)
2. X11 enabled: Completing the remote GUI install as user adempiere (Section 3).

You will install and set-up the following:

* Java 6 JDK
* PostgreSQL 8.3 database
* PLJava 1.4
* Posterita 1.7.4 (running on Adempiere 3.4)

I haven't timed the procedure precisely, but it should be relatively quick. If you have a fast network connection - eg Amazon EC2 - you should have a running server within 30 minutes. Stage 1 should complete within 20 minutes, with another 10 minutes for Stage 2. In the first stage you will be downloading around 200MB of packages, including posterita. For the second stage, elapsed time depends on your available server resources.

The commands are provided in a format that favours bulk copy and paste. Interactive user input is required only in sections 2.1, 2.3, 2.4, 3.1 and 3.2.
Stage 1
Pre-requisites from repositories

aptitude update
aptitude safe-upgrade
apt-get install xterm xauth libxi6 libxtst6
apt-get install unzip
apt-get install sun-java6-jdk
apt-get install postgresql-8.3

Setting Java Environment Variables

Set the JAVA_HOME variable and make it persistent.

echo 'JAVA_HOME="/usr/lib/jvm/java-6-sun"' | tee -a /etc/environment

source /etc/environment

More environment settings for shared libraries

echo "$JAVA_HOME/jre/lib/i386" | tee -a /etc/ld.so.conf
echo "$JAVA_HOME/jre/lib/i386/client" | tee -a /etc/ld.so.conf
echo "$JAVA_HOME/jre/lib/i386/native_threads" | tee -a /etc/ld.so.conf
echo "$JAVA_HOME/jre/lib/i386/server" | tee -a /etc/ld.so.conf

ldconfig

PostgreSQL: Setting up Permissions, Role & Database

Trust all db connections from the localhost

sed -i "s/ md5/ trust/g" /etc/postgresql/8.3/main/pg_hba.conf
sed -i "s/ ident sameuser/ trust/g" /etc/postgresql/8.3/main/pg_hba.conf

Create the new role and database for adempiere. For password, I've assumed a default of "adempiere". If you choose another, you'll need to make a slight change to the PLJava install step later. You will also be asked if the role will be a superuser. Say yes.

su - postgres
createuser -P -E -d adempiere
createdb -E UTF8 -O adempiere adempiere
/etc/init.d/postgresql-8.3 restart
exit

Creating the adempiere user

Add a new user to the operating system with username adempiere. The server will be run by this user. Remember the password you enter. You'll need it again in 3.1.

adduser adempiere

Next, set up some environment variables for the user, download the adempiere/posterita archive and extract it.

su - adempiere
echo "# Adempiere setup variables" >> .bashrc
echo "export ADEMPIERE_HOME=/home/adempiere/Adempiere" >> .bashrc
source .bashrc
wget http://downloads.sourceforge.net/posterita/Posterita174.zip
unzip Posterita174.zip
exit

Installing PLJava

Back as the root user, install PLJava. As explained before, if you've used a password other than "adempiere" for the database role, make this change to the last line:

* -password adempiere --> -password YOUR-PASSWORD

mkdir /opt/pljava
cd /opt/pljava

wget http://pgfoundry.org/frs/download.php/1598/pljava-i686-pc-linux-gnu-pg8.3-1.4.0.tar.gz
tar zxvf pljava-i686-pc-linux-gnu-pg8.3-1.4.0.tar.gz

echo "dynamic_library_path = '\$libdir:/opt/pljava'" >> /etc/postgresql/8.3/main/postgresql.conf
echo "custom_variable_classes = 'pljava'" >> /etc/postgresql/8.3/main/postgresql.conf
echo "pljava.classpath = '/opt/pljava/pljava.jar'" >> /etc/postgresql/8.3/main/postgresql.conf

/etc/init.d/postgresql-8.3 restart

cp /home/adempiere/Adempiere/lib/postgresql.jar /opt/pljava
java -cp postgresql.jar:pljava.jar:deploy.jar org.postgresql.pljava.deploy.Deployer -database adempiere -user adempiere -password adempiere -install

Importing the Database dump

su - postgres
psql -d adempiere < /home/adempiere/Adempiere/data/Adempiere_pg.dmp
exit

All the pre-requisites for installing the Adempiere server are now in place. You will not require the root shell beyond this point. I do keep it active only to keep an eye on the running processes and resources with top.
Stage 2
SSH with X11 forwarding

Now you will install the Adempiere server and run it. To proceed with the standard GUI install process, you need to establish a secure shell connection to your remote server with X11 forwarding. Bring up a terminal on your local machine.

ssh -X adempiere@REMOTE-SERVER

Use the password set in section 2.4. You should now be logged in as user adempiere. As your first login with X11 forwarding, look for the following confirmation just above the shell prompt.

/usr/bin/X11/xauth: creating new authority file /home/adempiere/.Xauthority

Continue with the installation.
Install Adempiere Server (GUI Setup)

cd Adempiere/
chmod +x *.sh
./RUN_setup.sh

After a few moments, a window will come up titled "Adempiere Server Setup".

You'll need to input the correct settings for server and database. Note that using the default of web port 80 doesn't seem to work on Amazon EC2 instances. Best to use a port over 1000 anyway. Here's a summary of the changes I usually need to make. The last three are a must given the settings used above for the database. If you went with the default database password of "adempiere", leave that field unchanged in the settings window.

* Application Server -> Web Port: 8080
* Application Server -> SSL: 8443
* Database Server -> Database Server: localhost
* Database Server -> Database Type: postgresql
* Database Server -> Database Name: adempiere

Click Test and make sure all is ok. Then click Save to proceed. The Key Store settings dialog box window will come up. Modify as appropriate and click the green tick. After a few moments the Adempiere Public License will pop up. Accept it. A final dialog box will pop up to inform you the settings have been saved. Click ok and wait as the application server is installed over the next few minutes. Progress can be tracked in the secure shell. When it's finished you'll see the following statement:

BUILD SUCCESSFUL
Total time: 4 minutes 28 seconds

Total time will vary from one machine to the other. Screenshots of the GUI installer will be posted soon on another page. (Update: The settings on this wiki do not allow upload of images/files)
Run Adempiere Server

Run the server!

/home/adempiere/Adempiere/utils/RUN_Server2.sh

After a few minutes, the server should be running. You can point your browser to http://:/. Satisfy yourself it's running fine.

Congratulations! You've just installed Posterita/Adempiere.

But before you start using it...

I'd strongly recommend a reboot at this point. You've probably eaten up a large chunk of your memory in steps 2.6, 3.2 and 3.3. On Amazon EC2, you'll probably have less than 200mb available out of a 1.7gb total (m1 small instance). Reboot the server, re-establish an ssh connection as user adempiere (X11 forwarding no longer required now), and re-start the server as per step 3.3.

2 komentar:

Waqar A. mengatakan...

Good article!

Can you also put some lines to describe how to run the server automatically on reboot, by using the batch files under $ADEMPIERE_HOME/utils/unix

w\

Edi Baek Blog mengatakan...

Below is the script I used to startup Adempiere in my Ubuntu Server.

#! /bin/sh -e
02.# /etc/init.d startup script for ADempiere
03.#
04.
05.# Script layout borrowed from anachron.
06.
07.# path to JAVA_HOME
08.JAVA_HOME=/usr/lib/jvm/java-6-sun-1.6.0.16
09.
10.# path to ADEMPIERE_HOME
11.ADEMPIERE_HOME=/opt/Adempiere
12.
13.# add to path
14.PATH=$JAVA_HOME/bin:$ADEMPIERE_HOME/utils:$PATH
15.
16.export JAVA_HOME ADEMPIERE_HOME
17.
18.test -x $ADEMPIERE_HOME/utils/RUN_Server2.sh || exit 0
19.
20.# Get lsb functions
21.. /lib/lsb/init-functions
22.
23.case "$1" in
24. start)
25. log_daemon_msg "Starting Adempiere server" "adempiere"
26.
27. start-stop-daemon --start --exec $ADEMPIERE_HOME/utils/RUN_Server2.sh >> /dev/null &
28.# $ADEMPIERE_HOME/utils/RUN_Server2.sh
29.
30. log_end_msg 0
31. ;;
32. stop)
33. log_daemon_msg "Stopping Adempiere server" "adempiere"
34.
35. start-stop-daemon --stop --oknodo --quiet --exec $ADEMPIERE_HOME/utils/RUN_Server2Stop.sh >> /dev/null &
36.
37. log_end_msg 0
38. ;;
39. *)
40. echo "Usage: /etc/init.d/adempiere {start|stop}"
41. exit 2
42. ;;
43.esac
44.
45.exit 0

I saved above script in a file named adempiere and placed it in /etc/init.d folder. Just need to change the JAVA_HOME and ADEMPIERE_HOME values according to your server settings. Then I register startup script with Ubuntu with below command:

1.sudo update-rc.d /etc/init.d/adempiere defaults

Restart your server, and you should see your Adempiere will startup during server boot up

http://www.adempiere.com/index.php/ADempiere_Dedicated_Server

promo

Hosting Unlimited Indonesia