There is a new version of this tutorial available for Ubuntu 22.04 (Jammy Jellyfish).

How to install Odoo ERP Software on Ubuntu 16.04

Odoo is a web-based OpenSource enterprise resource planning and customer relationship software that can help you to organize and grow your business. Odoo was formerly named openERP and therefore TinyERP. There are many apps available to extend Odoo, for example: billing, accounting, manufacturing, purchasing, warehouse management, and project management.

Odoo is created by Fabien Pinckaers/Odoo S.A and written in python. It is available for many operating systems, including Linux, Windows and Mac OS X. I will use Ubuntu 16.04 for the server installation. Odoo has released version 9 of their ERP software at October 1, 2015.

Prerequisites

  • Ubuntu 16.04 - 64bit
  • 2GB memory

What we will do in this tutorial:

  • Add the Odoo repository
  • Configure a user
  • Install and Configure Postgresql
  • Install dependencies needed by Odoo
  • Install Odoo
  • Configure Odoo

Step 1 - Add the Odoo repository

First you will have  to add the Odoo apt repository to your repository database file /etc/apt/sources.list. First, add the Odoo key with this apt command:

wget -O - https://nightly.odoo.com/odoo.key | apt-key add -

Then add the Odoo repository with the echo command:

echo "deb http://nightly.odoo.com/8.0/nightly/deb/ ./" >> /etc/apt/sources.list

Note: >> = add the Odoo repository to the last line in sources.list file.

and update the Ubuntu package lists:

apt-get update

Step 2 - Configure a Linux user for Odoo

Create a new user called odoo with home directory /opt/odoo and the group odoo. You can do it with this command:

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

and create a new directory for Odoo in the /var/lib/ directory.

mkdir -p /var/lib/odoo

Step 3 - Install and Configure PostgreSQL

Install postgreSQL with this apt-get command:

sudo apt-get install postgresql

and log into the PostgreSQL shell:

su - postgres

Now create a role for Odoo. This will allow Odoo to access/connect to the PostgreSQL server and to create, delete or modify the database. You will have to enter the password to ensure the security and keep it private.

createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo
  TYPE YOUR PASSWORD HERE

Finally type exit  to log out from the PostgreSQL shell.

Step 4 - Install dependencies needed

Odoo needs many python modules, just install all package below to fullfill its prerequisites:

sudo apt-get install python-cups python-dateutil python-decorator python-docutils python-feedparser \
python-gdata python-geoip python-gevent python-imaging python-jinja2 python-ldap python-libxslt1 \
python-lxml python-mako python-mock python-openid python-passlib python-psutil python-psycopg2 \
python-pybabel python-pychart python-pydot python-pyparsing python-pypdf python-reportlab python-requests \
python-simplejson python-tz python-unicodecsv python-unittest2 python-vatnumber python-vobject \
python-werkzeug python-xlwt python-yaml wkhtmltopdf

Step 5 - Install Odoo

Now you can install Odoo with apt:

sudo apt-get install odoo

When the installation is complete, Odoo will be running on port 8069. You can check it with the command:

netstat -plntu

Odoo is installed and running on port 8069. We will run odoo on local IP, because we will use an nginx web server as reverse proxy for odoo.

Edit the Odoo configuration file with vim:

vim /etc/odoo/openerp-server.conf

At the end of the file, paste configuration below:

xmlrpc_interface = 127.0.0.1
xmlrpc_port = 8069

Save and exit.

Step 6 - Install and Configure Nginx

Nginx is a lightweight web server and proxy with low memory andCPUu usage. In this step, we will install nginx and configure it as reverse proxy for Odoo.

Install nginx with apt:

sudo apt-get install nginx

Go to the nginx virtual host directory and create a new configuration file:

cd /etc/nginx/sites-available/
vim odoo

Paste the configuration below:

## Odoo Backend ##
upstream odooerp {
    server 127.0.0.1:8069;
}

## https site##
server {
    listen      443 default_server;
    server_name odoo.mysite.co;
    root        /usr/share/nginx/html;
    index       index.html index.htm;

    # log files
    access_log  /var/log/nginx/odoo.access.log;
    error_log   /var/log/nginx/odoo.error.log;

    # ssl files
    ssl on;
    ssl_ciphers                 ALL:!ADH:!MD5:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM;
    ssl_protocols               TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers   on;
    ssl_certificate             /etc/nginx/ssl/odoo.crt;
    ssl_certificate_key         /etc/nginx/ssl/odoo.key;

    # proxy buffers
    proxy_buffers 16 64k;
    proxy_buffer_size 128k;

    ## odoo proxypass with https ##
    location / {
        proxy_pass  http://odooerp;
        # force timeouts if the backend dies
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
        proxy_redirect off;

        # set headers
        proxy_set_header    Host            $host;
        proxy_set_header    X-Real-IP       $remote_addr;
        proxy_set_header    X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header    X-Forwarded-Proto https;
    }

    # cache some static data in memory for 60mins
    location ~* /web/static/ {
        proxy_cache_valid 200 60m;
        proxy_buffering on;
        expires 864000;
        proxy_pass http://odooerp;
    }
}

## http redirects to https ##
server {
    listen      80;
    server_name odoo.mysite.co;

    # Strict Transport Security
    add_header Strict-Transport-Security max-age=2592000;
    rewrite ^/.*$ https://$host$request_uri? permanent;
}

Save and exit.

I will run odoo under nginx with the domain name odoo.mysite.co and use a secure https connection.

Next, we need to create a new ssl certificate file for odoo with openssl.

Create the SSL directory:

mkdir -p /etc/nginx/ssl
cd /etc/nginx/ssl

Generate a new self-signed certificate file with the openssl command below:

openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout /etc/nginx/ssl/odoo.key -out /etc/nginx/ssl/odoo.crt

Change the permission of the certificate file:

chmod 600 odoo.key

Enable new odoo virtual host and test the nginx configuration:

ln -s /etc/nginx/sites/available/odoo /etc/nginx/sites-enabled/odoo
nginx -t

Make sure there is no error on nginx configuration and then restart nginx web server:

systemctl restart nginx

Step 7 - Configure Odoo

Odoo and nginx are installed, open a web browser and type in the odoo URL, in my case: https://odoo.mysite.co

You will be prompted to create a new database and to configure the email address and password for the admin account.

Enter the details for your installation and click on 'Create database'.

Enter database details in Odoo.

wait a minute for the odoo installation to finish.

After odoo created the database, we can login to the odoo admin dashboard. But for the security reason, we need to setup a master password for the odoo database manager.

Click on 'Manage Databases'

Odoo Login

Clik on 'Set Master Password'.

Set master password in odoo.

Type your password and click 'Continue'.

Enter the password.

Master password has been setup, and now back to the odoo url 'https://odoo.mysite.co/'.

Type your email and password and click 'Login'.

Login to Odoo

Odoo admin dashboard.

The odoo admin dashboard.

Odoo home page after install new app 'Forum'.

The odoo forum app

Odoo 9 with nginx has been successfully installed on ubuntu 16.04.

Conclusion

Odoo is an open source application that helps you to manage your business. Odoo / OpenERP is easy to install and configure and supports multiple operating systems. In Odoo, there are many applications available such as billing, accounting, manufacturing, purchasing, warehouse management, and project management. These apps can help you to manage and grow your business.

Share this page:

21 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: DocB

Odoo/openERP is technically rotten and has no open License. Upgrade is difficult to impossible. Search for sorryopenerp on the web....

By: JOduMonT

I'll not try to saying DocB is wrong. For sure migrating from 6 to 7 and 7 to 8 is a huge headache. I know some cie still using 6. About the SorryOpenERP program they discuss about it into their own forum : https://www.odoo.com/forum/help-1/question/worried-about-the-sorryopenerp-campaign-23304 and the GitHub is now dead : https://github.com/sorryopenerp/sorryopenerp.github.io/graphs/contributors

By: Rahul

Man this is probably the most complicated way of installing odoo!!!!!

By: CarlosRamos

 Congratulations on the Great Tutorial !!!

Simply the best tutorial odoo installation in ubuntu, fully explained step by step, leaving no loose pieces of difficult understanding.

 

I have a doubt:

You can install odoo 9 in the same VPS / Cloud account (Drop / Instance) along with a small site wordpress? Type the Odoo inside a folder!

www.sitewordpress.com/odoo or www.sitewordpress.com:8069

Example: Instead of two VPS

VPS1 2GB => Wordpress VPS2 2GB => Odoo

A single VPS

VPS 3 or 4 GB> with Wordpres and Odoo together

Thanks for the great tutorial !!

By: Vladimir

ln -s /etc/nginx/sites/available/odoo /etc/nginx/sites-enabled/odoo

you need

ln -s /etc/nginx/sites-available/odoo /etc/nginx/sites-enabled/odoo

instead

By: Alawi

You're correct Vladimir, this typo will prevent the new odoo site from being enabled and will show ngix default page.

Thanks for pointing out this error.

By: Alex

Great tutorial !

Following these steps I installed Odoo10 on Ubuntu 16.10.

Replaced Step1 with : echo "deb http://nightly.odoo.com/10.0/nightly/deb/ ./" >> /etc/apt/sources.list

And added : echo "deb http://us.archive.ubuntu.com/ubuntu vivid main universe" >> /etc/apt/sources.list" to be able to install "python-pybabel".

Many thanks

 

By: Anthony

When I enter su - postgres I get asked for a password. I've used my login password, 'admin' and 'password' but nothing works. Is there a default password I should be using?

By: till

Ensure that you run the "su postgres" command as root, not as admin user. postgres user has no password by default.

By: Ajay Tee

How do I ensure or get to run su - postgres as root?

By: Ajay Tee

How do I ensure or get to run su - postgres as root?

 

Turns out, all I had to do was add 'sudo' at the start of the command. I.E.

sudo su - postgres

 

Then it all worked fine..!

By: Ajay Tee

How do I ensure or get to run su - postgres as root?

 

Turns out, all I had to do was add 'sudo' at the start of the command. I.E.

sudo su - postgres

 

Then it all worked fine..!

By: Ajay Tee

Hi, I'm at the point where I need to enter su - postgres in the terminal window and it's asking me for a password.

I've used my login password, 'admin' and 'password' but none work.

Can you please provide me the password?

By: Agung

Thanks for your great tutorial, its very helpfull. Btw, how to restart the odoo, and how to add a command to add the path directory of addons of odoo?

By: Paul

I have folllowed all the steps..but when  i enter the domain name, i get problem loading page error. Can anyone help me troubleshoot this? Thank you

By: Mike

The simplest way is to provide your hosts file (/etc/hosts) with desired hostname e.g.

# sudo su

# echo 127.0.0.1 mydomain.co >> /etc/hosts

Something has to bind mydomain.co with your IP address. Without it, your browser will request ODOO server's IP from your default DNS server, which is not particulary good when no one knows your hostname. You may also want to use mDNS for resolving your hostname in small-medium network. Nginx example is focused on reverse proxying which allows you to secure the connection betweend clients (including workers) and your ERP server.

By: Fernando

Hi.

I followed this instructions. But, in this step

Step 7 - Configure Odoo

my page only shows the Nginx welcome message

Welcome to nginx!

How can I do in order to get odoo installed in my PC

By: Simon Chaung

Many many thanks for the great tutorial.

But, I do have 1 problem about restarting server.

After restarting server, the Odoo has just been disappear.

Can you teach me how to restart it?

By: Marin

thanks for the tuto

i have just a Question

After the install, i try to configure odoo but i have a 504 default gateway. 

i restart the server. I have again access but i can't connect with any admin password. How can i be sure of the login and password?

Regards

By: marin

use http://your_server_ip/web/login

By: Akshay

I want to add new odoo module in addons

but i cant gat how to add or install.

i am using above steps to install odoo

and odoo server installed in my ubuntu os