Instalasi Odoo 8,9,10 Pada Server Ubuntu 16.04


[Odoo 8] Instalasi Odoo 8,9,10 Pada Server Ubuntu 16.04



Sebelum memulai, pastikan kita sudah menset repository ubuntu ke server lokal seperti Kambing
UI, ITB, dll

sudo nano /etc/apt/sources.list

### COPAS ###

deb ftp://ftp.itb.ac.id/pub/ubuntu xenial main restricted universe multivers
deb ftp://ftp.itb.ac.id/pub/ubuntu xenial-updates main restricted universe multivers
deb ftp://ftp.itb.ac.id/pub/ubuntu xenial-security main restricted universe multivers
deb ftp://ftp.itb.ac.id/pub/ubuntu xenial-backports main restricted universe multivers
deb ftp://ftp.itb.ac.id/pub/ubuntu xenial-proposed main restricted universe multiverse

###
Ctrl+O & Enter untuk menyimpan dan akhiri dengan Ctrl+X. Lalu update repository dengan :

 sudo apt-get update
Selanjutnya lakukan intruksi dibawah ini :
A. Setting Language Server
locale
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
locale-gen
sudo dpkg-reconfigure locales
B. Membuat User Odoo Untuk Ubuntu
adduser odoo
usermod -a -G sudo odoo
su - odoo -s /bin/bash
C. Install Database
  sudo apt-get install postgresql
D. Membuat User Odoo Untuk Postgres
sudo su postgres
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo
exit
E. Edit Config Postgres (md5/peer menjadi trust)

sudo nano /etc/postgresql/9.5/main/pg_hba.conf
sudo /etc/init.d/postgresql restart
F. Install Library Odoo

  sudo apt-get install node-less python-cups python-dateutil python-decorator python-docutils python-feedparser python-gdata python-geoip python-gevent python-imaging python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid python-passlib python-psutil python-psycopg2 python-pybabel python-pychart python-pydot python-pyparsing python-pypdf python-reportlab python-requests python-simplejson python-tz python-unicodecsv python-unittest2 python-vatnumber python-vobject python-werkzeug python-xlwt python-yaml wkhtmltopdf
G. Download Source Odoo
Untuk versi Odoo silahkan disesuikan v8/v9/v10, pada tutorial ini saya menggunakan v8
  wget https://nightly.odoo.com/8.0/nightly/src/odoo_8.0.20160101.tar.gz
H. Tentukan Path Source Odoo
Jika untuk development di local laptop / pc. Maka cukup sampai tahapan ini dengan path di home masing-masing. Lalu ikuti tutorial ini pada point 2

cd /opt
sudo mkdir odoo
cd odoo
sudo tar xvf ~/odoo_8.0.20160101.tar.gz
sudo mv odoo-8.0-20160101/ odoo-server
cd odoo-server/openerp
sudo cp -R addons/ /opt/odoo/
cd ../..
sudo chown -R odoo: *


Untuk v10, ada tambahan intruksi :
sudo cp /opt/odoo/odoo-server/setup/odoo /opt/odoo/odoo-server/openerp-server
sudo chmod a+x /opt/odoo/odoo-server/openerp-server
I. Membuat File Config Odoo

cd /etc
sudo nano odoo-server.conf


### COPAS ###

[options]
  
admin_passwd = admin
csv_internal_sep = ,
reportgz = False
without_demo = False
import_partial =
pidfile = None
server_wide_modules = None
  
addons_path = /opt/odoo/addons/
  
xmlrpc = True
xmlrpc_interface =
xmlrpc_port = 8069
proxy_mode = False
xmlrpcs = True
xmlrpcs_interface =
xmlrpcs_port = 8071
  
secure_cert_file = server.cert
secure_pkey_file = server.pkey
  
netrpc = False
netrpc_interface =
netrpc_port = 8070
  
dbfilter = .*
  
static_http_enable = False
static_http_document_root = None
static_http_url_prefix = None
  
test_file = False
test_report_directory = False
test_enable = False
test_commit = False
  
  
logfile = /var/log/odoo/odoo-server.log
logrotate = True
syslog = False
  
log_handler = [':INFO']
log_level = info
  
email_from = False
smtp_server = localhost
smtp_port = 25
smtp_ssl = False
smtp_user = False
smtp_password = False
  
db_name = False
db_user = odoo
db_password = odoo
  
pg_path = None
db_host = False
db_port = False
db_maxconn = 64
db_template = template1
  
translate_modules = ['all']
list_db = True
  
debug_mode = False
  
timezone = False
  
osv_memory_count_limit = False
osv_memory_age_limit = 1.0
max_cron_threads = 2
  
unaccent = False
  
workers = 0
  
limit_memory_soft = 671088640
limit_memory_hard = 805306368
limit_time_cpu = 60
limit_time_real = 120
limit_request = 8192

###


J. Membuat Boot Script


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


### COPAS ###

#!/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/odoo-server
DAEMON=/usr/local/bin/odoo-server
NAME=odoo-server
DESC=odoo-server
# Specify the user name (Default: openerp).
USER="odoo"
# Specify an alternate config file (Default: /etc/openerp-server.conf).
CONFIGFILE="/etc/odoo-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

###


K. Pastikan Boot Script Dapat Dieksekusi

  sudo chmod a+x /etc/init.d/odoo-server


L. Membuat Daemon Scrip

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

### COPAS ###

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

####

M. Pastikan Daemon Script Dapat Dieksekusi

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

N. Membuat File Log

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

O. Jalankan Server

  sudo /etc/init.d/odoo-server start


P. Set Auto Restart

  sudo update-rc.d odoo-server defaults


Q. Ganti Port 8069 to 8080

sudo gedit /etc/rc.local

### COPAS ###

iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8069

###


sudo reboot



Selamat mencoba …


Sumber : https://tutorialopenerp.wordpress.com/2016/12/16/odoo-8-instalasi-odoo-8910-pada-server-ubuntu-16-04/