[TOC]

Introduction

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.

This howto contains 2 parts:

  • Installation and configuration of openerp-server (the server package)
  • Installation and configuration of openerp-web (the webclient gui)

OpenERP Server Installation

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. You can download it from rpmfore and install it:

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

Download openerp-server

Download OpenERP here to /usr/src:

cd /usr/src
wget http://www.openerp.com/download/stable/source/openerp-server-5.0.6.tar.gz

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 :-)

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 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.

OpenERP Server Configuration

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

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.

OpenERP Web Installation

Download openerp-web

Download openerp-web here.

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 running the following commands:

easy_install http://cheeseshop.python.org/packages/source/p/pyparsing/pyparsing-1.5.0.tar.gz
easy_install -U openerp_web

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

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, you can download the openerp-web init script here ;-).

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.

OpenERP Web 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"
...
# OpenERP Server
[openerp]
host = 'localhost'
port = '8070'
protocol = 'socket'
...
# will be applied on company logo
company.url = 'http://www.company.com'

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

Start OpenERP Services!

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.



Comments

comments powered by Disqus