Install OpenERP on CentOS 6.0 with Nginx HTTP Proxy

Posted on Fri 15 July 2011 in CentOS

This tutorial should help you with the installation process of OpenERP on CentOS 6.x.

I installed OpenERP server and the OpenERP webgui with a nginx http proxy on a CentOS 6.0.

First of all I installed minmal CentOS 6.0.

Login as root and process the following steps.

Use the official nginx repository for the latest nginx version:

How to install nginx on CentOS 6

Add the EPEL repository for the two packages PyYAML and pydot which are not included in the CentOS main repository.

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

Update the system and install all required dependencies:

yum update -y

yum install -y python-devel pychart python-dateutil python-reportlab python-lxml python-psycopg2 python-mako python-setuptools pytz PyYAML graphviz pydot  python-imaging pywebdav python-vobject postgresql-server nginx vim system-config-firewall-tui wget

Database setup:

Initialize the database directory:

service postgresql initdb

Start the PostreSQL server the first time:

service postgresql start

Add PostgreSQL server daemon to your default runlevel:

chkconfig postgresql on

Setup system user :

useradd openerp

passwd openerp

Create a database role and database:

su -c 'createuser --superuser --no-createrole --createdb --pwprompt openerp' postgres

su -c 'createdb --owner=openerp openerp' postgres

Download latest OpenERP 6.x version. Please download server and webapp package with the same version number here!

For example:

wget http://www.openerp.com/download/stable/source/openerp-server-6.0.2.tar.gz

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

Move or download the tarballs for example into the /usr/src/ directory and extract them.

tar xvfz openerp-server-6.0.2.tar.gz

tar xvfz openerp-web-6.0.2.tar.gz

Continue with installing the OpenERP server.

Change the directory to openerp-server-<yourversion> and run:

python setup.py install

Install the database:

su -c 'openerp-server --without-demo=all --stop-after-init --save' openerp

Now install the OpenERP webclient.

Change to the openerp-web directory:

python setup.py install

Create the log directory for the webclient:

mkdir -p /var/log/openerp-web

and copy the config file to the /etc directory:

cp /usr/lib/python2.6/site-packages/openerp_web-6.0.2-py2.6.egg/doc/openerp-web.cfg /etc/openerp-web.cfg

open and edit the file to be prepared for access the webgui through the nginx proxy

vim /etc/openerp-web.cfg

change and uncomment the following lines:

tools.proxy.on = True

tools.proxy.base = 'http://<yourproxyurl>'

Add the following lines to your /etc/local.start to start OpenERP on startup.

if [ "`runlevel | awk '{ print $2 }'`" -gt "1" ]; then
su -c 'openerp-server -c ~/.openerp_serverrc' openerp &
su -c 'openerp-web -c /etc/openerp-web.cfg' openerp &
fi

Configuration of Nginx proxy:

Create and edit a virtual host for your Openerp configuration.

vim /etc/nginx/conf.d/openerp.conf

past and modify the following lines:

server {
listen 80;
server_name  <yourdomain> ;
location / {
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}

Open the firewall port 80 tcp for webaccess.

system-config-firewall-tui

image0

image1

image2

image3

and configure nginx to start at boot time.

chkconfig nginx on

Start nginx server the first time:

service nginx start

Now we need to start openerp with the command we wrote in the local.start file or reboot the machine to be sure our configuration is correct.

Try to connect to your configured url. For example: http://openerp.example.com and login with username: admin and password: admin. Change the password for your admin user directly after your first login!

References:

http://labs.cre8tivetech.com/2011/01/openerp-simplified-installation-6-0-1/

https://docs.google.com/document/d/1861eyMCcSE0pNZKGHuPY5OfIatorxkpNg-4wFeiP1wI/edit?hl=en&authkey=COW5nkE&pli=1

http://www.openerp.com/forum/topic22108.html