How to Install Odoo 17 on Ubuntu 24.04 LTS "Noble Numbat"

Odoo, often referred to as an all-in-one business software, is a comprehensive suite of business applications including CRM, website/e-commerce, billing, accounting, manufacturing, warehouse, project management, and inventory. The latest version, Odoo 17, brings in a plethora of new features and improvements that can significantly enhance business operations. It's open-source, highly customizable, and can be installed on various platforms, making it a popular choice among businesses of all sizes.

Ubuntu 24.04 LTS "Noble Numbat" is the latest long-term support release from Canonical. This version of Ubuntu offers a stable and secure Linux operating system that's perfect for businesses, developers, and personal use. It comes with updated software and brings long-term support for five years, which makes it a reliable choice for running business applications like Odoo. Its user-friendly interface and robust community support make it an ideal platform for deploying and running applications like Odoo 17.

Step 1​ : Update and Upgrade System Package

it is always recommended to update and upgrade the system to the latest version.

sudo apt update
sudo apt upgrade
Step 2​ : Install PostgreSQL

Odoo requires a PostgreSQL database to store its data

sudo apt-get install postgresql -y
Step 3 : Create a PostgreSQL User

Create a PostgreSQL user with the name odoo17 and grant it superuser privileges.

sudo su - postgres -c "createuser -s odoo17" 2> /dev/null || true
Step 4​ : Set a Password for the PostgreSQL

sudo -u postgres psql -c "ALTER USER odoo17 PASSWORD 'odoo';" 2> /dev/null || true

Step 5 : Create a System User for Odoo

Create a system user with the name odoo and add it to the sudo group.

sudo adduser --system --quiet --shell=/bin/bash --home=/opt/odoo --gecos 'ODOO' --group odoo
sudo adduser odoo sudo

Step 6​ : Install Required Dependencies

Odoo requires several dependencies to be installed on the system.

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

sudo apt-get install libpq-dev python3-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libffi-dev python3-psutil python3-polib python3-dateutil python3-decorator python3-lxml python3-reportlab python3-pil python3-passlib python3-werkzeug python3-psycopg2 python3-pypdf2 python3-gevent -y


Step 7 : Install wkhtmltopdf

wkhtmltopdf is used to convert html content into pdf format. Odoo generates the reports in html format and this is then converted to pdf using the wkhtmltopdf package. 

Since the package for Ubuntu 24.04 has not yet been available, we are installing the Ubuntu 22.04 version, which appears to be functioning well.

sudo wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
sudo apt install ./wkhtmltox_0.12.6.1-2.jammy_amd64.deb

Step 8​ : Create a Log Directory for Odoo

Create a log directory for Odoo and change its ownership to the odoo user.

sudo mkdir /var/log/odoo
sudo chown odoo:odoo /var/log/odoo

Step 9 : Clone Odoo Repository to Server

Clone the Odoo17 repository to the /opt/odoo/server-code directory and change its ownership to the odoo user.

sudo git clone --depth 1 --branch 17.0 https://github.com/odoo/odoo /opt/odoo/server-code
sudo chown -R odoo:odoo /opt/odoo

Step 10​ : Create an Odoo Configuration File

Create an Odoo configuration file at /etc/odoo17.conf with the following contents:

sudo nano /etc/odoo17.conf
[options]; 
Database operations password:
admin_passwd = PASSWORD
db_host = localhost
db_user = odoo17
db_password = odoo
http_port = 8069
logfile = /var/log/odoo/odoo17-server.log
data_dir = /opt/odoo/.local/share/Odoo
addons_path = /opt/odoo/server-code/addons

Replace PASSWORD with a strong password for the database operations.

Step 11​ : Change the Ownership and Permissions

Change the Ownership and Permissions of the Configuration File Change the ownership of the configuration file to the odoo user and set its permissions to 640.

sudo chown odoo:odoo /etc/odoo17.conf
sudo chmod 640 /etc/odoo17.conf

Step 1​2 : Create a Python Virtual Environment for Odoo

Create a Python virtual environment for Odoo and activate it.


sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get install python3.11 python3.11-venv python3.11-dev
sudo -u odoo -i
python3.11 -m venv odoo-venv
source odoo-venv/bin/activate

Step 13​ : Install Required Python Packagess

pip install wheel setuptools pip --upgrade
pip install -r server-code/requirements.txt
Step 1​4 : Deactivate the Virtual Environment

deactivate
Step 15​ : Create a Systemd Service for Odoo

Create a systemd service for Odoo at /etc/systemd/system/odoo17.service with the following contents:

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

[Unit]
Description=Odoo17
Requires=postgresql.service
After=network.target postgresql.service
[Service]
Type=simple
SyslogIdentifier=odoo
PermissionsStartOnly=true
User=odoo
Group=odoo
ExecStart=/opt/odoo/odoo-venv/bin/python3.10 /opt/odoo/server-code/odoo-bin -c /etc/odoo17.conf
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target


Step 16​ : Change the Ownership and Permissions

Change the ownership of the service file to root and set its permissions to 755.

sudo chmod 755 /etc/systemd/system/odoo17.service
sudo chown root: /etc/systemd/system/odoo17.service
Step 1​7 : Service Commands

sudo systemctl start odoo17.service
sudo systemctl status odoo17.service
sudo systemctl restart odoo17.service
sudo systemctl daemon-reload


Step 18 : Enable the Odoo service on system startup

sudo systemctl enable odoo17.service

In conclusion, the combination of Odoo 17 and Ubuntu 24.04 LTS "Noble Numbat" provides a powerful, reliable, and user-friendly platform for managing your business operations. With the long-term support offered by Ubuntu and the comprehensive suite of business applications provided by Odoo, you can streamline your processes, improve productivity, and focus more on strategic tasks. Whether you're a small business or a large enterprise, this combination is a robust solution that can cater to your specific needs and help you achieve your business goals.

Mohammed Shahil 14 June, 2024
Sign in to leave a comment