Oct 5, 2023 9 min read

How to Install Odoo 13 on Ubuntu 18.04

Install Odoo 13 on Ubuntu 18.04 with our step-by-step tutorial. It is a versatile and user-friendly open-source business management software.

Install Odoo 13 on Ubuntu 18.04
Table of Contents

Introduction

Before we begin talking about how to install Odoo 13 on Ubuntu 18.04, let’s briefly understand - What is Odoo?

Odoo 13 is a versatile and user-friendly open-source business management software. It offers a wide range of integrated applications, including accounting, inventory management, CRM, project management, and more. With its intuitive interface and modular structure, Odoo 13 allows businesses to streamline their operations, improve efficiency, and enhance productivity.

Its advanced features, such as customizable dashboards, automated workflows, and real-time reporting, empower organizations to make informed decisions. Whether you run a small business or a large enterprise, Odoo 13 provides a comprehensive solution to manage and optimize your business processes effectively.

In this tutorial, you will learn how to install Odoo 13 inside a Python virtual environment on Ubuntu 18.04. Odoo will be downloaded from its respective Github repository, and we will use Nginx as a reverse proxy.

Advantages of Odoo 13

  1. Versatile: Odoo 13 offers a wide range of integrated applications for various business needs.
  2. User-Friendly: Its intuitive interface makes it easy for users to navigate and operate the software.
  3. Scalable: Odoo 13 can accommodate businesses of all sizes, from small startups to large enterprises.
  4. Customizable: It allows users to tailor the software according to their specific requirements and preferences.
  5. Comprehensive: With its extensive features and modules, Odoo 13 provides a holistic solution for managing multiple business processes.

Installing Prerequisites

1) Login to Ubuntu, as a sudo user, and following that you have to update the Apt cache:

sudo apt update

2) Then you need to install Git, Pip, Node.js, and other necessary tools for building Odoo dependencies:

sudo apt install git python3-pip build-essential wget python3-dev python3-venv python3-wheel libxslt-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools node-less

Step 1 - Creating a System User

1) Set up a system user on which Odoo will operate, keep its name as odoo13 with the home directory /opt/odoo13.

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

2) You may use any name you prefer, but you also have to create the PostgreSQL user with the same name.

Step 2 - Installing and Configuring PostgreSQL

1) Odoo utilizes PostgreSQL for database back-end. To install PostgreSQL execute this command:

sudo apt install postgresql

2) After the completion of the installation, set up a PostgreSQL user which must have the same name as the system user created earlier, in this example the user name is odoo13:

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

Step 3 - Installing Wkhtmltopdf

1) The wkhtmltox package has a series of open-source command-line tools that render HTML files into PDF files and other image formats. For printing PDF reports, install the wkhtmltopdf tool. We recommended Odoo 0.12.5 version but it is not accessible through default Ubuntu 18.04 repositories.

2) Download the package by executing this wget command:

wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb

3) After completion of the installation, install the package by running this command:

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

Step 4 - Installing and Configuring Odoo 13

As previously stated, we need to install Odoo inside an isolated Python virtual environment.

1) The first step is to change to user "odoo13" or whichever username you are using:

sudo su - odoo13

2) After that, you have to clone the Odoo 13 source code using GitHub:

git clone https://www.github.com/odoo/odoo --depth 1 --branch 13.0 /opt/odoo13/odoo

3) After the download is complete, set up a new Python virtual environment for Odoo.

cd /opt/odoo13
python3 -m venv odoo-venv

4) Then you need to initiate the environment using the following command:

source odoo-venv/bin/activate

5) The next step is to install all required Python modules using pip3 command:

pip3 install wheel
pip3 install -r odoo/requirements.txt

6) In case you face any compilation error during the process of installation, ensure that all prerequisite dependencies listed in the Installing Prerequisites section are installed beforehand.

7) After that, deactivate the environment using:

deactivate

8) Then you will create a new directory that would hold all 3rd party addons.

mkdir /opt/odoo13/odoo-custom-addons

9) Later on, you will add this directory to the addons_path parameter. This parameter defines a list of directories where modules will be searched by Odoo.

10) Then go back to your sudo user.

exit

11) Set up a configuration file using:

[options]
; This is the password that allows database operations:
admin_passwd = my_admin_passwd
db_host = False
db_port = False
db_user = odoo13
db_password = False
addons_path = /opt/odoo13/odoo/addons,/opt/odoo13/odoo-custom-addons
💡
It is very important to change the my_admin_passwd to something that is more secure.

Step 5 - Creating a Systemd Unit File

1) Open whichever text editor you have and set up a service unit file titled odoo13.service.

sudo nano /etc/systemd/system/odoo13.service

2) Add the following content in the newly created file:

[Unit]
Description=Odoo13
Requires=postgresql.service
After=network.target postgresql.service

[Service]
Type=simple
SyslogIdentifier=odoo13
PermissionsStartOnly=true
User=odoo13
Group=odoo13
ExecStart=/opt/odoo13/odoo-venv/bin/python3 /opt/odoo13/odoo/odoo-bin -c /etc/odoo13.conf
StandardOutput=journal+console

[Install]
WantedBy=multi-user.target

3) Notify systemd about the existence of a new unit file using the following command:

sudo systemctl daemon-reload

4) After that, activate the Odoo service and allow it to run on boot.

sudo systemctl enable --now odoo13

5) Then you must do a verification of the service status.

sudo systemctl status odoo13

6) Output similar to the one below will appear which signifies that Odoo services are active.

Output

● odoo13.service
   Loaded: loaded (/etc/systemd/system/odoo13.service; enabled; vendor preset: enabled)
   Active: active (running) since Sat 2019-10-19 20:06:23 UTC; 3s ago
 Main PID: 1860 (python3)
    Tasks: 4 (limit: 2362)
   CGroup: /system.slice/odoo13.service
           └─1860 /opt/odoo13/odoo-venv/bin/python3 /opt/odoo13/odoo/odoo-bin -c /etc/odoo13.conf

7) To view the messages logged by the Odoo service, run this:

sudo journalctl -u odoo13

Step 6 - Testing the Installation

1) Open your browser and enter this link: http://<your_domain_or_IP_address>:8069 and a window asking for your details will appear.

Step 7 - Configuring Nginx as SSL Termination Proxy

The default Odoo web server works for HTTP traffic. For more security, it is recommended to configure Nginx as an SSL termination proxy that can server the traffic over HTTPS.

SSL termination proxy is a proxy server that manages encryption/decryption. This means that the termination proxy (Nginx) will process and decrypt incoming TLS connections (HTTPS), and pass on the unencrypted requests to the internal service (Odoo). The traffic amidst Nginx and Odoo is not encrypted (HTTP).

Utilizing a reverse proxy provides several benefits like as Load Balancing, SSL Termination, Caching, Compression, Serving Static Content, and many more.

One needs to make sure these prerequisites are satisfied before moving forward with this part:

  • Domain name pointing to your public server IP. We have used to name example.com.
  • Nginx must be installed beforehand.
  • The domain has to be SSL certified. One may install a free Let’s Encrypt SSL certificate.

1) Open text editor and set up or edit the domain server block:

sudo nano /etc/nginx/sites-enabled/example.com

2) The below-given configurations create SSL Termination, HTTP to HTTPS redirection, WWW to non-WWW redirection, cache the static files, and activate GZip compression.

# Odoo servers
upstream odoo {
 server 127.0.0.1:8069;
}

upstream odoochat {
 server 127.0.0.1:8072;
}

# HTTP -> HTTPS
server {
    listen 80;
    server_name www.example.com example.com;

    include snippets/letsencrypt.conf;
    return 301 https://example.com$request_uri;
}

# WWW -> NON WWW
server {
    listen 443 ssl http2;
    server_name www.example.com;

    ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
    include snippets/ssl.conf;
    include snippets/letsencrypt.conf;

    return 301 https://example.com$request_uri;
}

server {
    listen 443 ssl http2;
    server_name example.com;

    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/example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;
    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 http://odoochat;
    }

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

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

    # Gzip
    gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
    gzip on;
}
💡
You must replace example.com with your Odoo domain and create the right path to the SSL certificate files.

3) Then, restart the Nginx service using:

sudo systemctl restart nginx

4) After that, you must instruct Odoo to use the proxy. In order to do that you have to open the configuration file and add this:

proxy_mode = True

5) Restart the Odoo service to implement the changes.

sudo systemctl restart odoo13

After restarting, the reverse proxy is configured, and Odoo can be accessed at: https://example.com.

Step 8 - Changing the Binding Interface

Although this is not a mandatory step, it is a good security practice.

1) By default, Odoo server listens to port 8069 on each and every interface. If you want to stop direct access to the Odoo, you have two options, either block the port 8069 for all public interfaces or you can force Odoo to listen only on the local interface.

2) Now you need to configure Odoo to listen only on 127.0.0.1. For this, you need to open the configuration and add these two lines at the very end of the file:

xmlrpc_interface = 127.0.0.1
netrpc_interface = 127.0.0.1

3) After saving the configuration file, the Odoo server is to be restarted to implement the changes:

sudo systemctl restart odoo13

Step 9 - Enabling Multiprocessing

By default, Odoo works in multithreading mode. For production deployments, we recommend you to change to the multiprocessing server to enhance stability and utilize the system resources in a much better manner.

To activate multiprocessing, it is important to edit the Odoo configuration and create a non-zero number of worker processes. The worker's number is calculated based on the number of CPU cores in your system and the RAM.

As per official Odoo documentation, for calculating the worker's number and required RAM size, use these formulas and assumptions:

Worker number calculation

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

RAM memory size calculation

  • Assume that 20% of all requests are heavy requests, and 80% are lighter ones. Heavy requests take up approximately 1 GB of RAM. On the hand, lighter ones take up about 150 MB of RAM
  • Needed RAM = number_of_workers * ( (light_worker_ratio * light_worker_ram_estimation) + (heavy_worker_ratio * heavy_worker_ram_estimation) )

To get information as to the number of CPUs on your system, execute this grep command:

grep -c ^processor /proc/cpuinfo

Assume there are 4 CPU cores, 8GB of RAM memory, and 30 concurrent Odoo users.

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

Based on the aforementioned calculation, one can utilize 5 workers + 1 worker for the cron worker which makes total of 6 workers.

Compute the RAM memory consumption based on the number of workers:

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

The above-given calculations signify that the Odoo installation requires 2GB of RAM.

For switching to multiprocessing mode, you have to open the configuration file and add 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 to implement changes:

sudo systemctl restart odoo13

Other system resources would be utilized by other services that operate on this system. Depending on the setup, one can have other services operating on the server.

FAQs to Install Odoo 13 on Ubuntu 18.04

What are the system requirements for Odoo 13 on Ubuntu 18.04?

Odoo 13 requires a minimum of 2GB RAM, 20GB free disk space, and Python 3.7 on Ubuntu 18.04.

Does Odoo 13 installation require root privileges?

Yes, the installation process may require root or sudo privileges to install necessary dependencies and configure the system.

Can I use a virtual environment for Odoo 13 installation?

Yes, using a virtual environment is recommended to isolate Odoo's dependencies from other system applications.

Does Odoo 13 support PostgreSQL on Ubuntu 18.04?

Yes, Odoo 13 requires PostgreSQL as its database backend, and it can be installed on Ubuntu 18.04.

Are there any known issues during the Odoo 13 installation?

While Odoo 13 installation is generally straightforward, some users may encounter dependency or package-related issues. Check our troubleshooting guide for solutions.

How can I install additional Odoo modules? 

Odoo modules can be installed from the Odoo user interface itself. Go to the Apps section, search for the desired module, and click "Install" to add it to your Odoo instance.

Can I import data from another ERP system to Odoo? 

Yes, Odoo provides various tools and modules to import data from other ERP systems. You can use CSV files, Excel files, or custom migration scripts to import data into Odoo.

Conclusion

We hope this detailed tutorial helped you understand how to install Odoo on Ubuntu 18.04. To learn more about Odoo installation, check out the official Odoo documentation.

If you have any queries, please leave a comment below and we’ll be happy to respond to them for sure.

Great! You’ve successfully signed up.
Welcome back! You've successfully signed in.
You've successfully subscribed to DevOps Tutorials - VegaStack.
Your link has expired.
Success! Check your email for magic link to sign-in.
Success! Your billing info has been updated.
Your billing was not updated.