Howto: Installation of OpenERP on CentOS

Back to projects

When installing OpenERP on CentOS for my new company Open-Future I noticed that the documentation on the OpenERP website is a bit out of date and mainly focuses on an installation on Ubuntu.

I decided to write a blogpost with a decent, up to date howto of how to install it on CentOS as I didn't find any online. Have fun installing, and.... Let's get started!

Let's make some things clear, text formatted like this are shell commands.

> echo "run this as a normal user"
# echo "run this as root"

This howto contains 2 parts:

  • Installation and configuration of openerp-server.
    The server package
  • Installation and configuration of openerp-web.
    The webclient GUI.

Let's start with openerp-server.

1. Installation

1.1 Installing the required packages

First, let's enable the EPEL repository, this repository, maintained by the Fedora Project contains most of the packages we need.

# rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm

Now, let's install the required packages:

# yum install python python-setuptools python-ldap python-ldaphelper PyXML python-psycopg2 \
pychart pydot libxml2-python python-lxml libxslt-python pytz postgresql-python graphviz \
python-imaging python-devel postgresql-server openldap-clients python-dev

There is one more package that we need, but it's not in the repositories, so dowload it from rpmforge and install it:

# cd /usr/src
# wget http://dag.wieers.com/rpm/packages/python-reportlab/python-reportlab-1.2...
# rpm -Uvh python-reportlab-1.20-1.el5.rf.noarch.rpm

1.2 Download openerp-server

# cd /usr/src

Download from: http://www.openerp.com/index.php?option=com_content&view=article&id=18&Itemid=28

# wget http://www.openerp.com/download/stable/source/openerp-server-5.0.6.tar.g

1.3 Installing openerp-server

 # tar xvf openerp-server-5.0.6.tar.gz
 # cd openerp-server-5.0.6
 # python setup.py install

That's it really :-)

1.4 Run as a daemon

There is no init script available for openerp-server and it has no option to force it to the background. You could run it in screen but that's not necessary as I wrote an init script for CentOS for you to use ;-).

First, we need to add an openerp user.

 # adduser openerp

Now, download the openerp-server.txt init script from the file attachments and add it as a service:

# mv /path/to/openerp-server.txt /etc/init.d/openerp-server
# chmod +x openerp-server
# chkconfig --add openerp-server
# chkconfig openerp-server on

Do not start it yet! First see the openerp-server configuration section.

2. Configuration

2.1 Postgresql

First we'll need to configure postgresql to setup an openerp user and database.
Let's start postgres:

# service postgresql start
# chkconfig postgresql on

If your selinux is enabled and enforcing (RECOMMENDED!) there might be a problem launching postgresql. If so check your audit log
and create a policy for postgresql.

# service postgresql start

Now, let's create a user for openerp:

# su - postgres
> createuser --createdb --no-createrole --pwprompt openerp

Now, let's create the postgres db:

# su - postgres
> createdb -O openerp openerp

To allow openerp-server to login to postgresql edit the following file: /var/lib/pgsql/data/pg_hba.conf
Make sure it looks like this (insert lines marked with '>>' but opress the '>>' !! :

# !! NOT SHELLCODE, FILE CONTENTS ;-) !!
# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

# "local" is for Unix domain socket connections only
>> local   all         all                               trust
local   all         all                               ident sameuser
# IPv4 local connections:
>> host    all         all         127.0.0.1/32          trust
host    all         all         127.0.0.1/32          ident sameuser
# IPv6 local connections:
host    all         all         ::1/128               ident sameuser

2.2 openerp-server

Now that postgresql is configured, we can configure openerp-server.
We are going to start openerp-server with the -s parameter, this gives us a basic config we can edit to our needs.

# su - openerp
> openerp-server -s

Now, we can stop it again and edit the configuration file.
Let's edit it:

 > vi ~/.openerp_serverrc

And change the following lines:

 admin_passwd = ...
db_user = openerp
db_port = 5432
db_password = ...
db_name = openerp
db_host = 'localhost'

That's it!! OpenERP server is configured, you can now start it:

# mkdir /var/run/openerp
# chown openerp.openerp /var/run/openerp
# service openerp-server start

And go on with installation and configuration of openerp-web.

Let's continue: openerp-web!

1. Installation

1.1 Download openerp-web

# cd /usr/src

Download from: http://www.openerp.com/index.php?option=com_content&view=article&id=18&Itemid=28

# wget http://www.openerp.com/download/stable/source/openerp-web-5.0.6.tar.gz

1.2 Installation

# tar xvf openerp-web-5.0.6.tar.gz
# cd openerp-web-5.0.6/lib
# ./populate.sh
# cd ..
# easy_install -U openerp-web

If you are having issues with easy_install, please try the following steps:

Easy_install has problems with wikispaces, according to http://pyparsing.wikispaces.com/Download+and+Installation

Just run easy_install http://cheeseshop.python.org/packages/source/p/pyparsing/pyparsing-1.5.0... manually, and afterwards run the easy_install -U openerp_web again. It should get past this point now.

Look for the config file and copy it to /etc/openerp-web.cfg

# cp /usr/lib/python2.4/site-packages/openerp_web-5.0.6-py2.4.egg/config/openerp-web.cfg \
/etc/openerp-web.cfg

1.4 Run as a daemon

An init script for openerp-web is available but sadly it only works for debian/ubuntu as the /etc/init.d/functions differ too much on Red Hat/CentOS. But not to worry, check the attachments and find the openerp-web.txt init script ;-).

Download the openerp-web.txt init script from the file attachments and add it as a service:

# mv /path/to/openerp-web.txt /etc/init.d/openerp-web
# chmod +x openerp-web
# chkconfig --add openerp-web
# chkconfig openerp-web on

Do not start it yet! First see the openerp-web configuration section.

2. Configuration

Just edit the configuration file to your needs:

# vi /etc/openerp-web.cfg

Basicly you need to change the following values:

 # Some server parameters that you may want to tweak
server.socket_host = "0.0.0.0"
server.socket_port = 8080

...

 # logging
log.access_file = "/var/log/openerp-web/access.log"
log.error_file = "/var/log/openerp-web/error.log"

Also, make sure the /var/log/openerp-web directory exists and is owned by openerp !

# mkdir /var/log/openerp-web
# chown openerp /var/log/openerp-web

...

 # OpenERP Server
[openerp]
host = 'localhost'
port = '8070'
protocol = 'socket'

...

 # will be applied on company logo
company.url = 'http://www.company.com'

You're done!

You can now start both services:

# service openerp-server start
# service openerp-web start

And go to http://your-openerp-server:8080 to log in as admin and do OpenERP stuff like enabling LDAP login, creating your company profile, customers, ...

To create a database, you can use the openerp-client or openerp-web interface and use the admin password set in openerp_serverrc to create a database.

AttachmentSize
openerp-server.txt1.84 KB
openerp-web.txt1.91 KB
guest's picture

Re: Howto: Installation of OpenERP on CentOS

These instructions are fantastic! The docs @ openerp.com are somewhat confusing so this is a very big help. I do however have a question. When all is said and done, what credetials do I use to log on to tthe openerp database that is created? The protgres account or something we set up in openerp_serverrc or something else entirely?
bdeferme's picture

Re: Howto: Installation of OpenERP on CentOS

To create a database, you can use the openerp-client or openerp-web interface and use the admin password set in openerp_serverrc to create a database.