In today’s blog post, we’ll discuss how one can install Odoo 13 on Ubuntu 20.04/18.04 Linux system. Odoo is the most trusted suite of web based open source business applications that can help you drive the business in the right direction. Odoo gives you access to critical business applications, all managed from a single console.

A range of business applications available on Odoo includes Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, Purchase Management, among others.

A good point to note is that Odoo Apps can be used as stand-alone applications, but they also integrate seamlessly so you get a full-featured Open Source ERP when you install several Apps.

For CentOS 7, check: How To Install Odoo 13 on CentOS 7

Install Odoo on Ubuntu 20.04/18.04 Linux

The next sections will cover the steps for installing Odoo 13 on Ubuntu 20.04/18.04 Linux. We will begin with the standard OS updates, then into dependency package installations. We won’t build Odoo manually since Odoo 13 ‘deb’ packages are available for Ubuntu.

Step 1: Update Ubuntu system

Start by updating your Ubuntu Linux.

sudo apt update
sudo apt -y upgrade

A reboot is necessary after an upgrade.

sudo reboot

Step 2: Install PostgreSQL Database

Odoo recommends using PostgreSQL database server for data storage, install PostgreSQL database server on Ubuntu:

Installing PostgreSQL 12 on Ubuntu

To install the default version available in Ubuntu repositories. run:

sudo apt install postgresql postgresql-client

Step 3: Install wkhtmltopdf

wkhtmltopdf is required for printing reports as it does the conversion of html to pdf. The version of wkhtmltopdf available in Ubuntu repositories does not support headers and footers so it is not used as a direct dependency.

The recommended version of wkhtmltopdf to install is 0.12.5 and is available on the wkhtmltopdf download page, in the archive section.

Install wkhtmltopdf & wkhtmltoimage on Ubuntu / Linux

Step 4: Install Odoo 13 on Ubuntu 20.04/18.04 LTS

Add Odoo deb repository so that you can install Odoo 13 on Ubuntu 18.04.

wget -O - https://nightly.odoo.com/odoo.key | sudo apt-key add -
echo "deb http://nightly.odoo.com/13.0/nightly/deb/ ./" | sudo tee /etc/apt/sources.list.d/odoo.list

Update Apt cache and install Odoo 13 on Ubuntu 18.04.

sudo apt update
sudo apt install odoo

The service is started automatically after the installation of Odoo on Ubuntu 18.04 Linux.

$ systemctl status odoo ● odoo.service - Odoo Open Source ERP and CRM Loaded: loaded (/lib/systemd/system/odoo.service; enabled; vendor preset: enabled) Active: active (running) since Sun 2020-05-03 20:09:17 UTC; 33s ago Main PID: 9181 (odoo) Tasks: 4 (limit: 2344) Memory: 69.9M CGroup: /system.slice/odoo.service └─9181 /usr/bin/python3 /usr/bin/odoo --config /etc/odoo/odoo.conf --logfile /var/log/odoo/odoo-server.log May 03 20:09:17 ubuntu20 systemd[1]: Started Odoo Open Source ERP and CRM.

Set the service to start on every system reboot.

$ sudo systemctl enable --now odoo enabled

The service is started on port 8069. This can be confirmed using the command below.

$ ss -tunelp | grep 8069 tcp LISTEN 0 128 0.0.0.0:8069 0.0.0.0:* uid:113 ino:1906251 sk:d <-> 

Step 5: Configure Nginx Proxy for Odoo 13

Install Nginx on your Ubuntu system,

sudo apt -y install nginx vim

There are two scenarios for Nginx proxy configuration – With HTTPS and when traffic is not served over secure connection. In this section, we’ll consider both setups.

Setup Nginx HTTP proxy for Odoo

Create a new configuration file for odoo.

sudo vim /etc/nginx/conf.d/odoo.conf

Modify this configuration snippet to fit your setup.

# Odoo Upstreams
upstream odooserver {
 server 127.0.0.1:8069;
}

server {
    listen 80;
    server_name erp.computingforgeeks.com;
    access_log /var/log/nginx/odoo_access.log;
    error_log /var/log/nginx/odoo_error.log;


    # Proxy settings
    proxy_read_timeout 720s;
    proxy_connect_timeout 720s;
    proxy_send_timeout 720s;
    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;

    # Request for root domain
    location / {
       proxy_redirect off;
       proxy_pass http://odooserver;
    }

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

    # Gzip
    gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
    gzip on;
}

My service domain in this example is erp.computingforgeeks.com, replace it with your correct domain to be used with Odoo. A valid DNS record is required for external access as well.

Check your configuration syntax:

$ sudo nginx -t nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful

If the settings are deemed ok, restart nginx service.

sudo systemctl restart nginx

No error should be encountered on restart.

$ systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
   Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2019-10-19 17:34:39 UTC; 5s ago
     Docs: man:nginx(8)
  Process: 626 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
  Process: 615 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
 Main PID: 631 (nginx)
    Tasks: 2 (limit: 2362)
   CGroup: /system.slice/nginx.service
           ├─631 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
           └─632 nginx: worker process
....

Using Let’s Encrypt SSL Certificate for Odoo on Nginx

It is always recommended to use SSL encryption for production deployments. Let’s Encrypt is a free SSL offering that you can use in your Setup.

Get Let’s Encrypt SSL certificates for your domain.

wget https://dl.eff.org/certbot-auto
chmod +x certbot-auto
sudo mv certbot-auto /usr/local/bin/certbot-auto
sudo systemctl stop nginx

export DOMAIN="erp.computingforgeeks.com"
export EMAIL="myemail@computingforgeeks.com"
sudo /usr/local/bin/certbot-auto certonly --standalone -d ${DOMAIN} --preferred-challenges http --agree-tos -n -m ${EMAIL} --keep-until-expiring

If the execution went through, paths to the certificate and chain files will be printed out.

IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at: /etc/letsencrypt/live/erp.computingforgeeks.com/fullchain.pem Your key file has been saved at: /etc/letsencrypt/live/erp.computingforgeeks.com/privkey.pem Your cert will expire on 2020-01-17. To obtain a new or tweaked version of this certificate in the future, simply run certbot-auto again. To non-interactively renew *all* of your certificates, run "certbot-auto renew" - Your account credentials have been saved in your Certbot configuration directory at /etc/letsencrypt. You should make a secure backup of this folder now. This configuration directory will also contain certificates and private keys obtained by Certbot so making regular backups of this folder is ideal. - If you like Certbot, please consider supporting our work by: Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate Donating to EFF: https://eff.org/donate-le

Create cron to renew certificate.

$ sudo crontab -e
15 3 * * * /usr/local/bin/certbot-auto renew --pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx"

Create Nginx configuration file.

sudo vim /etc/nginx/conf.d/odoo.conf

Modify below and add to file.

# Odoo Upstreams
upstream odooserver {
 server 127.0.0.1:8069;
}

# http to https redirection
server {
    listen 80;
    server_name erp.computingforgeeks.com;
    return 301 https://erp.computingforgeeks.com$request_uri;
}

server {
    listen 443 ssl;
    server_name erp.computingforgeeks.com;
    access_log /var/log/nginx/odoo_access.log;
    error_log /var/log/nginx/odoo_error.log;
   
   # SSL
    ssl_certificate /etc/letsencrypt/live/erp.computingforgeeks.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/erp.computingforgeeks.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/erp.computingforgeeks.com/chain.pem;


    # Proxy settings
    proxy_read_timeout 720s;
    proxy_connect_timeout 720s;
    proxy_send_timeout 720s;
    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;

    # Request for root domain
    location / {
       proxy_redirect off;
       proxy_pass http://odooserver;
    }

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

    # Gzip Compression
    gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
    gzip on;
}

Don’t forget to substitute erp.computingforgeeks.com with your domain name.

Restart Nginx.

sudo systemctl restart nginx

Step 6: Access Odoo Web interface

Access Odoo Web page on your domain name from a web browser