Deploy Odoo 11 in Ubuntu 14.04

AbstractOdoo 11 provied solutions to deploy application to Ubuntu Server. But when we install to Ubuntu, we still happened issue about Ubuntu version. And packages of Python sometime conflict together. This is article help deploy Odoo 11 in Ubuntu 14.04 base on my experience when deploy Sems

You can install by 4 solutions: Online, Packaged Insaller, Source Install and Dockers. But in this article we use source install to install Odoo 11 in Ubuntu 14.04.

1 Install Python

1.1 Update system sourcelist

sudo apt-get update

1.2 Upgrade system

sudo apt-get upgrade
sudo apt-get –y upgrade

with –y help auto install dependency package.

1.3 Install Python for Odoo 11

sudo apt-get install python3-pip

Install dependency base on pip3

sudo pip3 install Babel decorator docutils ebaysdk feedparser gevent \n
 greenlet html2text Jinja2 lxml Mako MarkupSafe mock num2words ofxparse \n
 sudo passlib Pillow psutil psycogreen psycopg2 pydot pyparsing PyPDF2 \n
 pyserial python-dateutil python-openid pytz pyusb PyYAML qrcode \n
 reportlab requests six suds-jurko vatnumber vobject Werkzeug XlsxWriter \n
 xlwt xlrd

But if pip version isn’t compatible with packages, we can have exceptions in installing. We need try update setuptools.

pip3 install –U setuptools

Bug1: Sometime we have error:
Error: Unable to find ‘pg_config’ file in ‘/usr/pgsql-9.1/bin/’
We need istall postgresql_devel by libpq-dev.

sudo apt-get install libpq-dev

Bug 2: Some we have error about xml:

sudo apt-get install libxml2-dev libxslt1-dev

Bug 3: Sometime we have need error about install Pillow

For Ubuntu 14.04 we need install packages before install Pillow (if you use other Ubuntu version refer to Pillow)

sudo apt-get install libtiff5-dev libjpeg8-dev zlib1g-dev libfreetype6-dev \n 
 liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-devtcl8.6-dev \n
 tk8.6-dev python-tk

Install Pillow now:

pip3 install Pillow

1.4 Install NPM and NodeJS

Those modules help compress CSS, JS in Odoo 11.

sudo apt-get install –y npm
sudo ln –s /usr/bin/nodejs /usr/bin/node
sudo npm install -g less@3.0.4 less-plugin-clean-css
sudo npm install node-less

with less@3.0.4 is version of less in Ubuntu 14.04 can work to compress JS/CSS.
If we occure error when install less or less-plugin-clean-css. We need disable check SSL when try install less.

npm config set strict-ssl false

1.1 Install library for SFTP

Install paramiko when we use auto-backup data in Odoo 11.

sudo apt-get install libffi-dev -y
sudo pip3 install paramiko

2 Install PostgreSQL 9.6+

2.1 Install PostgreSQL

Install python software properties.

sudo apt-get install python-software-properties

Then create postgres package link in source list by command line.

sudo nano /etc/apt/sources.list.d/pgdg.list

Add line to repository

deb trusty-pgdg main

Now we need run command line bellow to download security key from PostgreSQL. And update source list in Ubuntu.

wget --quiet -O - | sudo apt-key add –
sudo apt-get update
sudo apt-get install postgresql-9.6
sudo service postgresql start

In this article, we use postgresql version 9.6. Currently we only allow user postgres of Ubuntu can start/ stop/ restart service.

2.2 Create user database for Odoo

We need start PostgreSQL before. Use code block to create user odoo.

sudo service postgresql start
sudo su – postgres
createuser -–createdb –-username postgres –-no-createrole –-no-superuser –-pwprompt odoo

To help our system increase security. We need change password of account odoo.

sudo su – postgres psql
\password odoo

Create odoo group and user for folder that prepare to donwnload Odoo 11 code.

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

3 Install Gdata

Gdata (Google Data Protocal) provides simple protocal to reading and writing data on the Internet, by Google. It combines common XML-based syndication format (Atom and RSS). We need run block code below.

cd /opt/odoo
sudo wget\n
sudo tar zxvf gdata-2.0.18.tar.gz
sudo chown -R odoo: gdata-2.0.18
sudo -s
cd gdata-2.0.18
python install

4 Download or clone Odoo 11 from Github

We choose download code from Github or clone by git from Github to install Odoo 11. Download code Odoo 11 from Or install git in Ubuntu then clone code by block code below.

cd /opt/odoo
sudo apt-get install git
sudo su - odoo -s /bin/bash
sudo git clone --depth=1 --branch 11.0 --single-branch

5 Configuration Odoo 11

5.1 Configurate for Logging

sudo mkdir /var/log/odoo
sudo chown -R odoo:root /var/log/odoo

5.2 Configurate for Running

sudo nano /etc/odoo.conf

And past this code to file.

; This is the password that allows database operations:
; admin_passwd = admin
db_host = False
db_port = False
db_user = odoo
db_password = odoo
logfile = /var/log/odoo/odoo-server.log

Change permission of /etc/odoo-conf.

sudo chown odoo: /etc/odoo.conf

6 Install PDF report

Odoo use WKHTMLTOPDF to render PDF file in report process.

sudo wget\n
sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb
sudo cp /usr/local/bin/wkhtmltoimage /usr/bin/wkhtmltoimage
sudo cp /usr/local/bin/wkhtmltopdf /usr/bin/wkhtmltopdf

7 Start Odoo 11 manually

cd /opt/odoo/odoo

And run URL http://localhost:8069 to enjoy your archievement.

8 Run Odoo 11 automatic

Run Odoo 11 manually many inconveniences. So we need try start Odoo 11 when start/ restart Ubuntu. Service is a best tool to resolve those inconvenienes. Now we start create boot script.

Create service in /etc/systemd/system with name is odoo.service. And with .service is required.
sudo nano /etc/systemd/system/odoo11.service
And past this content to odoo11.service.

Requires=postgresql.service postgresql.service

ExecStart=/usr/bin/python3 /opt/odoo/odoo11/odoo-bin -c /etc/odoo11.conf 


Then need execute below code to load service to system.

sudo systemctl daemon-reload
sudo systemctl start odoo11

We can check current status of service by:

sudo systemctl status odoo11

And enable service automatic start when boot system.

sudo systemctl enable odoo11

Optional: If we need show message logged by Odoo, we need use this command.

sudo journalctl -u odoo11

9 Use Nginx as proxy

Default http port of Odoo is 8069. We can change this port and re-start Odoo but we shouldn’t do that. Because your server may be host other service as website with port default is 80. So we need use nginx as proxy.

Install nginx in Ubuntu and enable it in system.

sudo apt-get install nginx –y
systemctl enable nginx

Create a virtual host to nginx /etc/nginx/sites-available/

sudo nano /etc/nginx/sites-available/

And past this content:

upstream oddo {

server {
    listen      80 default;

    access_log  /var/log/nginx/;
    error_log   /var/log/nginx/;

    proxy_buffers 16 64k;
    proxy_buffer_size 128k;

    location / {
        proxy_pass  http://oddo;
        proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
        proxy_redirect off;

        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;

    location ~* /web/static/ {
        proxy_cache_valid 200 60m;
        proxy_buffering on;
        expires 864000;
        proxy_pass http://oddo;

Next step, we need create symbolic link of and restart nginx.

ln -s /etc/nginx/sites-available/ /etc/nginx/sites-enabled/
systemctl restart nginx

Final it should work now. Done.

Trả lời

Email của bạn sẽ không được hiển thị công khai. Các trường bắt buộc được đánh dấu *