Knowledgebase

Question About Servers

How to Install Odoo 15 on Ubuntu 20.04 Print

  • 11

A correct Odoo 15 installation requires a proper configuration of the environment, installation of dependencies, proper installation of PostgreSql and proper configuration of Odoo 15 for the production environment. This article will guide you through the installation and configuration process of Odoo 15 in an Ubuntu 20.04 system.

Prerequisites

OS: Ubuntu 20.04

Resources: 2-core CPU & 2GB of RAM

Access: SSH connection to the server

Permissions: a user with 'sudo' privileges

Note: you can execute all of the commands below from the root user, but for security purposes, it is recommended that you use a separate user with sudo privileges.

Step 1: Log in to the Ubuntu server via SSH as the root user:

The first step in the installation is to connect to your server via ssh

You can log in to the server using ssh:

ssh username@IP_Address -p Port_number

e.g. ssh [email protected] -p 22

Step 2: Update Packages

Then let’s update existing Ubuntu packages and upgrade them into newer versions. The following commands will help you.

sudo apt-get update
sudo apt-get upgrade -y

Step 3: Install Dependencies

In this step, we need to install Git , Pip , Node.js , and development [tools required to build]

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 4: In Ubuntu, create an Odoo user.

Create a new user called odoo15 with home directory /opt/odoo15. This prevents the security risks posed by running odoo under the root user. You can do it with this command. You can give any name to the user. However, be careful to create a PostgreSQL user with the same name.

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

Step 5: Install and configure PostgreSQL

In this step, you need to set up the database server. Odoo uses PostgreSQL as the database back-end. Install the database server for Odoo By using the following command.

sudo apt install postgresql -y

Now you need to create a PostgreSQL user for the handling of the database server i.e. PostgreSQL.  In our case, we will create a PostgreSQL user with the same name as the previously created system user i.e odoo15

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

Step 6: Installing wkhtmltopdf

Wkhtmltopdf is the package that allows Odoo 15 to print PDF reports. It converts HTML (web page markup) to PDF, but it's not present in the official package list nor the EPEL repository. We’ll download and install the package from Github.

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

After it has downloaded, we'll use this command to install it.

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

Step 7: Installing and Configuring Odoo 15

First, we'll change the user to the one we created i.e odoo15.

sudo su - odoo15

Next, we'll clone the Odoo 15 source code from github.

git clone https://www.github.com/odoo/odoo --depth 1 --branch 15.0 /opt/odoo15/odoo

To separate Odoo's Python modules from the system's Python modules, we'll need to set up a Python Virtual Environment inside which we'll install Odoo. Use these commands to achieve this. 

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

Then we activate the virtual environment.

source odoo-venv/bin/activate

Step 8: Install Odoo Dependencies

All dependencies for Odoo are specified in the requirements.txt file. We'll use pip to install all required Python modules.

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

When we're finished, we deactivate the virtual environment

deactivate

Step 9: Create directory for the 3rd party addons:

We’ll create a new directory a separate directory for the 3rd party addons.

mkdir /opt/odoo15/odoo-custom-addons

This directory should later be added to the addons_path parameter which defines a list of directories where Odoo searches for modules. After this step we will switch back to the sudo user using this command.

exit

Step 10: Create a configuration file for the Odoo Installation

The command below allow you to create and edit a *.conf file.

sudo nano /etc/odoo15.conf

Add the following configuration information to the file. 

Note: Remember to change the admin_passwd to something more secure.

[options]
; This is the password that allows database operations:
admin_passwd = my_admin_passwd
db_host = False
db_port = False
db_user = odoo15
db_password = False
xmlrpc_port = 8069
logfile = /var/log/odoo15/odoo.log
logrotate = True
addons_path = /opt/odoo15/odoo/addons,/opt/odoo15/odoo-custom-addons

Step 11: Creating Systemd Unit File

This is a configuration ini-style file that holds configuration information about a service. We'll be creating a file named "odoo15.service".

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

Add the following configuration information to the file.

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

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

[Install]
WantedBy=multi-user.target

With the next command we are notifying systemd that the new file exists and reloading the daemon.

sudo systemctl daemon-reload

Next, we start the Odoo service and enable it to run on system boot.

sudo systemctl enable --now odoo15

Now we check if the service is running.

sudo systemctl status odoo15

You should get the following output.

● odoo15.service - Odoo15
     Loaded: loaded (/etc/systemd/system/odoo15.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2021-10-26 09:56:28 UTC; 28s ago
...

This next command will allow you to check on the messages logged by the odoo15 service.

sudo journalctl -u odoo15

Step 12: Testing the Odoo Installation

On your browser, type: http://<your_domain_or_IP_address>:8069

If the installation was successful, you'll see the start page for Odoo 15. 

Congratulations! You have successfully installed Odoo 15 on Ubuntu 20.04


Was this answer helpful?

« Back

Enterprise-Grade Hardware

  • Samsung
  • Juniper
  • Western Digital
  • Supermicro
  • LSI
  • Intel
  • R1Soft Backups
  • cPanel
  • MySQL
  • Parallels
  • HP Partner