Odoo may be a popular open-source suite of business apps that facilitate firms to manage and run their business. It includes a large vary of applications like CRM, e-Commerce, website builder, billing, accounting, producing, warehouse, project management, inventory, and far additional, all seamlessly integrated.

Odoo is put in in several ways thatlooking on the utilization case and accessible technologies. the best and fastest thanks to install Odoo is by using the official Odoo APT repositories.

Installing Odoo in a virtual setting, or deploying as a docker instrumentationoffers you additional management over the applying and permits you to run multiple Odoo instances on identical system.

This article goes through putting in and deploying Odoo 15 within a Python virtual setting on Ubuntu 20.04. We’ll transfer Odoo from the official GitHub repository and use Nginx as a reverse proxy.

Installing Dependencies


The first step is to install git , Pip , Node.js , and development

sudo apt update
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

Creating a System User

Running Odoo beneath the basis user poses a good security risk. We’ll produce a brand new system user and cluster with home directory /opt/odoo15 which will run the Odoo service. To do so, run the subsequent command:

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

You can name the user anything you want, as long you create a PostgreSQL user with the same name.

Installing and Configuring PostgreSQL

Odoo uses PostgreSQL as the database back-end. PostgreSQL is included in the standard Ubuntu repositories. The installation is straightforward:

sudo apt install postgresql

Once the service is installed, create a PostgreSQL user with the same name as the previously created system user. In this example, that is odoo15:

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

Installing wkhtmltopdf

wkhtmltopdf could be a set of open-source command-line tools for rendering markup language pages into PDF and varied image formats. To print PDF reports in Odoo, you’ll got to install the wkhtmltox package.

The version of wkhtmltopdf that’s enclosed in Ubuntu repositories doesn’t support headers and footers. The suggested version for Odoo is version 0.12.5. We’ll transfer 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
sudo apt install ./wkhtmltox_0.12.5-1.bionic_amd64.deb

Installing and Configuring Odoo 15

We’ll install Odoo from the source inside an isolated Python virtual environment .

First, change to user “odoo15”:

sudo su - odoo15

Clone the Odoo 15 source code from GitHub:

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

Create a new Python virtual environment for Odoo:

cd /opt/odoo15python3 -m venv odoo-venvCopyCopy

Activate the virtual environment:

source odoo-venv/bin/activate

Odoo dependencies are specified in the requirements.txt file. Install all required Python modules with pip3:

pip3 install wheelpip3 install -r odoo/requirements.txt

Once done, deactivate the environment by typing:

deactivate

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

mkdir /opt/odoo15/odoo-custom-addons

Later we’ll add this directory to the addons_path parameter. This parameter defines a list of directories where Odoo searches for modules.

Switch back to your sudo user:

exit

Create a configuration file with the following content:

sudo nano /etc/odoo15.conf

/etc/odoo15.conf

[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
addons_path = /opt/odoo15/odoo/addons,/opt/odoo15/odoo-custom-addons

CopyDo not forget to change the my_admin_passwd to something more secure.

Creating Systemd Unit File

A unit file is a configuration ini-style file that holds information about a service.

Open your text editor and create a file named odoo15.service with the following content:

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

/etc/systemd/system/odoo15.service

[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

Notify systemd that a new unit file exists:

sudo systemctl daemon-reload

Start the Odoo service and enable it to start on boot by running:

sudo systemctl enable --now odoo15

Verify that the service is up and running:

sudo systemctl status odoo15

The output should look something like below, showing that the Odoo service is active and running:

● 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
...

You can check the messages logged by the Odoo service using the command below:

sudo journalctl -u odoo15

Testing the Installation

Open your browser and type: http://<your_domain_or_IP_address>:8069

Assuming the installation is successful, a screen similar to the following will appear: