In this tutorial we will install OpenERP 6.1 with multi core support and a speedy webproxy. This is the way to get a well performing OpenERP 6.1 server.

Installing and configuring PostgreSQL

Install PostgreSQL database

sudo apt-get install postgresql


Create PostgreSQL User

sudo su postgres -c "createuser --createdb --no-createrole --pwprompt openerp"
#Enter Password
#Repeat Password
#Superuser: No

Change the postgesql.conf file to accept connections on all interfaces

sudo vi /etc/postgresql/9.1/main/postgresql.conf

Find the listen parameter and remove the # and listen to adress *

listen_address = '*'

Change the pg_hba.conf file to change the way authentication takes place

sudo vi /etc/postgresql/9.1/main/pg_hba.conf

Find the following line

local all all peer
hosts all all 127.0.0.1/32 md5

to:

local all all md5
hosts all all 127.0.0.1/32 md5

If you want to connect to the postgres database from your machine you need to add a new line to the Ipv4 part of this file: Example is for a network 192.168.1.0/24.

host all all 192.168.1.0/24 MD5

Install OpenERP 6.1

Create a user for the OpenERP application

sudo adduser --system --quiet --shell=/bin/bash --home=/opt/openerp --gecos 'OpenERP' --group openerp

Install the required dependicies for OpenERP 6.1

sudo apt-get install python-dateutil python-feedparser python-gdata python-ldap python-libxslt1 python-lxml python-mako python-openid python-psycopg2 python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi bzr

Get OpenERP 6.1 from Launchpad

sudo su openerp -c "bzr branch lp:openobject-server/6.1 /opt/openerp/server"
sudo su openerp -c "bzr branch lp:openobject-addons/6.1 /opt/openerp/addons"
sudo su openerp -c "bzr branch lp:openerp-web/6.1 /opt/openerp/web"
sudo chown -R openerp: /opt/openerp/*

Configure the OpenERP application

sudo cp /opt/openerp/server/install/openerp-server.conf /etc/
sudo chown openerp: /etc/openerp-server.conf
sudo chmod 640 /etc/openerp-server.conf

In the /etc/openerp-server.conf file you only need to change one line and add a line for the log file and path configuration.

sudo vi /etc/openerp-server.conf

change the line: (in vi use a to start editing)

db_password = False

with:

db_password = XXXXXX
(the password setup with the ALTER ROLE command)
addons_path = /opt/openerp/addons,/opt/openerp/web/addons
logfile = /var/log/openerp/openerp-server.log

Save the file (ESC :w)

Create a dir for the log file and give the correct permissions

sudo mkdir /var/log/openerp
sudo chown openerp:root /var/log/openerp

Check if the server works

sudo su - openerp -s /bin/bash
/opt/openerp/server/openerp-server –config=/etc/openerp-server.conf

Check it using your brwoser and go to: http://[ip or dns name of server]:8069
You should see the login screen or database creation of OpenERP
Press CTRL+C to stop the server and use exit to get out of the openerp user shell

Install Gunicorn

apt-get install gunicorn python-psutil

Open the file gunicorn.conf.py in /opt/openerp/server

vi /opt/openerp/server/gunicorn.conf.py

And change it to something like this

bind = '127.0.0.1:8069'
# commented because we will supply the the pid file path as command line option
# pidfile = '.gunicorn.pid'

conf = openerp.tools.config
conf['admin_passwd'] = 'passwd'
# Path to the OpenERP Addons repository (comma-separated for multiple locations)
conf['addons_path'] = '/opt/openerp/addons,/opt/openerp/web/addons'

# Optional database config if not using local socket
# conf['db_name'] = 'database_name'
# conf['db_host'] = 'postgresql_server'
conf['db_user'] = 'openerp'
# conf['db_port'] = 5432
conf['db_password'] = 'passwd'

Install NGINX

apt-get install nginx

Create a simpel config file in /etc/nginx/sites-enabled/
If you need an SSL connection with NGINX you can use these instructions.

vi /etc/nginx/sites-enabled/openerp-gunicorn

And change it to something like this

server {
   listen 80;
   server_name ;
   location / {
       proxy_pass http://127.0.0.1:8069;
       proxy_set_header Host $host;
       proxy_set_header X-Real-IP $remote_addr;
       proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
   }
}

Check if it works

sudo su openerp
cd /opt/openerp/server
gunicorn openerp:wsgi.core.application -c gunicorn.conf.py

If you go to http://servername you should be able to use your openerp server

Automatic Start on boot

Create a script to run OpenERP 6.1 with Gunicorn as a deamon
… work to be done here