Saturday, April 21, 2012

OpenERP 6.1 on OpenSuse 12.1

This is the "how to" install, configure and start OpenERP 6.1 on OpenSuse 12.1 (one of the finest and secured Linux Desktops)
(Acknowledgement: Most of the installation steps have been borrowed from How to install OpenERP 6.1 on Ubuntu 10.04 LTS by Alan Lord)


Last update: August 04, 2012 (North American EST)


Prerequisites:
  • A system user, named "openerp" has been created. If not, create issuing the following command from a console:
        sudo adduser --system --home=/opt/openerp --group openerp
  • After creation of the system user "openerp", verify that you could switch to this newly created user: 
        sudo su - openerp -s /bin/bash
        this will open a console where the prompt will show the user is
        "openerp"
  • Python packages and its required libraries are installed as below:
include following repositories from YAST:
spin:invis
http://download.opensuse.org/repositories/spins:/invis/openSUSE_12.1_standard/
devel packages python
http://download.opensuse.org/repositories/devel:/languages:/python/openSUSE_12.1/
required python packages for openerp 6.1 on openSuse 12.1
  • python 2.7.2-7.5.1
  • python-Babel 0.9.6-9.1
  • python-Beaker 1.6.2-9.1
  • python-Mako 0.5.0-8.2
  • python-MarkupSafe 0.15-10.1
  • python-PyYAML 3.10-3.1
  • python-base 2.7.2-7.5.1
  • python-dateutil 1.5-17.1
  • python-devel 2.7.2-7.5.1
  • python-distribute 0.6.25-29.1
  • python-imaging 1.1.7-24.1
  • python-ldap 2.4.9-15.2
  • python-lxml 2.3.3-24.1
  • python-psycopg2 2.4.4-4.1
  • python-pyasn1 0.1.2-11.1
  • python-pyasn1-modules 0.0.2-1.1
  • python-pychart 1.39-14.1
  • python-pydot 1.0.25-1.1
  • python-pyparsing 1.5.6-15.1
  • python-reportlab 2.5-18.1
  • python-tk 2.7.2-7.5.1
  • python-tz 2011n-16.1
  • python-xml 2.7.2-7.5.1
  • Postgresql is installed as seen in the YAST | Software Management
  • A database user "openerp" is existed, if not, create by using the following steps from console:
    • sudo su - postgres
    • createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt openerp
    • Enter password for new role: ********
    • Enter it again: ********
    • exit


Installation of OpenERP server:
  • Download  openerp-6.1-1.tar.gz  from http://nightly.openerp.com/6.1/releases/
  • Create a directory named /opt/openerp and copy the downloaded tar ball into that directory
  • Extract the downloaded package sudo tar xvf ~/Downloads/openerp-6.1-1.tar.gz
  • Change the ownership of files to system user openerp, sudo chown -R openerp: *
  • Now copy all files to a new directory named "server" under /opt/openerp/, sudo cp -a openerp-6.1-1 server

Configuration of OpenERP server:
  • By default, a config file comes with ERP package, which is located at /opt/openerp/server/install/openerp-server.conf, modify the contents of the file as below:

[options]
addons_path = /opt/openerp/server/openerp/addons
admin_passwd = admin
assert_exit_level = error
cache_timeout = 100000
cpu_time_limit = 60
csv_internal_sep = ,
db_host = False
db_maxconn = 64
db_name = False
db_password = 1qaz@WSX
db_port = False
db_template = template0
db_user = openerp
dbfilter = .*
debug_mode = False
demo = {}
email_from = False
import_partial = 
list_db = True
log_handler = [':INFO']
log_level = info
logfile = /var/log/openerp/openerp-server.log
login_message = False
logrotate = True
max_cron_threads = 4
netrpc = True
netrpc_interface = 
netrpc_port = 8070
osv_memory_age_limit = 1.0
osv_memory_count_limit = False
pg_path = None
pidfile = /etc/openerp/openerp.pid
proxy_mode = False
reportgz = False
secure_cert_file = server.cert
secure_pkey_file = server.pkey
server_wide_modules = None
smtp_password = False
smtp_port = 25
smtp_server = localhost
smtp_ssl = False
smtp_user = False
static_http_document_root = None
static_http_enable = False
static_http_url_prefix = None
syslog = False
test_commit = False
test_disable = False
test_file = False
test_report_directory = False
timezone = False
translate_modules = ['all']
unaccent = False
virtual_memory_limit = 805306368
virtual_memory_reset = 671088640
without_demo = False
xmlrpc = True
xmlrpc_interface = 
xmlrpc_port = 8888
xmlrpcs = True
xmlrpcs_interface = 
xmlrpcs_port = 8071

  • Make sure that the files mentioned as logfile and pidfile parameters in the above configuration file are preexisted and openerp (system user)  has write access (issue these commands, sudo chown openerp: /var/log/openerp/openerp-server.log and sudo chown openerp: /etc/openerp/openerp.pid)
  • After these modifications, copy the configuration file under /etc/
  • Change the ownership to openerp, sudo chown openerp: /etc/openerp-server.conf
  • Change the mode of the configuration file, sudo chmod 640 /etc/openerp-server.conf

Default OpenERP server start (using default configuration):
  • (make sure that postgresql daemon has been started as a root user, sudo /etc/init.d/postgresql start)
  • After configuration file has been modified as above, open a console by switching the user to openerp, sudo su - openerp -s /bin/bash
  • Start the server by issuing command, /opt/openerp/server/openerp-server
  • The console message shows that it is waiting for connection
  • Now open the browser and point the URL to http://localhost:8069
  • The OpenERP login window will be opened as appeared below:


Start-Stop daemon script (this is optional):
  • To make the openerp-server start and stop more convenient, you may create a daemon script as below and save it under /etc/init.d as openerp-server. Note that this bash script does a very basic start, stop and restart and customized the 
#!/bin/bash

#
# Start and Stop of OpenERP 6.1
# /etc/init.d/openerp-server
# August 04, 2012 Jamil Rahman 
#
###---
# Purpose:           To start, stop or restart openerp-server 6.1 daemon
# Required-Start:    $syslog postgresql
# Short-Description: OpenERP Server 6.1 daemon
# Description:      - OpenERP 6.1 is installed under /opt/openerp/server/
#                   - The daemon is "openerp-server"
#                   - At start, it reads the configuration file /etc/openerp-server.conf 
#                   - After start, it saves the PID in a file openerp.pid under /etc/openerp
#                   - While stopping, it kills the saved PID
###---
OPENERP_BIN="/opt/openerp/server/openerp-server"
OPENERP_CONFIGFILE="/etc/openerp-server.conf"
OPENERP_RUNDIR="/etc/openerp"
PIDFILE="/etc/openerp/openerp.pid"

# Test for PID-Directory
if [ ! -d $OPENERP_RUNDIR ]; then
    mkdir $OPENERP_RUNDIR
fi

case "$1" in

    start)
        echo -n -e "Starting openerp-server...\n"
        python $OPENERP_BIN --config=$OPENERP_CONFIGFILE &
        ;;

    stop)
        echo -n -e "Shutting down openerp-server...\n"
        PID=`cat $PIDFILE`
        kill -9 $PID
        ;;

    restart)
        ## Stop the service and regardless of whether it was
        ## running or not, start it again.
        $0 stop
        $0 start
        ;;

    *)
        echo "Usage: $0 {start|stop|restart}"
        exit 1
        ;;
esac
exit $?

Steps to start and stop openERP using daemon script:

  • Make sure that all previously started postgresql and openerp-server process stopped
  • You may (re)Start postgresql daemon as a root user, sudo /etc/init.d/postgresql start (or restart))
  • Open a console and switch the user to openerp, sudo su - openerp -s /bin/bash
  • From openerp user shell, to start the openerp-server, issue command /etc/init.d/openerp-server start (or restart)
  • From openerp user shell, to stop the openerp-server, issue a command /etc/init.d/openerp-server stop
  • Now open the browser and point the URL to http://localhost:8888
  • The OpenERP login window will be opened as appeared below (note that, it will use the /etc/openerp-server.conf file (as mentioned in the daemon script which has http port configured as 8888)
[/end]