Monday, June 30, 2014

Install Openerp 8 (Odoo 8) on Ubuntu 12.04 or 14.04

Step 1. Create the OpenERP user that will own and run the application


First thing first, I run the following scripts as user=administrator, unless mentioned seperately. 
Also, there are some change so I have update my instruction for newer odoo 8 version. 

sudo adduser --system --home=/opt/odoo --group odoo

This is a “system” user. It is there to own and run the application, it isn’t supposed to be a person type user with a login etc. In Ubuntu, a system user gets a UID below 1000, has no shell (it’s actually /bin/false) and has logins disabled. Note that it isspecified a “home” of /opt/odoo, this is where the OpenERP server code will reside and is created automatically by the command above. The location of the server code is your choice of course, but be aware that some of the instructions and configuration files below may need to be altered if you decide to install to a different location.

[Note: If you want to run multiple versions of OpenERP on the same server, the way I do it is to create multiple users with the correct version number as part of the name, e.g. openerp70, openerp61 etc. If you also use this when creating the Postgres users too, you can have full separation of systems on the same server. I also use similarly named home directories, e.g. /opt/openerp70, /opt/openerp61 and config and start-up/shutdown files. You will also need to configure different ports for each instance or else only the first will start.]

how to run the OpenERP server as the openerp system user from the command line if it has no shell. This can be done quite easily:

sudo su - odoo -s /bin/bash

This will su your current terminal login to the openerp user (the “-” between su and openerp is correct) and use the shell /bin/bash. When this command is run you will be in openerp’s home directory: /opt/openerp.

When you have done what you need you can leave the openerp user’s shell by typing exit.

Step 2. Install and configure the database server, PostgreSQL

sudo apt-get install postgresql

Then configure the OpenERP user on postgres:
First change to the postgres user so we have the necessary privileges to configure the database.

sudo su - postgres

Now create a new database user. This is so OpenERP has access rights to connect to PostgreSQL and to create and drop databases. Remember what your choice of password is here; you will need it later on:

createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo
Enter password for new role: ********
Enter it again: ********

Finally exit from the postgres user account:

Step 3. Install the OpenERP server

Now Odoo put the code on Github, so you need to install Github first:
sudo apt-get install git
Update apt source list
sudo apt-get update
Download and Install Updates
sudo apt-get upgrade

Install required and supporting packages for Odoo

sudo apt-get install graphviz ghostscript postgresql-client \
python-dateutil python-feedparser python-matplotlib \
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-imaging

sudo apt-get install gcc python-dev mc bzr python-setuptools python-babel \
python-feedparser python-reportlab-accel python-zsi python-openssl \
python-egenix-mxdatetime python-jinja2 python-unittest2 python-mock \
python-docutils lptools make python-psutil python-paramiko poppler-utils \
python-pdftools antiword postgresql

sudo apt-get install python-geoip python-requests python-decorator \
wkhtmltopdf python-passlib python-pip

sudo pip install wkhtmltopdf
sudo pip install pyPdf

Get / Install Odoo from Github to you system
sudo wget -O- | python
If this does not work, try the following,

Switch to the Odoo User;
sudo su - odoo -s /bin/bash
Grab a copy of the most current Odoo 8 branch (Note there is a “.” at the end of this command!):
git clone --depth 1 --branch 8.0 --single-branch .
(This might take a little while depending on the speed of your Internet connection.)
Once it’s finished exit from the odoo user:

Step 4. Test and configure the OpenERP server

I'd like to restart postgresql at this point, sometimes do not restart database may cause issue.
sudo service postgresql restart 

Now go to odoo folder where opeperp-server file resides. (This command may vary to your system, if you have specify different path for storing odoo project, I suggest to move the folder to /opt/odoo/ folder)

#this will change the user to odoo and change the directory to /opt/odoo
sudo su - odoo -s /bin/bash

Run server

When you see the following information that means your server is up and running now. Congratulation! I will discuss about setup postgres so can use pgAdmin to check database in later post. Here in this post I will discuss creating a script so can run openerp-server asa service.

2014-07-14 20:27:42,242 5826 INFO ? openerp: database hostname: localhost
2014-07-14 20:27:42,242 5826 INFO ? openerp: database port: 5432
2014-07-14 20:27:42,243 5826 INFO ? openerp: database user: odoo
2014-07-14 20:27:42,632 5826 INFO ? openerp.service.server: HTTP service (werkzeug) running on

Step 5. Setup the boot script and log file. 

You can check if Odoo is working by go to the webpage, the url should be host_ip_address:8069. But don't do anything even though you see the setup page. We want to setup the boot script (or service if you want to call it that way). Using ctrl+C to end openerp-server process, then make sure you are login as administrator.

sudo cp /opt/odoo/debian/init /etc/init.d/openerp-server
sudo cp /opt/odoo/debian/openerp-server.conf /etc/openerp-server.conf
sudo chmod 755 /etc/init.d/openerp-server
sudo chown root: /etc/init.d/openerp-server
sudo mkdir /var/log/openerp
sudo chown odoo:root /var/log/openerp

Now use vi or nano or whatever to update /etc/init.d/openerp-server, replace the first few rows to: 


And update the /etc/openerp-server.conf to the following:

; This is the password that allows database operations:
; admin_passwd = admin
db_host = localhost
db_port = 5432
db_user = odoo
db_password = odoo's password

addons_path = /opt/odoo/addons

 Now you should be able to run Odoo as a service:

sudo service openerp-server start
sudo service openerp-server stop

Well, this is it.


  1. Hi,
    I got problem from this step sudo wget -O- | python
    puTTy just hangs in two different occasions then I started searching and in one forum someone commented this won't install stable version.
    For that I need to do this
    git clone --branch 8.0
    Please help

    1. Try this way:
      Install Git.
      sudo apt-get install git

      Switch to the Odoo user:
      sudo su - odoo -s /bin/bash

      Grab a copy of the most current Odoo 8 branch (Note the “.” at the end of this command!):
      git clone --depth 1 --branch 8.0 --single-branch .

      Once it’s finished exit from the odoo user: exit.

    2. if you got this error:
      "fatal: destination path '.' already exists and is not an empty directory."
      do this:
      mkdir odoo_source_files
      cd odoo_source_files
      git clone --depth 1 --branch 8.0 --single-branch .
      cd ..
      cp -R odoo_source_files/* .
      doing that you will retreive a copy of odoo files, and keep a backup in odoo_source_files

  2. Hello , when i run the server then got the "Internal Server Error" error can you help me how to fix it