How to install OpenERP 6 on Centos 5.5

WARNING!

Installing OpenERP on Centos is painful – I got it working… mostly, but I haven’t fully succeeded yet; you are probably better off following these instructions: http://www.openerp.com/forum/topic22108.html.

Note that Tiny, the publishers of OpenERP6, do their development work on Ubuntu, so if you have a choice between Ubuntu and Centos, I’d recommend Ubuntu, as you’re more likely to get OpenERP working successfully.

Introduction

OpenERP 6.0 requires Python 2.6 and Postgres 8.4. This document describes how to install these on Centos 5.5, which comes with Python 2.4. These instructions should be run as root on your Centos linux server. They leave the existing version of Python 2.4 in place.

The following procedure was done with OpenERP 6.0 RC1.

Install and configure Postgresql 8.4

  1. Remove any older version of Postgres and it dependents using rpm -e recursively, e.g.
    rpm -qa | fgrep postgres
    
    rpm -e dovecot-1.0.7-7.el5.i386
    rpm -e python-psycopg2-2.0.14-1.el5.i386
    rpm -e subversion-1.4.2-4.el5_3.1.i386
    rpm -e mod_perl-2.0.4-6.el5.i386
    rpm -e mod_python-3.2.8-3.1.i386
    rpm -e php-5.1.6-27.el5.i386
    rpm -e mod_ssl-2.2.3-43.el5.centos.i386
    rpm -e webalizer-2.01_10-30.1.i386
    rpm -e httpd-manual-2.2.3-43.el5.centos.i386
    rpm -e system-config-httpd-1.3.3.3-1.el5.noarch
    rpm -e httpd-2.2.3-43.el5.centos.i386
    rpm -e apr-util-1.2.7-11.el5.i386
    
    rpm -e postgresql-python
    rpm -e postgresql-server
    rpm -e postgresql
    rpm -e postgresql-libs
  2. Edit /etc/yum.repos.d/CentOS-Base.repo and add this line:exclude=postgresql*Add it to both the [base] and [updates] sections.
  3. If there is an old database directory left behind from an earlier version of Postgres, move it out of the way, e.g.
    cd /var/lib/pgsql
    mv data data.8.1
  4. Install Postgres 8.4
    wget http://yum.pgrpms.org/reporpms/8.4/pgdg-centos-8.4-2.noarch.rpm
    rpm -ihv pgdg-centos-8.4-2.noarch.rpm
    
    yum install postgresql
    yum install postgresql-server
  5. Re-install all the dependent packages removed above, e.g.:
    yum install dovecot
    yum install apr-util
    yum install httpd
    yum install system-config-httpd
    yum install httpd-manual
    yum install webalizer
    yum install mod_ssl
    yum install php
    yum install mod_python
    yum install mod_php
    yum install mod_perl
    yum install subversion
    yum install python-psycopg2
  6. Set Postgres to start on boot
    chkconfig --levels 235 postgresql on
  7. Initialise new databases
    service postgresql initdb

    or as the postgres user, run this:

    initdb -D /var/lib/pgsql/data
  8. Allow remote PgAdmin clients access to the database: edit /var/lib/pgsql/data/postgresql.conf. Add this line:
    listen_addresses = '*'

    You could tighten this address range for better security.

  9. Create openerp user
    su - postgres
    createuser --createdb --no-createrole --pwprompt openerp
    Enter password for new role: .....
    Enter it again: .....
    Shall the new role be a superuser? (y/n) y
  10. Create an openerp database
    createdb -O openerp openerp
  11. Allow openerp-server to login to postgresql: edit /var/lib/pgsql/data/pg_hba.conf. Modify lines as indicated below:
    # 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:
    local   all         all         10.10.155.0/24        trust
    # IPv6 local connections:
    host    all         all         ::1/128               ident

    You could tighten this address range and methods for better security.

  12. Set the logging level. To tell Postgres to log all SQL activity (i.e. to see all the SELECT’s, UPDATES, DELETEs and INSERT statements), add this line to /var/lib/pgsql/data/postgresql.conf:
    log_statement = 'all'
  13. Start Postgres
    service postgresql start

Install Python 2.6

  1. Install Python. It should install itself without overwriting the existing version of Python. Centos 5.5 comes with Python 2.4. Python 2.6′s executable file should end up installed as /usr/bin/python26 and the installation files in /usr/lib/python2.6. Install Python 2.6:
    yum install python26

Install packages required for OpenERP 6

  1. Install setuptools:
    wget http://pypi.python.org/packages/source/s/setuptools/setuptools-0.6c11.tar.gz

    Then unpack it and install it:

    python26 setup.py install
  2. Install easy_install:
    easy_install Cython
  3. Install pip:
    easy_install pip
  4. Use pip to make sure these packages are installed:
     pip install mako
     pip install dateutil
     pip install pydot
     pip install reportlab
     pip install pyyaml
     pip install pywebdav
  5. Install python-devel:
    yum install python26-devel
  6. Install lxml:
    yum install libxml2
    yum install libxml2-devel
    
    wget ftp://xmlsoft.org/libxml2/libxml2-sources-2.7.8.tar.gz
    tar xvf libxml2-sources-2.7.8.tar.gz
    cd ... to the created directory
    ./configure --with-python=/usr/bin/python26
    make
    make install
    
    wget ftp://xmlsoft.org/libxml2/libxml2-2.7.8.tar.gz
    tar xvf ...
    cd ...
    ./configure --with-python=/usr/bin/python26
    make
    make install
    
    wget http://pypi.python.org/packages/source/l/lxml/lxml-2.2.8.tar.gz

    Do the same unpacking etc. for libxml2-devel if needs be.

  7. Install libtool:
    yum install libtool

    (Not sure if this step was really needed.)

  8. Install libxslt:
    wget ftp://xmlsoft.org/libxml2/libxslt-devel-1.1.20-1.i386.rpm
    wget ftp://xmlsoft.org/libxml2/libxslt-1.1.26.tar.gz
    touch libtoolT - to work around weirdness in configure
    ./configure --with-libxml-prefix=/usr/local --with-python=/usr/bin/python26
  9. Install psycopg: Download it and then install it with:
    python setup.py install --with-xslt-config=/usr/local/bin/xslt-config --with-xml2-config=/usr/local/bin/xml2-config

Install and configure the OpenERP 6 Server

  1. Download the OpenERP6 server. Unpack it and install it:
    python26 setup.py install
  2. Edit /etc/init.d/openerp-server and make the DAEMONOPTS line look like this:
    DAEMONOPTS="--logfile=/var/log/openerp-server.log --log-level=debug_rpc_answer --pidfile=${PIDFILE}"

    See /usr/lib/python2.6/site-packages/openerp-server/tools/config.py for other valid log levels.

  3. Make sure the new log file exists and is writable:
    touch /var/log/openerp-server.log
    chown openerp /var/log/openerp-server.log
  4. Edit ~openerp/.openerp_serverrc; make changes to look like this (don’t enter the “…” lines):
  5. debug_mode = True
    ...
    log_level = debug_rpc
    ...
    root_path = /usr/lib/python2.6/site-packages/openerp-server
    ...
    addons_path = /usr/lib/python2.6/site-packages/openerp-server/addons
    ...
    db_host = 'localhost'
    db_port = 5432
    db_user = openerp
    db_name = openerp
    db_password = set-your-own-password-here
  6. Add an openerp user:
    adduser openerp
  7. Edit ~openerp/.bashrc
    export LD_LIBRARY_PATH; LD_LIBRARY_PATH=/usr/local/lib
  8. Give the OpenERP server user permission to install new modules
    chown openerp /usr/lib/python2.6/site-packages/addons
  9. Create a startup file called /etc/init.dopenerp-server, and add it as a service. Here is the contents of the script:
    #!/bin/sh
    
    #
    # OpenERP init script v0.1 for centos by Open-Future
    # Bert Deferme - www.open-future.be - bert@open-future.be
    #
    
    # This program is free software; you can redistribute it and/or modify
    # it under the terms of the GNU General Public License version 3 as
    # published by the Free Software Foundation.
    #
    # For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.
    
    # chkconfig: 345 60 61
    # description: starts the openerp-server service
    
    NAME=openerp-server
    USER=openerp
    
    PATH=/sbin:/bin:/usr/sbin:/usr/bin
    DAEMON=/usr/bin/openerp-server
    PID_DIR=/var/run/openerp
    PIDFILE=$PID_DIR/$NAME.pid
    DAEMONOPTS="--syslog --log-level=debug --pidfile=${PIDFILE}"
    
    checkpid() {
      [ -f $PIDFILE ] || return 1
      pid=`cat $PIDFILE`
      [ -d /proc/$pid ] && return 0
      return 1
    }
    
    do_start() {
    
      if [ -f $PIDFILE ]; then
        echo "pidfile already exists: $PIDFILE"
        exit 1
      fi
    
      echo -n "Starting $NAME: "
    
      if [ ! -d $PID_DIR ]
      then
          mkdir $PID_DIR
          chown $USER $PID_DIR
      fi
    
      su - $USER -c "nohup $DAEMON $DAEMONOPTS >/dev/null 2>&1 &"
    
      sleep 3
    
      checkpid
    
      if [ $? -eq 1 ]; then
        rm -f $PIDFILE
        echo "failed."
        exit 1
      fi
    
      echo "done."
    }
    
    do_stop() {
    
      checkpid
    
      if [ $? -eq 1 ]; then
        echo -n "$NAME not running... (no pidfile found)"
        exit 0
      fi
    
      echo -n "Stopping $NAME: "
    
      pid=`cat $PIDFILE`
      kill -15 $pid
    
      sleep 2
    
      if [ $? -eq 1 ]; then
        echo "Failed. (pidfile found but process didn't exist)"
        exit 1
      fi
    
      echo "done."
    
    }
    
    do_status() {
    
      echo -n "Checking $NAME: "
    
      checkpid
    
      if [ $? -eq 1 ]; then
        echo "stopped."
      else
        echo "running."
      fi
    
    }
    
    do_restart() {
    
      do_stop
    
      if [ $? -eq 1 ]; then
        exit 1
      fi
    
      do_start
    
    }
    
    case "$1" in
        start) do_start ;;
        stop) do_stop ;;
        restart|force-reload) do_restart ;;
        status) do_status ;;
        *)
            N=/etc/init.d/$NAME
            echo "Usage: $N {start|stop|restart|status}" >&2
            exit 1
            ;;
    esac
    
    exit 0

    Here is how to create it:

    vi /etc/init.d/openerp-server
    chmod +x /etc/init.d/openerp-server
    chkconfig --add openerp-server
    chkconfig --levels 235 openerp-server on
  10. Start the Openerp server:
    service openerp-server start

Install and configure the OpenERP Web Server

  1. Install the dependent, pyparsing:
    easy_install http://cheeseshop.python.org/packages/source/p/pyparsing/pyparsing-1.5.2.tar.gz
  2. Create the OpenERP Web Server configuration file:
    cp /usr/lib/python2.6/site-packages/openerp_web-6.0.0_rc1-py2.6.egg/openerp-web/doc/openerp-web.cfg /etc
  3. Edit the configuration file, /etc/openerp-web.cfg. Add or uncomment lines to be like this:
    log.access_file = "/var/log/openerp-web/access.log"
    log.error_file = "/var/log/openerp-web/error.log"
    ...
    company.url = 'http://www.yoururl.com/your_logo.jpg'
  4. Make sure the log directory /var/log/openerp-web exists and is owned by openerp.
    mkdir /var/log/openerp-web
    chown openerp /var/log/openerp-web
  5. Create a startup file called /etc/init.d/openerp-web, and add it as a service. Here is the contents of the script:
    #!/bin/sh
    
    #
    # OpenERP init script v0.1 for centos by Open-Future
    # Bert Deferme - www.open-future.be - bert@open-future.be
    #
    
    # This program is free software; you can redistribute it and/or modify
    # it under the terms of the GNU General Public License version 3 as
    # published by the Free Software Foundation.
    #
    # For a copy of the GNU General Public License, see <http://www.gnu.org/licenses/>.
    
    # chkconfig: 345 61 60
    # description: runs the openerp-web service
    
    NAME=openerp-web
    USER=openerp
    
    PATH=/sbin:/bin:/usr/sbin:/usr/bin
    DAEMON=/usr/bin/openerp-web
    PID_DIR=/var/run/openerp
    PIDFILE=$PID_DIR/$NAME.pid
    DAEMONOPTS="-c /etc/openerp-web.cfg"
    
    checkpid() {
      [ -f $PIDFILE ] || return 1
      pid=`cat $PIDFILE`
      [ -d /proc/$pid ] && return 0
      return 1
    }
    
    do_start() {
    
      if [ -f $PIDFILE ]; then
        echo "pidfile already exists: $PIDFILE"
        exit 1
      fi
    
      echo -n "Starting $NAME: "
    
      if [ ! -d $PID_DIR ]
      then
          mkdir $PID_DIR
          chown $USER $PID_DIR
      fi
    
      su - $USER -c "nohup $DAEMON $DAEMONOPTS >/dev/null 2>&1 &"
    
      pid=`ps -ef|grep openerp-web|grep -v grep|cut -d " " -f3`
    
      echo $pid > $PIDFILE
    
      sleep 3
    
      checkpid
    
      if [ $? -eq 1 ]; then
        rm -f $PIDFILE
        echo "failed."
        exit 1
      fi
    
      echo "done."
    }
    
    do_stop() {
    
      checkpid
    
      if [ $? -eq 1 ]; then
        echo -n "$NAME not running... (no pidfile found)"
        exit 0
      fi
    
      echo -n "Stopping $NAME: "
    
      pid=`cat $PIDFILE`
      kill -15 $pid
    
      sleep 2
    
      if [ $? -eq 1 ]; then
        echo "Failed. (pidfile found but process didn't exist)"
        exit 1
      fi
    
      rm $PIDFILE
    
      echo "done."
    
    }
    
    do_status() {
    
      echo -n "Checking $NAME: "
    
      checkpid
    
      if [ $? -eq 1 ]; then
        echo "stopped."
      else
        echo "running."
      fi
    
    }
    
    do_restart() {
    
      do_stop
    
      if [ $? -eq 1 ]; then
        exit 1
      fi
    
      do_start
    
    }
    
    case "$1" in
        start) do_start ;;
        stop) do_stop ;;
        restart|force-reload) do_restart ;;
        status) do_status ;;
        *)
            N=/etc/init.d/$NAME
            echo "Usage: $N {start|stop|restart|status}" >&2
            exit 1
            ;;
    esac
    
    exit 0

    Here is how to create it:

    vi /etc/init.d/openerp-web
    chmod +x /etc/init.d/openerp-web
    chkconfig --add openerp-web
    chkconfig --levels 235 openerp-web on
  6. Start the Openerp web server:
    service openerp-web start

Set the correct the boot order

  1. Make sure that the OpenERP server and web server are started AFTER the Postgres server: check the order of the startup files in each directory in /etc/rc?.d, e.g.
    cd /etc/rc2.d
    ls *postgresql *open*
    S60openerp-server  S60openerp-web S64postgresql
    mv S64postgresql S59postgresql

References

See Also

Here are related resources that may help you install OpenERP on Centos:

About these ads
This entry was posted in OpenERP and tagged , . Bookmark the permalink.

12 Responses to How to install OpenERP 6 on Centos 5.5

  1. hha says:

    Step: Install Python 2.6
    “Python 2.6′s executable file should end up installed as /usr/bin/python26 and the installation files in /usr/lib/python2.6.”

    Python 2.6 does not reside on /usr/lib/ any suggestion on how to go about installing it? Tried a number of options from the web, none seem to work.

  2. Del says:

    Excellent blog. Very helpful. Almost completed install. Error when starting openerp.
    PostgreSQL starts fine, using postgreSQL 9.0
    If try to start service:
    [openerp@vm-centtst openerp-server-6.0.1]$ service openerp-server start
    Starting openerp-server: Password:
    failed.
    Where can I find a log that might show why the failure.

    If try to start
    [openerp@vm-centtst openerp-server]$ python openerp-server.py
    Traceback (most recent call last):
    File “openerp-server.py”, line 58, in ?
    import netsvc
    File “/usr/lib/python2.6/site-packages/openerp-server/netsvc.py”, line 487
    self.log(‘params’, replace_request_password(params), depth=(None if logger.isEnabledFor(logging.DEBUG_RPC_ANSWER) else 1))
    ^
    SyntaxError: invalid syntax

  3. Buena aportacion
    quisiera hacerle una pregunta al autor de esta publicacion

    ¿Es posible usar otro gestor de base de datos con openerp diferente a postgres,
    por ejemplo mysql o oracle

    espero tu respuesta

  4. Good contribution
    I would like to ask you the author of this publication

    Can I use other database manager with different postgres openerp,
    for example mysql or oracle?

    I hope your answer

  5. Lilia Loulou says:

    i encountered some troubles when i tried to start the openerp-server
    service openerp-servet start
    Starting openerp-server: failed.
    and this what is written in the log :
    [2012-01-25 00:37:54,990][openerp] DEBUG:translate:no translation language detected, skipping translation for “‘Wrong ID for the browse record, got %r, expected an integer.’”

    What’s wrong??

  6. imran says:

    i have install openerp server and openerpweb but can not access through web. also openerp-web not going to create logs files. although both of the servers are running on the server. my sever OS is CentOS 5.6 and i have installed openerp-5.6

    please help how configure it through another port other then 8080, and how can i access through web url, will i need some sort of virtual host configuration for this.

    thanks in advance

    imran

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