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
- 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
- Edit /etc/yum.repos.d/CentOS-Base.repo and add this line:exclude=postgresql*Add it to both the [base] and [updates] sections.
- 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
- 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
- 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
- Set Postgres to start on boot
chkconfig --levels 235 postgresql on
- Initialise new databases
service postgresql initdb
or as the postgres user, run this:
initdb -D /var/lib/pgsql/data
- 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.
- 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
- Create an openerp database
createdb -O openerp openerp
- 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.
- 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'
- Start Postgres
service postgresql start
Install Python 2.6
- 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
- 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
- Install easy_install:
easy_install Cython
- Install pip:
easy_install pip
- 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
- Install python-devel:
yum install python26-devel
- 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.
- Install libtool:
yum install libtool
(Not sure if this step was really needed.)
- 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
- 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
- Download the OpenERP6 server. Unpack it and install it:
python26 setup.py install
- 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.
- Make sure the new log file exists and is writable:
touch /var/log/openerp-server.log chown openerp /var/log/openerp-server.log
- Edit ~openerp/.openerp_serverrc; make changes to look like this (don’t enter the “…” lines):
-
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
- Add an openerp user:
adduser openerp
- Edit ~openerp/.bashrc
export LD_LIBRARY_PATH; LD_LIBRARY_PATH=/usr/local/lib
- Give the OpenERP server user permission to install new modules
chown openerp /usr/lib/python2.6/site-packages/addons
- 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 0Here 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
- Start the Openerp server:
service openerp-server start
Install and configure the OpenERP Web Server
- Install the dependent, pyparsing:
easy_install http://cheeseshop.python.org/packages/source/p/pyparsing/pyparsing-1.5.2.tar.gz
- 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
- 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'
- 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
- 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 0Here 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
- Start the Openerp web server:
service openerp-web start
Set the correct the boot order
- 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:
- http://civicom.eu/ERP/OpenERP/OpenERP-Instalacion.htm – Use Google’s Translation Service (inbuit in Google Chrome) to translate this page into your own language.
- http://techjinx.wordpress.com/2010/12/08/setting-up-openerp-on-centos-5-5/
- http://www.bdeferme.net/projects/howto/installation-of-openerp-centos
- http://openerpappliance.com/2009/09/15/openerp-all-in-one-installer-update-for-dummies/
- http://www.openerp.com/forum/topic21739.html
- http://www.openerp.com/forum/topic21994.html
- http://www.openerp.com/forum/topic17584.html
- http://www.openerp.com/forum/topic22108.html – this is probably your best option for getting OpenERP 6 running on Centos 5.5.
Note
I have not had complete success getting OpenERP 6 running with these instructions, as I have had a few errors, as documented on Launchpad:
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.
I checked my notes and I think I installed Chris Lea’s RPM for Python2.6; details here:
http://www.question-defense.com/2009/12/25/how-to-install-python-2-6-on-centos-5-without-breaking-yum
and
http://stackoverflow.com/questions/1465036/install-python-2-6-in-centos
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
I don’t know the answer, but you could try asking on the OpenERP Forum.
I’d also check the version numbers of all your Python packages to see if they match the version numbers I listed (under the second point 2) in my later post on How to install and configure OpenERP 6.0.1 on Ubuntu 10.10.
Basically, I haven’t succeeded in getting OpenERP 6 to run reliably on Centos 5.5 yet; that is why I switched to Ubuntu; good luck.
One last thing: check the three links in the “See Also” section; they were written after my document, and they may have been more successful.
you got any solution to this .. ??
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
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
No; OpenERP just runs on Postgres only, at this point in time.
However, a fork of OpenERP called Tryton runs on MySQL, SQLite, …
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??
Don’t know; try reporting this bug on OpenERP’s buglist on Launchpad.
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