How to Install and Configure Odoo ERP on Ubuntu 16.04

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month. Get a Cloud Server

Odoo formerly known as OpenERP is a free and open source web based enterprise management applications that can be used to organize and grow your business.

It is written in Python and supports lots of operating systems including Linux, Windows and Mac OS X. You can use Odoo as stand-alone applications and can be integrated seamlessly. Odoo's business applications are devided in to six groups such as sales management applications, marketing applications, business operations applications, front-end applications, human resources and productivity applications.

There are many useful applications available with Odoo such as billing, accounting, manufacturing, purchasing, warehouse management, and project management. This will help you to manage and grow your business.

In this tutorial, we will install Odoo ERP on Ubuntu 16.04 server.

Requirements

A server runing Ubuntu-16.04 on your system.

A non-root user with sudo privileges setup on your server.

Update the System

Before starting, you will need to update the system's package repository database with the latest version. You can do this with the following commands:

sudo apt-get update -y

sudo apt-get upgrade -y

Once your system is up to date, you can proceed to the next step.

Installing Required Dependencies

Before starting, your will need to install required dependencies for Odoo.

You can install all this dependencies by running the following command:

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

Once all the dependencies are installed, you can proceed to the next step.

Installing and Configure PostgreSQL

You will also need to install PostgreSQL for database purposes. You can install it by running the following command:

sudo apt-get install postgresql

Once postgresql is installed, log into PostgreSQL shell with the following command:

su - postgres

Next, you will need to create a role for Odoo, so Odoo can access to the PostgreSQL server and to create, delete or modify the database. You can do this with the following command:

createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo

Enter a password as you wish when prompted.

Next, run following command to log out from the PostgreSQL shell.

exit

Installing and Configuring Odoo

Before starting, you will need to create a user and home directory for Odoo. You can do this with the following command:

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

Next, you will also need to create a directory for Odoo:

sudo mkdir -p /var/lib/odoo

By default Odoo is not available in the Ubuntu repository. So first you will need to add the Odoo apt repository to your repository database.

First, add the Odoo key by running the following command:

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

Then add the Odoo repository by editing /etc/apt/sources.list file:

sudo nano /etc/apt/sources.list

Add the following line:

deb http://nightly.odoo.com/8.0/nightly/deb/ ./

Next, update the Ubuntu repository database with the following command:

sudo apt-get update -y

Once you are done, install Odoo with the following command:

sudo apt-get install odoo

Once installation is completed, Odoo will running on port 8069 .

Next, you will need to configure Odoo. You can do this by editing /etc/odoo/openerp-server.conf file:

sudo nano /etc/odoo/openerp-server.conf

Add the following lines:

xmlrpc_interface = 127.0.0.1 xmlrpc_port = 8069

Save and close the file when you are done.

#Installing and Configuring Nginx for Odoo

Here, we will use Nginx as a reverse proxy for Odoo.

First, install Nginx with the following command:

sudo apt-get install nginx

Next, start the nginx service and enable it to start at boot time:

sudo systemctl start nginx

sudo update-rc.d nginx defaults

Next, you will need to create a virtual host directive for Nginx.

sudo nano /etc/nginx/sites-available/odoo

Add the following lines:

upstream odooerp { server 127.0.0.1:8069; } ## https site## server { listen 443 default_server; server_name example.com; 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 example.com; # Strict Transport Security add_header Strict-Transport-Security max-age=2592000; rewrite ^/.*$ https://$host$request_uri? permanent; }

Save and close the file when you are done.

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

First, create the SSL directory:

sudo mkdir -p /etc/nginx/ssl

cd /etc/nginx/ssl

Next, generate a new self-signed certificate file with the following command:

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

Next, give proper permission to the file:

sudo chmod 600 odoo.key

Next, enable Odoo virtual host with the following command:

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

Then, check Nginx configuration for syntax error with the following command:

sudo nginx -t

Next, restart Nginx with the following command:

sudo systemctl restart nginx

Access Odoo Web Installation Wizard

Once everything is up to date, it's time to finish Odoo installation using Web console.

Open your favourite web browser and type the URL https://your-server-ip, You should see the following database configuration page:

HP_NO_IMG/data/uploads/users/7ecb43a5-b365-4ebf-93d5-f3b632f29f33/1749058472.png" alt="" />

Provide all the required information like database name, master password then click on Create Database button. Once installation is completed, you should see the following Odoo dashboard:

HP_NO_IMG/data/uploads/users/7ecb43a5-b365-4ebf-93d5-f3b632f29f33/248879912.png" alt="" />

Conclusion

Congratulations! you have successfully installed Odoo on Ubuntu 16.04 server. I hope you can now easily host your own ERP application on your server.