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

How to Install Odoo 14 ERP Software on Ubuntu 20.04

Odoo (formerly known as OpenERP) is a self-hosted suite of over 10,000 open source applications suited for a variety of business needs including CRM, eCommerce, accounting, inventory, project management and point of sale. These applications are fully integrated and accessed through a common web interface.

In this tutorial, we will learn to install Odoo 14 Stack on a Ubuntu 20.04 based server.


  1. A Ubuntu 20.04 based server with a minimum of 2GB RAM to host Odoo Stack.

  2. A second Ubuntu 20.04 based server with a minimum of 2GB RAM for hosting the PostgreSQL database. You can however install the database on the same server as Odoo but for production environments, it is highly recommended that you install it on a separate server. You can also choose any of the managed database options available from any provider of your choice.

  3. RAM requirement will depend on the number of concurrent users that will be using the stack. A detailed guide on how to calculate system requirements can be found in Odoo's documentation.

  4. Keep your systems updated.

    $ sudo apt update
    $ sudo apt upgrade
  5. A non-root user with sudo privileges on both servers.

Configure Firewall rules

For the purpose of this tutorial, we will assume you have ufw firewall installed on both the servers.

On Odoo server, we will need ports 22, 80, 443, 6010, 5432 and 8069 to be open. 22 is used for SSH, 80 is for HTTP, 443 is for HTTPS, 6010 is used for Odoo communication, 5432 is used by PostgreSQL and 8069 is used by Odoo server application.

Run the following commands to open the required ports on Odoo server.

$ sudo ufw allow "OpenSSH"
$ sudo ufw allow 80,443,6010,5432,8069,8072/tcp
$ sudo ufw allow 80/tcp
$ sudo ufw allow 443/tcp
$ sudo ufw allow 6010/tcp
$ sudo ufw allow 5432/tcp
$ sudo ufw allow 8069/tcp
$ sudo ufw allow 8072/tcp

On the PostgreSQL server, we need to open ports 22, 6010 and 5432. Open them using the commands we just discussed.

Assign Hostnames

You can either use the IP addresses of the servers or use their Fully Qualified Domain Names (FQDN), if available. For our tutorial, we will be using FQDNs and for that, we need to set hostnames on both servers.

On the Odoo server, open the /etc/hosts file.

$ sudo nano /etc/hosts

Make sure, it looks like the following. 	localhost		odoo	postgresql

On the PostgreSQL server, open the file and make sure it looks like the following. 	localhost	postgresql		odoo

Press Ctrl + X to close the editor and press Y when prompted to save the file.

Install and Configure PostgreSQL

Ubuntu 20.04 ships with PostgreSQL 12 by default and we will install that. Run the following command on the PostgreSQL server.

$ sudo apt install postgresql-12 postgresql-server-dev-12

Next, we need to create a database user odoo.

$ sudo -u postgres createuser odoo -U postgres -dP

The option -u executes the command as postgres user.

The option -U indicate the user name to connect as.

The option -d grants the user permission to create databases.

The option -p prompts for the new user's password.

Configure Host-Based Authentication

We need to give permission to the PostgreSQL service to be able to connect to the Odoo server.

First, stop the PostgreSQL service.

$ sudo systemctl stop postgresql

Open the file /etc/postgresql/12/main/pg_hba.conf for editing.

$ sudo nano /etc/postgresql/12/main/pg_hba.conf

Paste the following line at the end.

host		all		odoo		md5

This line grants permission to the odoo user to connect to all the databases within this server. You can specify the name of the databases too instead of using all keyword.

Press Ctrl + X to close the editor and press Y when prompted to save the file.

Configure PostgreSQL Listening address

Next, we need to allow the database server to listen to remote connections. Open the file /etc/postgresql/12/main/postgresql.conf for editing.

$ sudo nano /etc/postgresql/12/main/postgresql.conf

Change the line listen_addresses from

#listen_addresses = 'localhost' # what IP address(es) to listen on;


listen_addresses = '*'

The * means it will listen to all the IP addresses. You can change it to the IP address of your odoo instance.

Press Ctrl + X to close the editor and press Y when prompted to save the file.

Enable and Start PostgreSQL service

Since our configuration is finished, it is time to start and enable the PostgreSQL service.

$ sudo systemctl start postgresql && sudo systemctl enable postgresql

Install Odoo

Install dependencies and Prepare for installation

Create a new system user for managing the Odoo processes on the Odoo server.

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

We need to install some system dependencies but first, we need to enable source repositories. To do that, backup the original sources list and then enable all the source repositories and update the repository list.

$ sudo cp /etc/apt/sources.list /etc/apt/sources.list~
$ sudo sed -Ei 's/^# deb-src /deb-src /' /etc/apt/sources.list
$ sudo apt update

Install system dependencies required for Odoo 14 set up.

 $ sudo apt install python3-pip python3-suds python3-all-dev python3-venv python3-dev python3-setuptools python3-tk libxml2-dev libxslt1-dev libevent-dev libsasl2-dev libldap2-dev pkg-config libtiff5-dev libjpeg8-dev libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev liblcms2-utils libwebp-dev tcl8.6-dev tk8.6-dev libyaml-dev fontconfig xfonts-75dpi xfonts-base xfonts-encodings xfonts-utils libpq-dev
$ sudo apt build-dep lxml

Install Nodejs.

$ sudo curl -sL | sudo -E bash -
$ sudo apt install nodejs

Install Less CSS package using Node.

$ sudo npm install -g less less-plugin-clean-css

Download wkhtmltopdf version 0.12.6 package.

$ cd /tmp
$ wget

Install the package.

$ sudo dpkg -i wkhtmltox_0.12.6-1.focal_amd64.deb

To ensure that wkhtmltopdf functions correctly, copy the binaries to /usr/bin and give them proper permissions.

$ sudo cp /usr/local/bin/wkhtmlto* /usr/bin/
$ sudo chmod a+x /usr/bin/wk*
$ cd ~

Download Odoo Files

Clone Odoo's Github repository on to your system.

$ sudo git clone --depth 1 --branch 14.0 --single-branch /opt/odoo

For our purpose, we are copying Odoo to the /opt/odoo directory from where it will be installed.

Set up Virtualenv Python Environment

This step is optional but is recommended since a virtual python environment for Odoo will help in avoiding conflicts with Python modules of the Operating system, especially when performing OS upgrades.

For this, we will use virtualenv.

  1. Create a new virtualenv environment for Odoo.

    $ python3 -m venv /home/<username>/odoo-env
  2. Activate the virtual environment. We are creating an environment under the system user's home directory. You are free to choose any location you like.

    $ source /home/<username>/odoo-env/bin/activate
  3. Update PIP just in case.

    (odoo-env) $ pip3 install --upgrade pip
  4. Install Python's wheel in the virtual environment.

    $ pip3 install wheel

Install Python Dependencies

Install the Python dependencies required by Odoo 14.

$ pip3 install -r /opt/odoo/doc/requirements.txt
$ pip3 install -r /opt/odoo/requirements.txt

The requirements will take some time to install so be patient.

Check whether the requirements are installed correctly by checking the list of installed Python modules.

$ pip3 list
Package                       Version
----------------------------- ---------
alabaster                     0.7.12
appdirs                       1.4.4
attrs                         20.3.0
Babel                         2.6.0
beautifulsoup4                4.9.3
cached-property               1.5.2
certifi                       2020.12.5
chardet                       3.0.4
decorator                     4.3.0
defusedxml                    0.7.1
docutils                      0.14
ebaysdk                       2.1.5
feedparser                    5.2.1
freezegun                     0.3.15
gevent                        20.9.0
greenlet                      0.4.17
html2text                     2018.1.9
idna                          2.6
imagesize                     1.2.0
isodate                       0.6.0
Jinja2                        2.11.2
libsass                       0.17.0
lxml                          4.6.1
Mako                          1.0.7
MarkupSafe                    1.1.0
num2words                     0.5.6
ofxparse                      0.19
packaging                     20.9
passlib                       1.7.1
Pillow                        8.0.1
pip                           21.0.1
pkg-resources                 0.0.0
polib                         1.1.0
psutil                        5.6.6
psycopg2                      2.8.5
pyasn1                        0.4.8
pyasn1-modules                0.2.8
pydot                         1.4.1
Pygments                      2.8.1
pyparsing                     2.4.7
PyPDF2                        1.26.0
pyserial                      3.4
python-dateutil               2.7.3
python-ldap                   3.1.0
python-stdnum                 1.8
pytz                          2019.1
pyusb                         1.0.2
qrcode                        6.1
reportlab                     3.5.55
requests                      2.21.0
requests-toolbelt             0.9.1
setuptools                    44.0.0
six                           1.15.0
snowballstemmer               2.1.0
soupsieve                     2.2
Sphinx                        3.5.2
sphinx-patchqueue             1.0.4
sphinxcontrib-applehelp       1.0.2
sphinxcontrib-devhelp         1.0.2
sphinxcontrib-htmlhelp        1.0.3
sphinxcontrib-jsmath          1.0.1
sphinxcontrib-qthelp          1.0.3
sphinxcontrib-serializinghtml 1.1.4
unidiff                       0.6.0
urllib3                       1.24.3
Werkzeug                      0.16.1
wheel                         0.36.2
xlrd                          1.2.0
XlsxWriter                    1.1.2
xlwt                          1.3.0
zeep                          3.2.0
zope.event                    4.5.0
zope.interface                5.2.0

Exit the Python virtual environment.

$ deactivate

Configure Odoo

Copy the default Odoo configuration file to create a new one.

$ sudo cp /opt/odoo/debian/odoo.conf /etc/odoo-server.conf

Open the file for editing.

$ sudo nano /etc/odoo-server.conf

Edit the file so that it looks like the following.

; This is the password that allows database operations:
admin_passwd = admin
db_host =
db_port = False
db_user = odoo
db_password = odoo_password
addons_path = /opt/odoo/addons
xmlrpc_port = 8069

Press Ctrl + X to close the editor and press Y when prompted to save the file.

The option admin_passwd is the password that allows administrative operations within the Odoo GUI. Be sure to choose a secure password.

The option db_host is the FQDN or the IP address of the PostgreSQL server.

The option db_port is set to false since the default PostgreSQL port 5432 is being used. If you want to use a different port, you will need to update this value.

The option db_user is the name of the PostgreSQL user.

The option db_password is the PostgreSQL 'odoo' user password we created previously on the PostgreSQL server.

The option addons_path is the default Addons path. You can also add a custom path for Addons separating them with commas.

The option xmlrpc_port is the port which Odoo listens on.

Create Odoo service

To make sure Odoo keeps running even after a system restart, we need to create a service for it.

Create a file /lib/systemd/system/odoo-server.service and open it for editing.

$ sudo nano /lib/systemd/system/odoo-server.service

Paste the following code in it.

Description=Odoo Open Source ERP and CRM

ExecStart=/home/<username>/odoo-env/bin/python3 /opt/odoo/odoo-bin --config=/etc/odoo-server.conf --addons-path=/opt/odoo/addons/


Replace /home/<username> with the location you chose for installing Python Virtual Environment.

Press Ctrl + X to close the editor and press Y when prompted to save the file.

Set File permissions

Set permissions on the odoo-server.service file so that only Odoo user can read or execute it.

$ sudo chmod 755 /lib/systemd/system/odoo-server.service
$ sudo chown odoo: /lib/systemd/system/odoo-server.service

Set the ownership on the Python environment and the Odoo installation directory.

$ sudo chown -R odoo: /opt/odoo/
$ sudo chown -R odoo: /home/<username>/odoo-env

Restrict the Odoo configuration file.

$ sudo chown odoo: /etc/odoo-server.conf
$ sudo chmod 640 /etc/odoo-server.conf

Start the Odoo server

Start and enable the Odoo server.

$ sudo systemctl start odoo-server
$ sudo systemctl enable odoo-server

Check the status of the server.

$ sudo systemctl status odoo-server

In your browser, open the URL http://<yourIPaddress>:8069 or If everything is working properly, you should see Odoo's database creation screen.

Odoo Install Screen

Fill in all the fields. Check the Demo Data field to populate the database with sample data and then click the Create database button.

Next, you will be shown a list of apps that you can choose and select.

The first time you create a database, the addons page will take time to load so don't refresh the page.

Install and Configure Nginx

Until now, we have been using Odoo's server to run the stack. But ideally, it's better to run it on Nginx using a proxy because that will allow us to install SSL on it.

Install Nginx.

$ sudo apt install nginx

To run it via Nginx, we need to run Odoo on localhost. To change that, stop the Odoo service.

$ sudo systemctl stop odoo-server

Open the Odoo server configuration file.

$ sudo nano /etc/odoo-server.conf

Add the following lines to it.

xmlrpc_interface =
proxy_mode = True

Create an Nginx configuration file for Odoo.

$ sudo nano /etc/nginx/sites-available/odoo.conf

Paste the code below.

#odoo server
upstream odoo {
upstream odoochat {

# http -> https
server {
   listen 80;
   rewrite ^(.*) https://$host$1 permanent;

server {
 listen 443 ssl http2;
 proxy_read_timeout 720s;
 proxy_connect_timeout 720s;
 proxy_send_timeout 720s;

 # Add Headers for odoo proxy mode
 proxy_set_header X-Forwarded-Host $host;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_set_header X-Forwarded-Proto $scheme;
 proxy_set_header X-Real-IP $remote_addr;

 # SSL parameters
 ssl_certificate /etc/letsencrypt/live/;
 ssl_certificate_key /etc/letsencrypt/live/;
 ssl_session_timeout 1d;
 ssl_session_cache shared:MozSSL:10m;  # about 40000 sessions
 ssl_session_tickets off;
 ssl_protocols TLSv1.2 TLSv1.3;
 ssl_prefer_server_ciphers off;
 ssl_dhparam /etc/ssl/certs/dhparam.pem;

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

 # Redirect longpoll requests to odoo longpolling port
 location /longpolling {
 proxy_pass http://odoochat;

 # Redirect requests to odoo backend server
 location / {
   proxy_redirect off;
   proxy_pass http://odoo;

 # common gzip
 gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;
 gzip on;

Press Ctrl + X to close the editor and press Y when prompted to save the file.

Activate this configuration file by linking it to the sites-enabled directory.

$ sudo ln -s /etc/nginx/sites-available/odoo.conf /etc/nginx/sites-enabled/

Test the Nginx configuration.

$ sudo nginx -t

Install SSL

We will install SSL using Let's Encrypt service.

For that, install Certbot.

$ sudo apt install certbot

Stop Nginx because it will interfere with the Certbot process.

$ sudo systemctl stop nginx

Generate the certificate. We also need to create a DHParams certificate.

$ sudo certbot certonly --standalone -d --preferred-challenges http --agree-tos -n -m [email protected] --keep-until-expiring 
$ sudo systemctl start nginx
$ sudo openssl dhparam -out /etc/ssl/certs/dhparam.pem 2048

We also need to set up a cron job for renewing the SSL automatically. To open the crontab editor, run the following command.

$ sudo crontab -e

Paste the following line at the bottom.

25 2 * * * /usr/bin/certbot renew --quiet --pre-hook “systemctl stop nginx” --post-hook “systemctl start nginx”

The above cron job will run certbot at 2:25 am every day. You can change it to anything you want.

Save the file by pressing Ctrl + X and entering Y when prompted.

Start Odoo

Now that everything is set up, we can start the Odoo server again.

$ sudo systemctl start odoo-server

Launch Odoo in your browser via You will get a screen described earlier. Enter the required details to create the database and you should log in to the Odoo and see a screen like this.

Odoo Home Page


This concludes our tutorial on installing Odoo on Ubuntu 20.04 server. If you have any questions, post them in the comments below.

Share this page:

4 Comment(s)