How to install Odoo 16 on Linux 9

Share on Social Media

In this Linux tutorial, you will learn how to install Odoo 16 on Linux 9 or other Red Hat based Linux distributions. #centlinux #linux #odoo

What is Odoo?:

Odoo is a Belgian suite of business management software tools including, for example, CRM, e-commerce, billing, accounting, manufacturing, warehouse, project management, and inventory management.

During Odoo experience which took place in Belgium in October 2022, Fabien Pinckaers announced that moving forward Odoo will make all applications available for free in enterprise edition, making Odoo an unparalleled suite of 70+ integrated business apps.

The Community version is a libre software, licensed under the GNU LGPLv3. The Enterprise version has proprietary extra features and services. The source code for the framework and core ERP modules is curated by the Belgium-based Odoo S.A. Odoo is available for both on-premises and ready to use SaaS environment. The source code for the OpenObject framework and the core ERP modules are provided by Belgium-based Odoo S.A. (Source: Wikipedia)

Video to install Odoo 16 on Linux:

YouTube player

Environment Specification:

We are using a minimally installed Rocky Linux 9 operating system with following specifications.

  • CPU – 3.4 Ghz (2 cores)
  • Memory – 2 GB
  • Storage – 20 GB
  • Operating System – Rocky Linux release 9.1 (Blue Onyx)
  • Hostname – odoo-01.centlinux-com.preview-domain.com
  • IP Address – 192.168.88.128/24

Prepare your Rocky Linux Server:

By using a ssh client, login to your Rocky Linux server as root user.

Set a hostname and local dns resolution for your Linux machine by executing following commands.

# hostnamectl set-hostname odoo-01.centlinux-com.preview-domain.com
# echo "192.168.88.128 odoo-01 odoo-01.centlinux-com.preview-domain.com" >> /etc/hosts

As per best practice, you should update software packages in your Linux distribution before installing a new software.

Execute following dnf command at bash prompt to update your software packages.

# dnf update -y

If the above command updates software packages related to Linux kernel, then reboot your operating system before moving forward in this Linux tutorial.

# reboot

After reboot, verify the versions of software that are being used in this configuration guide.

# cat /etc/rocky-release
Rocky Linux release 9.1 (Blue Onyx)

# uname -r
5.14.0-162.18.1.el9_1.x86_64

# python -V
Python 3.9.14

Install Odoo 16 Prerequisites:

During Odoo installation, you need a few more software packages.

These software packages are available in standard yum repositories. Therefore, you can install them by using dnf command.

# dnf install -y wget tar gcc git libpq-devel python-devel openldap-devel

Install PostgreSQL on Linux:

Odoo ERP uses PostgreSQL database as it’s backend data store.

If you have already setup a PostgreSQL database server, then you can use the same here. Otherwise, you may also install PostgreSQL on the same Rocky Linux 9 server.

PostgreSQL server is available in standard yum repositories. Therefore, execute dnf command to install it.

# dnf install -y postgresql-server

Execute following Linux command to initialize PostgreSQL database server.

# postgresql-setup --initdb --unit postgresql
 * Initializing database in '/var/lib/pgsql/data'
 * Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log

Enable and start PostgreSQL database service.

# systemctl enable --now postgresql
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql.service → /usr/lib/systemd/system/postgresql.service.

Create a database user for Odoo business suite.

# su - postgres -c "createuser -s odoo"

Install WKHTMLTOX on Linux:

wkhtmltox is a free and open source command line tool to render HTML into PDF or other popular formats. wkhtmltox runs completely headless and does not requires a display or display service.

You can download wkhtmltox RPM from their official download page or clone source code of wkhtmltox from GitHub.

Execute the following Linux commands to download wkhtmltox.

# cd /tmp
# wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox-0.12.6.1-2.almalinux9.x86_64.rpm
...
Connecting to objects.githubusercontent.com (objects.githubusercontent.com)|185.199.109.133|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 16198412 (15M) [application/octet-stream]
Saving to: ‘wkhtmltox-0.12.6.1-2.almalinux9.x86_64.rpm’

wkhtmltox-0.12.6.1- 100%[===================>]  15.45M  1.22MB/s    in 15s

2023-03-21 15:59:54 (1.01 MB/s) - ‘wkhtmltox-0.12.6.1-2.almalinux9.x86_64.rpm’ saved [16198412/16198412]

wkhtmltox RPM has been downloaded. Now use dnf command to install it on your Linux operating system.

# dnf localinstall -y wkhtmltox-0.12.6.1-2.almalinux9.x86_64.rpm

Install Odoo 16 on Linux:

Create a Linux user for Odoo business suite. This user cannot be used for authentication purpose in Odoo software, but it is only used to own the Odoo software files and processes.

# useradd -r -m -U -s /bin/bash -d /opt/odoo odoo

Switch to odoo user and clone the odoo repository from GitHub. Here, we are using “–branch 16.0” because Odoo 16 is the latest version at the time of this writing. You can use a different numbers if you wish to install other versions of Odoo.

# su - odoo
$ git clone https://www.github.com/odoo/odoo 
> --depth 1 
> --branch 16.0 
> /opt/odoo/odoo
Cloning into '/opt/odoo/odoo'...
warning: redirecting to https://github.com/odoo/odoo.git/
remote: Enumerating objects: 38697, done.
remote: Counting objects: 100% (38697/38697), done.
remote: Compressing objects: 100% (30045/30045), done.
remote: Total 38697 (delta 11040), reused 25777 (delta 7432), pack-reused 0
Receiving objects: 100% (38697/38697), 149.72 MiB | 480.00 KiB/s, done.
Resolving deltas: 100% (11040/11040), done.
Updating files: 100% (33941/33941), done.

Create and activate a Python virtual environment for Odoo software.

$ cd ~
$ python -m venv venv
$ source venv/bin/activate

Upgrade pip (Python Package Manager) by using following command.

(venv) $ pip install --upgrade pip
Requirement already satisfied: pip in ./venv/lib/python3.9/site-packages (21.2.3)
Collecting pip
  Using cached pip-23.0.1-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 21.2.3
    Uninstalling pip-21.2.3:
      Successfully uninstalled pip-21.2.3
Successfully installed pip-23.0.1

All of the required Python libraries are listed in a requirements.txt file within Odoo software directory. You can use this file with pip command to install all these libraries in one shot.

(venv) $ pip install -r /opt/odoo/odoo/requirements.txt
...
Successfully installed Babel-2.9.1 Jinja2-2.11.3 MarkupSafe-1.1.1 Pillow-9.0.1 PyPDF2-1.26.0 Werkzeug-0.16.1 XlsxWriter-1.1.2 appdirs-1.4.4 attrs-22.2.0 beautifulsoup4-4.12.0 cached-property-1.5.2 certifi-2022.12.7 cffi-1.15.1 chardet-3.0.4 cryptography-3.4.8 decorator-4.4.2 defusedxml-0.7.1 docutils-0.16 ebaysdk-2.1.5 freezegun-0.3.15 gevent-20.9.0 greenlet-0.4.17 idna-2.8 isodate-0.6.1 libsass-0.20.1 lxml-4.6.5 num2words-0.5.6 ofxparse-0.19 passlib-1.7.3 polib-1.1.0 psutil-5.8.0 psycopg2-2.8.6 pyasn1-0.4.8 pyasn1-modules-0.2.8 pycparser-2.21 pydot-1.4.1 pyopenssl-19.0.0 pyparsing-3.0.9 pyserial-3.4 python-dateutil-2.7.3 python-ldap-3.4.0 python-stdnum-1.13 pytz-2019.3 pyusb-1.0.2 qrcode-6.1 reportlab-3.5.59 requests-2.25.1 requests-toolbelt-0.10.1 six-1.16.0 soupsieve-2.4 urllib3-1.26.5 vobject-0.9.6.1 xlrd-1.2.0 xlwt-1.3.0 zeep-3.4.0 zope.event-4.6 zope.interface-6.0

After sucessful installation of Odoo requirements, deactivate Python virtual environment.

(venv) $ deactivate

Post Installation Configuration:

Create a directory for installation of Odoo addons.

$ mkdir /opt/odoo/odoo-custom-addons

Exit from odoo user shell.

$ exit

Create a log file for Odoo ERP and adjust file permissions.

# mkdir /var/log/odoo
# touch /var/log/odoo/odoo.log
# chown -R odoo: /var/log/odoo/

Create odoo configuration file in /etc directory by using vim editor.

# vi /etc/odoo.conf

Add following directives in this file.

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

Create a Systemd Service Unit:

To enable autostart of Odoo server during system startup, you are required to create a Systemd service unit.

# vi /etc/systemd/system/odoo.service

Add following directives in this file.

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

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

[Install]
WantedBy=multi-user.target

Enable and start Odoo service.

# systemctl enable --now odoo.service

Configure Linux Firewall:

Odoo business suite uses default service port 8069/tcp. You have to allow this service port in Linux firewall, so that incoming traffic can access odoo service.

# firewall-cmd --permanent --add-port=8069/tcp && firewall-cmd --reload
success
success

Access Odoo 16 ERP:

Open URL http://odoo-01.centlinux-com.preview-domain.com:8069/ in a web browser to access Odoo ERP.

odoo-16-web-config

Fill the required information as shown in above screenshot and press ‘Create Database’ button.

odoo-16-login

Login as credentials, that you have entered in previous step.

odoo-16-apps

You have reached at the Odoo Apps page.

Recommended Book: Odoo 15 Development Essentials (PAID LINK)

Conclusion – Install Odoo 16 on Linux:

In this Linux tutorial, you have learned how to install Odoo 16 on Linux 9 or other Red Hat based Linux distribution.