How to install Odoo 15 on Ubuntu 20.04

s2 0

Odoo is a popular open source suite of business applications that help companies manage and run their business. It includes a wide range of applications such as CRM, eCommerce, website builder, invoicing, accounting, manufacturing, warehousing, project management, inventory and much more, all seamlessly integrated.

can be installed in different ways depending on the use case and available technologies. The easiest and fastest way to install Odoo is to use the official one Odoo APT

By installing Odoo in a virtual environment or deploying it as a Docker container, you have more control over the application and can run multiple Odoo instances on the same system.

This article covers installing and deploying Odoo 15 in a Python virtual environment on Ubuntu 20.04. We download Odoo from the official GitHub repository and use Nginx as a reverse proxy.

Install dependencies

The first step is to install Git , Pip , Node.js and development [tools required to build]( Odoo dependencies:

sudo apt updatesudo apt install git python3-pip build-essential wget python3-dev python3-venv     python3-wheel libfreetype6-dev libxml2-dev libzip-dev libldap2-dev libsasl2-dev     python3-setuptools node-less libjpeg-dev zlib1g-dev libpq-dev     libxslt1-dev libldap2-dev libtiff5-dev libjpeg8-dev libopenjp2-7-dev     liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev libxcb1-dev

Creating a system user

Running Odoo under the root user is a major security risk. We create a new system user and a new group with home directory /opt/odoo15 that will run the Odoo service. To do this, run the following command:

sudo useradd -m -d /opt/odoo15 -U -r -s /bin/bash odoo15

You can give the user any name as long as you create a PostgreSQL user with the same name.

Install and configure PostgreSQL

Odoo uses PostgreSQL as database backend. PostgreSQL is included in the standard Ubuntu repositories. The installation is uncomplicated:

sudo apt install postgresql

Once the service is installed, create a PostgreSQL user with the same name as the system user created earlier. In this example it is odoo15:

sudo su - postgres -c "createuser -s odoo15"

Installing wkhtmltopdf

wkhtmltopdf is a set of open source command line tools for rendering HTML pages to PDF and various image formats. To print PDF reports in Odoo you need to install the wkhtmltox Package.

The version of wkhtmltopdf included in the Ubuntu repositories does not support headers and footers. The recommended version for Odoo is version 0.12.5. We download and install the package from Github:

sudo wget

After the file has downloaded, install it by typing:

sudo apt install ./wkhtmltox_0.12.5-1.bionic_amd64.deb

Installation and configuration of Odoo 15

We install Odoo from source in an isolated Python virtual environment.

First, switch to the “odoo15” user:

sudo su - odoo15

Clone Odoo 15 source code from GitHub:

git clone --depth 1 --branch 15.0 /opt/odoo15/odoo

Create a new Python virtual environment for Odoo:

cd /opt/odoo15python3 -m venv odoo-venv

Activate the virtual environment:

source odoo-venv/bin/activate

Odoo dependencies are specified in requirements.txt file. Install all required Python modules using pip3:

pip3 install wheelpip3 install -r odoo/requirements.txt
If you encounter a compilation error during installation, make sure that all required dependencies are included in the Installing Prerequisites section are installed.

When you’re done, disable the environment by typing:


We create a new directory, a separate directory for the third-party addons:

mkdir /opt/odoo15/odoo-custom-addons

Later we will add this directory to the addons_path Parameter. This parameter defines a list of directories in which Odoo searches for modules.

Switch back to your sudo user:


Create a configuration file with the following content:

sudo nano /etc/odoo15.conf
; This is the password that allows database operations:
admin_passwd = my_admin_passwd
db_host = False
db_port = False
db_user = odoo15
db_password = False
addons_path = /opt/odoo15/odoo/addons,/opt/odoo15/odoo-custom-addons
Don’t forget to change those my_admin_passwd to something safer.

Creating a systemd unit file

A unit file is an INI-style configuration file that contains information about a service.

Open your text editor and create a file named odoo15.service with the following content:

sudo nano /etc/systemd/system/odoo15.service
Requires=postgresql.service postgresql.service

ExecStart=/opt/odoo15/odoo-venv/bin/python3 /opt/odoo15/odoo/odoo-bin -c /etc/odoo15.conf


Notify systemd that a new unit file exists:

sudo systemctl daemon-reload

Start the Odoo service and enable it to start on boot by running:

sudo systemctl enable --now odoo15

Make sure the service is running:

sudo systemctl status odoo15

The output should look something like this, showing that the Odoo service is up and running:

‚óŹ odoo15.service - Odoo15
     Loaded: loaded (/etc/systemd/system/odoo15.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2021-10-26 09:56:28 UTC; 28s ago

You can check the messages logged by the Odoo service with the following command:

sudo journalctl -u odoo15

Testing the installation

Open your browser and enter the following: https://<your_domain_or_IP_address>:8069

Assuming the installation is successful, you will see a screen similar to the following:

Configure Nginx as an SSL termination proxy

The default Odoo web server serves traffic over HTTP. To make Odoo deployment more secure, we will set Nginx as SSL termination proxy serving traffic over HTTPS.

SSL Termination Proxy is a proxy server that handles SSL encryption/decryption. This means that the termination proxy (Nginx) processes and decrypts incoming TLS connections (HTTPS) and forwards the requests to the internal service (Odoo) unencrypted. Traffic between Nginx and Odoo is not encrypted (HTTP).

Using a reverse proxy gives you many benefits like load balancing, SSL termination, caching, compression, static content delivery and more.

Make sure you have completed the following prerequisites before proceeding with this section:

  • Domain name pointing to your public server IP. We will use
  • Nginx installed.

  • SSL certificate for your domain. You can install a free SSL certificate from Let’s Encrypt.

Open your text editor and create/edit the domain server block:

sudo nano /etc/nginx/sites-enabled/

The following configuration sets up SSL termination, HTTP-to-HTTPS redirection, WWW-to-non-WWW redirection, saves the static files, and enables GZip compression.

# Odoo servers
upstream odoo {

upstream odoochat {

server {
    listen 80;

    include snippets/letsencrypt.conf;
    return 301$request_uri;

server {
    listen 443 ssl http2;

    ssl_certificate /etc/letsencrypt/live/;
    ssl_certificate_key /etc/letsencrypt/live/;
    ssl_trusted_certificate /etc/letsencrypt/live/;
    include snippets/ssl.conf;
    include snippets/letsencrypt.conf;

    return 301$request_uri;

server {
    listen 443 ssl http2;

    proxy_read_timeout 720s;
    proxy_connect_timeout 720s;
    proxy_send_timeout 720s;

    # Proxy headers
    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_trusted_certificate /etc/letsencrypt/live/;
    include snippets/ssl.conf;
    include snippets/letsencrypt.conf;

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

    # Handle longpoll requests
    location /longpolling {
        proxy_pass https://odoochat;

    # Handle / requests
    location / {
       proxy_redirect off;
       proxy_pass https://odoo;

    # Cache static files
    location ~* /web/static/ {
        proxy_cache_valid 200 90m;
        proxy_buffering on;
        expires 864000;
        proxy_pass https://odoo;

    # Gzip
    gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
    gzip on;
Don’t forget to replace with your Odoo domain and set the correct path to the SSL certificate files. The snippets used in this configuration are created in this guide.

When finished, restart the Nginx service:

sudo systemctl restart nginx

Next we need to tell Odoo to use the proxy. To do this, open the configuration file and add the following line:

proxy_mode = True

Restart the Odoo service for the changes to take effect:

sudo systemctl restart odoo15

At this point the reverse proxy is configured and you can access your Odoo instance at

Changing the binding interface

This step is optional, but is a security best practice.

By default the Odoo server listens on port 8069 on all interfaces. To disable direct access to the Odoo instance, you can either block the port 8069 for all public interfaces or force Odoo to only listen on the local interface.

We will configure Odoo to only listen Open the configuration and add the following two lines to the end of the file:

xmlrpc_interface =
netrpc_interface =

Save the configuration file and restart the Odoo server for the changes to take effect:

sudo systemctl restart odoo15

Enable multiprocessing

By default, Odoo works in multithreading mode. For production deployments, it is recommended to switch to the multiprocessing server as it increases stability and makes better use of system resources.

To enable multiprocessing you need to edit the Odoo configuration and set a non-zero number of worker processes. The number of workers is calculated based on the number of CPU cores in the system and the available RAM.

According to the official Odoo documentation
, to calculate the number of workers and the required amount of RAM memory, you can use the following formulas and assumptions:

Calculation of the number of workers

  • Theoretical maximum number of workers = (system_cpus * 2) + 1
  • 1 worker can serve ~= 6 concurrent users
  • Cron workers also require CPU

RAM memory size calculation

  • We assume that 20% of all requests are difficult and 80% are lighter requests. Heavy requirements use around 1GB of RAM while lighter ones use around 150MB of RAM
  • Memory required = number_of_workers * ( (light_worker_ratio * light_worker_ram_estimation) + (heavy_worker_ratio * heavy_worker_ram_estimation) )

If you don’t know how many CPUs your system has, use the following grep

grep -c ^processor /proc/cpuinfo

Suppose you have a system with 4 CPU cores, 8 GB RAM memory and 30 concurrent Odoo users.

  • 30 users / 6 = **5** (5 is the theoretical number of workers needed)
  • (4 * 2) + 1 = **9** (9 is the theoretical maximum number of workers)

Based on the above calculation, you can use 5 workers + 1 worker for the cron worker, for a total of 6 workers.

Calculate RAM memory usage based on number of workers:

  • RAM = 6 * ((0.8*150) + (0.2*1024)) ~= 2 GB of RAM

The calculation shows that the Odoo installation requires about 2 GB of RAM.

To switch to multiprocessing mode, open the configuration file and append the calculated values:

limit_memory_hard = 2684354560
limit_memory_soft = 2147483648
limit_request = 8192
limit_time_cpu = 600
limit_time_real = 1200
max_cron_threads = 1
workers = 5

Restart the Odoo service for the changes to take effect:

sudo systemctl restart odoo15

The remaining system resources are used by other services running on that system. In this guide, we installed Odoo along with PostgreSQL and Nginx on the same server. Depending on your setup, other services may also be running on your server.


This article explained how to install and configure Odoo 15 on Ubuntu 20.04 in a Python virtual environment with Nginx as reverse proxy. We also showed you how to enable multiprocessing and optimize Odoo for a production environment.

You might also want to read our tutorial on how to create automatic daily backups of Odoo databases.

If you have any questions, you can leave a comment below.