DEV Community

Cover image for How to Install Odoo on Ubuntu
HostnExtra Technologies
HostnExtra Technologies

Posted on

How to Install Odoo on Ubuntu

In this article, we'll explain how to install Odoo on Ubuntu 20.04.

Odoo is a suite of web based open source business apps. Odoo has allowed us to leverage thousands of developers and business experts to build the world's largest ecosystem of fully integrated business apps including CRM, website, e-Commerce, billing, accounting, manufacturing, warehouse, project management, inventory, and much more.

With a modern and elegant technical design, Odoo's framework is unique. It allows us and our community developers to provide top-notch usability that scales across all apps.

This article will guide you to install Odoo 14 version on Ubuntu 20.04 using package installer and configure Nginx as reverse proxy server.

Prerequisites

A Ubuntu installed dedicated server or KVM VPS.
A root user access or normal user with administrative privileges.

Install Odoo on Ubuntu

Step 1 - Keep the server updated

# apt update -y && apt upgrade -y

Step 2 - Install PostgreSQL

Odoo needs a PostgreSQL server to run properly.

# apt install postgresql -y

Step 3 - Install Odoo

Odoo S.A. provides a repository that can be used with Debian and Ubuntu distributions. It can be used to install Odoo Community Edition by executing the following commands:

# wget -O - https://nightly.odoo.com/odoo.key | apt-key add -
# echo "deb http://nightly.odoo.com/14.0/nightly/deb/ ./" >> /etc/apt/sources.list.d/odoo.list
# apt-get update && apt-get install odoo

Step 4 - Configure firewall

Once the installation gets completed, add Odoo port in the firewall. Assuming that you are using UFW.

# ufw allow 8069/tcp

# ufw reload

Now you can navigate to your browser and access Odoo using http://[server_IP]:8069.

You will get a form to create a database. Fill the form and click create database button. Once the done with the task, it will create a database and redirect to control panel.

Step 5 - Configure Nginx as SSL Termination Proxy

We need to install Nginx to use SSL. SSL termination can be implemented via just about any SSL termination proxy, but requires the following setup:

Enable Odoo’s proxy mode. This should only be enabled when Odoo is behind a reverse proxy.
Install the Nginx.
Install Let's Encrypt on Nginx.
Set up the proxying itself (Nginx proxying example).
Your SSL termination proxy should also automatically redirect non-secure connections to the secure port.

Open Odoo configuration file using following command:

# vi /etc/odoo/odoo.conf

Change proxy_more from False to True

proxy_mode = True

Save and exit.

Restart Odoo service

# systemctl restart odoo

Next, create a Nginx configuration file for your website.

# vi /etc/nginx/sites-enabled/odoo.conf

Add following content:

#odoo server
upstream odoo {
server 127.0.0.1:8069;
}
upstream odoochat {
server 127.0.0.1:8072;
}

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

server {
listen 443;
server_name odoo.mycompany.com;
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 on;
ssl_certificate /etc/ssl/nginx/server.crt;
ssl_certificate_key /etc/ssl/nginx/server.key;
ssl_session_timeout 30m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers 'ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA';
ssl_prefer_server_ciphers on;

# 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;
}

Once you’re done, test and restart the Nginx service :

# nginx -t

# systemctl restart nginx

At this point, the reverse proxy is configured, and you can access your Odoo instance at https://odoo.mycompany.com.

The installation and configuration has been done successfully.

In this article, we have seen how to install Odoo on Ubuntu 20.04.

Top comments (2)

Collapse
 
otumianempire profile image
Michael Otu

your article with markdown will be more awesome..

Collapse
 
hostnextra profile image
HostnExtra Technologies

Noted. Thanks :)