Instalasi OpenERP Server

Sebelumnya kita membahas lebih lanjut tentang OpenERP, maka sebaiknya kita persiapkan terlebih dahulu server OpenERP yang akan kita development. Untuk itu pada kesempatan kali ini saya akan membahas sedikit tentang tata cara penginstalan openerp 6.1 & 7.0 pada server Ubuntu 12.04 LTS

A. Buat User OpenERP

sudo adduser --system --home=/opt/openerp --group openerp

B. Install PostgreSQL

1. Tambah Repository

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:pitti/postgresql
sudo apt-get update

2. Install

sudo apt-get install postgresql-9.1 libpq-dev

3. Buat User Database (user: openerp & pass: openerp)

sudo su postgres
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt openerp

4. Edit Postgres Configuration

sudo nano /etc/postgresql/9.1/main/postgresql.conf
listen_addresses = '*' # Untuk access dengan PgAdmin
log_statement = 'all' # Untuk log SQL Activity

5. Edit file Postgres yang lain :

sudo nano /etc/postgresql/9.1/main/pg_hba.conf
# TYPE DATABASE USER CIDR-ADDRESS METHOD
# "local" is for Unix domain socket connections only
# MODIFY THE EXISTING LINE TO LOOK LIKE THIS:
local all all trust
# IPv4 local connections:
# MODIFY THE EXISTING LINE TO LOOK LIKE THIS:
host all all 127.0.0.1/32 trust
# ADD THIS LINE TO ALLOW REMOTE ACCESS; use your own IP address range:
host all all 10.10.10.0/24 trust
# IPv6 local connections:
host all all ::1/128 ident

6. Restart PostgreSQL

sudo /etc/init.d/postgresql restart

C. Install Library Python

sudo apt-get install python-dateutil
sudo apt-get install python-docutils
sudo apt-get install python-feedparser
sudo apt-get install python-gdata
sudo apt-get install python-jinja2
sudo apt-get install python-ldap
sudo apt-get install python-libxslt1
sudo apt-get install python-lxml
sudo apt-get install python-mako
sudo apt-get install python-mock
sudo apt-get install python-openid
sudo apt-get install python-psycopg2
sudo apt-get install python-psutil
sudo apt-get install python-pybabel
sudo apt-get install python-pychart
sudo apt-get install python-pydot
sudo apt-get install python-pyparsing
sudo apt-get install python-reportlab
sudo apt-get install python-simplejson
sudo apt-get install python-tz
sudo apt-get install python-unittest2
sudo apt-get install python-vatnumber
sudo apt-get install python-vobject
sudo apt-get install python-webdav
sudo apt-get install python-werkzeug
sudo apt-get install python-xlwt
sudo apt-get install python-yaml
sudo apt-get install python-zsi
sudo apt-get install python-pip

D. Instalasi OpenERP Server

1. Download OpenERP File

wget http://nightly.openerp.com/7.0/nightly/src/openerp-7.0-latest.tar.gz

2. Extract

cd /opt
sudo mkdir openerp
cd openerp
sudo tar xvf ~/openerp-7.0-latest.tar.gz
sudo mv openerp-7.0/ openerp-server
cd openerp-server/openerp
sudo cp -R addons/ /opt/openerp/
cd ../..
sudo chown -R openerp: *

E. Konfigurasi OpenERP Server sebagai Service

1. Buat File Konfigurasi

cd /etc
sudo nano openerp-server.conf

Isi dengan seperti ini :

[options]
root_path = /opt/openerp/openerp-server
addons_path = /opt/openerp/addons
admin_passwd = admin
db_name = False
db_user = openerp
db_password = openerp
db_port = 5433
logfile = /var/log/openerp/openerp-server.log
netrpc_port = 8070
xmlrpc_port = 8069
xmlrpcs_port = 8071
without_demo = False
smtp_port = 25
xmlrpcs_interface =
syslog = False
logrotate = True
test_report_directory = False
list_db = True
timezone = False
xmlrpc_interface = 0.0.0.0
test_file = False
cache_timeout = 100000
smtp_password = False
secure_pkey_file = server.pkey
secure_cert_file = server.crt
#log_level = all
xmlrpc = True
test_disable = False
assert_exit_level = error
smtp_server = localhost
static_http_url_prefix = None
test_commit = False
xmlrpcs = True
demo = {}
login_message = False
import_partial =
pidfile = None
db_maxconn = 128
stop_after_init = False
osv_memory_count_limit = False
reportgz = False
osv_memory_age_limit = 1.0
debug_mode = False
netrpc = True
csv_internal_sep = ,
pg_path = None
static_http_enable = False
translate_modules = ['all']
smtp_ssl = False
netrpc_interface = 0.0.0.0
smtp_user = False
db_host = False
email_from = False
static_http_document_root = None

2. Bikin File Boot Script

sudo nano /etc/init.d/openerp-server

Isi file tersebut seperti ini :

#!/bin/sh
### BEGIN INIT INFO
# Provides: openerp-server
# Required-Start: $syslog
# Required-Stop: $syslog
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: OpenERP Server
# Description: OpenERP is a complete ERP and CRM software.
### END INIT INFO

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin/
#DAEMON=/usr/local/bin/openerp-server
DAEMON=/usr/local/bin/openerp-server
NAME=openerp-server
DESC=openerp-server
# Specify the user name (Default: openerp).
USER="openerp"
# Specify an alternate config file (Default: /etc/openerp-server.conf).
CONFIGFILE="/etc/openerp-server.conf"
# pidfile
PIDFILE=/var/run/$NAME.pid
# Additional options that are passed to the Daemon.
#DAEMON_OPTS="-c $CONFIGFILE --update=all"
#DAEMON_OPTS="-c $CONFIGFILE --init=all"
DAEMON_OPTS="-c $CONFIGFILE"
[ -x $DAEMON ] || exit 0
[ -f $CONFIGFILE ] || exit 0
checkpid() {
    [ -f $PIDFILE ] || return 1
    pid=`cat $PIDFILE`
    [ -d /proc/$pid ] && return 0
    return 1
}
if [ -f /lib/lsb/init-functions ] || [ -f /etc/gentoo-release ] ;
then
    do_start() {
        start-stop-daemon --start --quiet --pidfile $PIDFILE \
          --chuid $USER --background --make-pidfile \
          --exec $DAEMON -- $DAEMON_OPTS
        RETVAL=$?
        sleep 5
        # wait for few seconds
        return $RETVAL
    }
    do_stop() {
        start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo
        RETVAL=$?
        sleep 2
        rm -f $PIDFILE
        # wait for few seconds
        # remove pidfile
        return $RETVAL
    }
    do_restart() {
        start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo
        sleep 2
        rm -f $PIDFILE
        # wait for few seconds
        # remove pidfile
        start-stop-daemon --start --quiet --pidfile $PIDFILE \
          --chuid $USER --background --make-pidfile \
          --exec $DAEMON -- $DAEMON_OPTS
        RETVAL=$?
        sleep 5
        # wait for few seconds
        return $RETVAL
    }
else
    do_start() {
        $DAEMON $DAEMON_OPTS > /dev/null 2>&1 &
        RETVAL=$?
        sleep 5
        # wait for few seconds
        echo $! > $PIDFILE
        return $RETVAL
        # create pidfile
    }
    do_stop() {
        pid=`cat $PIDFILE`
        kill -15 $pid
        RETVAL=$?
        sleep 2
        rm -f $PIDFILE
        # wait for few seconds
        # remove pidfile
        return $RETVAL
    }
    do_restart() {
        if [ -f $PIDFILE ]; then
            do_stop
        fi
        do_start
        return $?
    }
fi
start_daemon() {
    if [ -f $PIDFILE ]; then
        echo "pidfile already exists: $PIDFILE"
        exit 1
    fi
    echo -n "Starting $DESC: "
    do_start
    checkpid
    if [ $? -eq 1 ]; then
        rm -f $PIDFILE
        echo "failed."
        exit 1
    fi
        echo "done."
}
stop_daemon() {
    checkpid
    if [ $? -eq 1 ]; then
        exit 0
    fi
    echo -n "Stopping $DESC: "
    do_stop
    if [ $? -eq 1 ]; then
        echo "failed."
        exit 1
    fi
    echo "done."
}
restart_daemon() {
    echo -n "Reloading $DESC: "
    do_restart
    checkpid
    if [ $? -eq 1 ]; then
        rm -f $PIDFILE
        echo "failed."
        exit 1
    fi
    echo "done."
}
status_daemon() {
    echo -n "Checking $DESC: "
    checkpid
    if [ $? -eq 1 ]; then
        echo "stopped."
    else
        echo "running."
    fi
}
case "$1" in
    start) start_daemon ;;
    stop) stop_daemon ;;
    restart|force-reload) restart_daemon ;;
    status) status_daemon ;;
    *)
        N=/etc/init.d/$NAME
        echo "Usage: $N {start|stop|restart|force-reload|status}">&2
        exit 1
        ;;
esac
exit 0
# vim: sts=4 st=4 et

Pastikan dapat dijalankan :

chmod a+x /etc/init.d/openerp-server

3. Buat Script Daemon

cd /usr/local/bin
sudo nano openerp-server

Isi dengan script seperti ini :

#!/bin/sh
cd /opt/openerp/openerp-server
exec /usr/bin/python ./openerp-server $@

Pastikan dapat dijalankan :

chmod a+x /usr/local/bin/openerp-server

4. Buat Log File

sudo mkdir /var/log/openerp
sudo touch /var/log/openerp/openerp-server.log
sudo chown -R openerp:openerp /var/log/openerp

F. Uji Server OpenERP

sudo /etc/init.d/openerp-server start
less /var/log/openerp/openerp-server.log
# atau
tail -f /var/log/openerp/openerp-server.log
Advertisements

7 thoughts on “Instalasi OpenERP Server

  1. Pingback: Wizard Eksport Import -Part 1- | Tutorial OpenERP

  2. Pingback: Tips Untuk Developer | Tutorial OpenERP

  3. Dear Pa,

    terima kasih pa tutorialnya sangat ajib sekali.

    Pa mau tanya ini, ada cara ga gmn cara satu database bisa langsung menujun satu port, contohnya:

    127.0.0.1:8069 untuk database x
    127.0.0.1:8070 untuk database y
    127.0.0.1:8071 untuk database z

    katanya ada yang bilang menggunakan db_filter option untuk setiap server, tp sy kurang paham cara penggunaannya(apa itu dan diletakkan dimana).

    mohon pencerahannya Pa.

    terima kasih.

  4. saya coba langkah-langkah sampai perintah menjalankan service odoo koq failed ya Pak. Saya cek log nya kosong.

    Saya menggunakan Ubuntu 16.04.2 server dan Odoo 10.

    Terima kasih sebelumnya.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s