How to deploy Odoo ERP on a Scaleway Dedibox running on Ubuntu 20.04 LTS

Odoo - Overview

Odoo is a business management software, including different modules such as CRM, billing, e-commerce, warehouse, website builder, inventory management, and accounting. The software is distributed in an open-code model, providing a free Community Edition, released under the GNU LGPLv3 software license. The source code of the Community Edition is available on the companies GitHub. Besides the free and open-source Community Edition, a proprietary “Enterprise” version provides additional features and services.

The modular design of Odoo allows developers to create additional modules or apps and distribute them on the Odoo marketplace, which provides more than 20.000 modules. This fact makes Odoo a versatile and customizable solution that can be adapted to many usage scenarios.

This tutorial will show you how to deploy Odoo 14 on a Scaleway Dedibox dedicated server, running on Ubuntu Focal Fossa (20.04 LTS).

Requirements:

Installation Prework

1 . Log in to your server using SSH:

ssh root@<your_dedibox_ip>

2 . Update the apt sources lists and upgrade the software already installed on the machine to the latest version available in Ubuntu’s repositories:

apt update && apt upgrade -y 

3 . Odoo requires a PostgreSQL database. By default, the database engine has to be installed on the same server as Odoo. Install PostgreSQL using the apt package manager:

apt install postgresql -y

4 . Odoo requires the wkhtmltox package to generate printable PDF reports using wkhtmltopdf. Download the package into the /tmp directory of your machine:

cd /tmp
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb

5 . Install xfonts which is required by wkhtmltox:

apt install xfonts-75dpi xfonts-base -y

6 . Install the wkhtmltox package using dpkg:

dpkg -i /tmp/wkhtmltox_0.12.6-1.bionic_amd64.deb

Installing Odoo

1 . Download and install the Odoo GPG key:

wget -O - https://nightly.odoo.com/odoo.key | apt-key add -

2 . Odoo provides a repository for the apt package manager. Add the repository to an apt configuration file called odoo.list:

echo "deb http://nightly.odoo.com/14.0/nightly/deb/ ./" >> /etc/apt/sources.list.d/odoo.list

3 . Update the apt package manager to add the new repository to it:

apt update

4 . Install the Python dependencies for Odoo:

apt install git build-essential python3 python3-pip python3-setuptools python3-dev python3-venv python3-wheel libxslt-dev libzip-dev libldap2-dev libsasl2-dev node-less libjpeg-dev gdebi -y

5 . Install the Python PIP requirements for Odoo:

apt install python-dev libxml2-dev libxslt1-dev libpq-dev libldap2-dev libsasl2-dev libffi-dev -y

Then install the remaining requirements using pip3:

Note: This step may take a while.

sudo -H pip3 install -r https://raw.githubusercontent.com/odoo/odoo/master/requirements.txt

6 . Install Odoo using apt:

apt install odoo

Configuring Odoo

1 . Open an Internet browser on your local computer and point it to http://<your_dedibox_ip>:8069. The Odoo installation wizard displays:

Enter the following information in the form:

  • Master Password: The master password for the Odoo database. By default an auto-generated value is pre-filled. You can change it to an own password if required.
  • Database Name: A name for the Odoo PostgreSQL database
  • Email: The email address of the admin user. It will also be used as an identifier to connect to Odoo
  • Password: A strong password for the Odoo admin user
  • Phone number: Your phone number
  • Language: Select the language for the Odoo web interface
  • Country: Select your country from the drop-down list
  • Demo data: Tick this box to fill up the Odoo database with demo data. This feature can be useful for testing the application.

Once all data is filled in, click Create database to create the Odoo database and your first login.

2 . The application dashboard displays:

From this panel, you can install additional applications and modules to your Odoo installation. Click on the Install button next to each app to install it automatically on your Odoo server. You can see more details about each application by clicking on the Learn More button.

To navigate around your installed apps, click on the mosaic button in the top left corner and select your application from the list:

Odoo CRM module:

Odoo Discuss module with activated e-learning module:

Setting up Nginx as HTTPS Proxy

By default, the Odoo web server is using a plain HTTP connection to transport data. To make connections to the application more secure, we configure the Nginx web server as an HTTPS-proxy that will act as front-end for Odoo.

1 . Install Nginx and certbot using apt:

apt install nginx certbot python3-certbot-nginx

2 . Create a Nginx configuration file /etc/nginx/sites-available/odoo.example.com (replace odoo.example.com with your Odoo domain name) and put the following content in it:

nano /etc/nginx/sites-available/odoo.example.com
upstream odoo {
 server 127.0.0.1:8069;
}

upstream odoochat {
 server 127.0.0.1:8072;
}

server {
    listen 80;
    server_name odoo.example.com;

    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;

    access_log /var/log/nginx/odoo.example.com.access.log;
    error_log /var/log/nginx/odoo.example.error.log;

    location /longpolling {
        proxy_pass http://odoochat;
    }

    location / {
       proxy_redirect off;
       proxy_pass http://odoo;
    }

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

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

3 . Activate the site by creating a symlink in the sites-enabled directory:

ln -s /etc/nginx/sites-available/odoo.example.com /etc/nginx/sites-enabled/

4 . Run certbot to request a new certificate and configure Nginx. Follow the instructions given during the certificate request:

certbot --nginx

5 . Open the file /etc/odoo/odoo.conf in a text editor and add the following lines to it to enable Proxy mode in Odoo and restrict connections to the application to localhost only, for security reasons:

nano /etc/odoo/odoo.conf
[options]
[...]
proxy_mode = True
xmlrpc_interface = 127.0.0.1
netrpc_interface = 127.0.0.1

6 . Restart Odoo:

systemctl restart odoo

You can now access your Odoo via a secure HTTPS connection at https://odoo.example.com.

Conclusion

In this tutorial, you have learned how to install Odoo 14 and its modules on Ubuntu 20.04 LTS Focal Fossa. You then secured the connection to your Odoo using a TLS certificate issued by the Let’s Encrypt certification authority (CA) and restricted direct access to the application by using a Nginx proxy. To go further, refer to the official Odoo documentation.

Discover the Cloud That Makes Sense