
Odoo is a suite of open-source business applications. It consists of CRM, eCommerce, inventory, point of sale, project management, and more. These applications are fully integrated and accessed through a common web interface. With Odoo you can integrate your apps and make business life easier.
There are two editions of Oddo - the Community and Enterprise version. The Community edition is free for everyone.
Odoo has few installation options such as from the APT repository, using docker, or installing in a virtual environment.
In this tutorial, we explain how to install Odoo 14 CE on Ubuntu 20.04 inside a Python virtual environment. Hosted Odoo on Nginx as SSL Termination Proxy with Let's Encrypt certificate.
Prerequisites
- A Ubuntu 20.04 instance with minimum 2 GB RAM
- For database management Odoo require PostgreSQL
- A non-root user with sudo priviledge
Step 1. Installing Dependencies
First, update your system.
sudo apt update
sudo apt upgrade
The following command will install all Odoo dependencies.
sudo 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
Step 2. Creating a System User
For running Odoo we'll need to create a new system user and group with a home directory under the path /opt/odoo14 that will need to be able to run an Odoo service.
sudo useradd -m -d /opt/odoo14 -U -r -s /bin/bash odoo14
Step 3. Install and Configure PostgreSQL
First, install PostgreSQL using apt.
sudo apt install postgresql
Once PostgreSQL installation is completed, then we'll need to create a PostgreSQL user. Keep in mind that we are going to use the same name as we previously created a system user. That is oddo14.
sudo su - postgres -c "createuser -s odoo14"
Step 4. Installing wkhtmltopdf
wkhtmltopdf - is an open-source command-line tool that supports the rendering of HTML pages into PDF and other similar formats.
To able print PDF formats and reports in Odoo, will need to install the wkhtmltopdf package.
First, download the package using wget command.
sudo wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb
Once the download is completed, install wkhtmltopdf using the apt command:
sudo apt install ./wkhtmltox_0.12.6-1.bionic_amd64.deb
Step 5. Install and Configure Odoo 14
As we mentioned in the introduction, we'll install Odoo from the source as an isolated Python virtual environment.
First, change a user to odoo14 with the following command.
sudo su - odoo14
To clone the Odoo 14 official source code from GitHub, type:
git clone https://www.github.com/odoo/odoo --depth 1 --branch 14.0 /opt/odoo14/odoo
Then change directory to /opt/odoo14
cd /opt/odoo14
From there, create a new Python virtual environment for Odoo with the following command.
python3 -m venv odoo-venv
And activate the virtual environment.
source odoo-venv/bin/activate
After activating the virtual environment, install all required Python modules with pip3.
(odoo-venv) $ pip3 install wheel
And install
(odoo-venv) $
pip3 install -r odoo/requirements.txt
This can take some time, when it's done, deactivate the environment with the following command.
(odoo-venv) $ deactivate
Create a new directory in /opt/odoo14 path, that will contain the 3rd party addons that we're gonna include in the configuration.
mkdir /opt/odoo14/odoo-custom-addons
We'll add this directory to the addons_path parameter. This parameter will define a list of directories where Odoo will search for modules.
Next, exit from odoo user, and switch back to your sudo user.
exit
Create a configuration file:
sudo nano /etc/odoo14.conf
And past the following contents in the file:
[options]
; This is the password that allows database operations:
admin_passwd = put_your_secure_password
db_host = False
db_port = False
db_user = odoo14
db_password = False
addons_path = /opt/odoo14/odoo/addons,/opt/odoo14/odoo-custom-addons
Step 6. Create a Systemd Unit File
Create a service unit file called odoo14.service in the directory /etc/systemd/system/.
sudo nano /etc/systemd/system/odoo14.service
And past the following configuration:
[Unit] Description=Odoo14 Requires=postgresql.service After=network.target postgresql.service [Service] Type=simple SyslogIdentifier=odoo14 PermissionsStartOnly=true User=odoo14 Group=odoo14
ExecStart=/opt/odoo14/odoo-venv/bin/python3 /opt/odoo14/odoo/odoo-bin -c /etc/odoo14.conf StandardOutput=journal+console [Install] WantedBy=multi-user.target
Tell systemd that a new unit file has been created.
sudo systemctl daemon-reload
And start the Odoo service and enable it to start on boot with the following command:
sudo systemctl enable --now odoo14
Output:
Created symlink /etc/systemd/system/multi-user.target.wants/odoo14.service → /etc/systemd/system/odoo14.service.
Verify service status:
sudo systemctl status odoo14
The output that showing the Odoo service is up and running:
● odoo14.service - Odoo14 Loaded: loaded (/etc/systemd/system/odoo14.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2021-07-22 00:42:45 UTC; 48s ago Main PID: 149632 (python3) Tasks: 4 (limit: 1073) Memory: 63.7M CGroup: /system.slice/odoo14.service └─149632 /opt/odoo14/odoo-venv/bin/python3 /opt/odoo14/odoo/odoo-bin -c /etc/odoo14.conf
Jul 22 00:42:45 li1129-224 systemd[1]: Started Odoo14. Jul 22 00:42:45 li1129-224 odoo14[149632]: 2021-07-22 00:42:45,927 149632 INFO ? odoo: Odoo version 14.0 Jul 22 00:42:45 li1129-224 odoo14[149632]: 2021-07-22 00:42:45,932 149632 INFO ? odoo: Using configuration file at /etc/odoo14.conf Jul 22 00:42:45 li1129-224 odoo14[149632]: 2021-07-22 00:42:45,932 149632 INFO ? odoo: addons paths: ['/opt/odoo14/odoo/odoo/addons', '/opt/odoo14/.local/share/Odoo/addons/14.0', '/opt/odoo14/odoo/addons', '/opt/odoo14/odoo-custom-addons> Jul 22 00:42:45 li1129-224 odoo14[149632]: 2021-07-22 00:42:45,932 149632 INFO ? odoo: database: odoo14@default:default Jul 22 00:42:46 li1129-224 odoo14[149632]: 2021-07-22 00:42:46,525 149632 INFO ? odoo.service.server: HTTP service (werkzeug) running on linoxide:8069
To see the messages that have been logged by the Odoo service, run:
sudo journalctl -u odoo14
Output:
-- Logs begin at Tue 2021-07-13 12:50:08 UTC, end at Thu 2021-07-22 00:45:23 UTC. --
Jul 22 00:42:45 li1129-224 systemd[1]: Started Odoo14.
Jul 22 00:42:45 li1129-224 odoo14[149632]: 2021-07-22 00:42:45,927 149632 INFO ? odoo: Odoo>
Jul 22 00:42:45 li1129-224 odoo14[149632]: 2021-07-22 00:42:45,932 149632 INFO ? odoo: Usin>
Jul 22 00:42:45 li1129-224 odoo14[149632]: 2021-07-22 00:42:45,932 149632 INFO ? odoo: addo>
Jul 22 00:42:45 li1129-224 odoo14[149632]: 2021-07-22 00:42:45,932 149632 INFO ? odoo: data>
Jul 22 00:42:46 li1129-224 odoo14[149632]: 2021-07-22 00:42:46,210 149632 INFO ? odoo.addon>
Jul 22 00:42:46 li1129-224 odoo14[149632]: 2021-07-22 00:42:46,525 149632 INFO ? odoo.servi>
Open your browser and type: http://<your_domain_or_IP_address>:8069

Put Master Password that you previously defined in configuration path /etc/odoo14.conf, and enter other credentials to Create a database.

After successfully created database will be redirected to the Odoo14 Dashboard.
Step 7. Configuring Nginx as SSL Termination Proxy (Optional)
If you want to make Odoo more secure for your environment, we can set Nginx as an SSL termination proxy that will serve the traffic over HTTPS, instead of the default Odoo web serving traffic over HTTP.
SSL Termination Proxy presents a proxy server that will handle the SSL encryption. In our case termination proxy is Nginx, he will process and decrypt incoming TLS connections (HTTPS) and pass on the unencrypted request to the Odoo service.
Prerequisites
- Domain name that point to your public server IP
For this article we'll use example.conf - Nginx installed
- Let's Encypt SSL certificate
Be sure to check you have working Let's Encrypt or some other SSL certificate set up correctly.
To install the Let's Encrypt SSL certificate we first need to install certbot:
# apt install certbot
# apt install python3-certbot-nginx
Next, run the following command with example.com domain name and fill in the required information:
# certbot --nginx -d example.com -d www.example.com
Output:
Saving debug log to /var/log/letsencrypt/letsencrypt.log
Plugins selected: Authenticator nginx, Installer nginx
Enter email address (used for urgent renewal and security notices) (Enter 'c' to
cancel):
1. Create or edit the domain server block
sudo nano /etc/nginx/sites-enabled/example.com.conf
And past the following configuration:
# 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; 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; 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;
# 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;
}
NOTE: Don’t forget to replace example.com with your Odoo domain and set the correct path to the SSL certificate files.
2. Restart the Nginx service
sudo systemctl restart nginx
After restarting the Nginx service, we'll need to tell Odoo to use this configured proxy.
3. Open the configuration file.
sudo nano /etc/odoo14.conf
4. And add the following line.
proxy_mode = True
5. Finally, restart the Odoo service.
sudo systemctl restart odoo14
If you followed all steps, will be able to access your Odoo web instance at https://example.com
Conclusion
In this tutorial, we learned how to install and configure Odoo 14 on Ubuntu 20.04. You can start discovering how open-sourced ERP Odoo is powerful, also you can try and investigate an ADempiere, another open-source ERP solution that is similar to Odoo.