How to Install Odoo 18 on Ubuntu 22.04 / 24.04

Odoo is one of the world’s most powerful open-source ERP systems, offering a wide range of business modules such as Accounting, Sales, Purchase, Inventory, HR, CRM, and more.

In this article, you’ll learn how to install Odoo 18 on Ubuntu 22.04 or 24.04 LTS — step by step, from setting up PostgreSQL to configuring the Odoo service.

📋 Prerequisites

Before you begin, make sure you have:

  • A server running Ubuntu 22.04 or 24.04 (VPS or local)
  • Root or sudo access
  • Stable internet connection

⚙️ Step 1: Update and Install Dependencies

Start by updating your system and installing all required packages.

sudo apt update && sudo apt upgrade -y

Now, install dependencies that Odoo needs:

sudo apt install git python3-pip build-essential wget python3-dev python3-venv \
libxslt-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools node-less \
libjpeg-dev libpq-dev gcc g++ -y

🧩 Explanation:

  • git → used to download Odoo source code from GitHub
  • python3-venv → creates a virtual environment for Python dependencies
  • libpq-dev, libldap2-dev, libsasl2-dev → required for PostgreSQL and authentication
  • node-less → compiles CSS assets used by Odoo

🐘 Step 2: Install PostgreSQL

Odoo uses PostgreSQL as its main database engine.

sudo apt install postgresql -y
sudo systemctl enable postgresql
sudo systemctl start postgresql

Then create a PostgreSQL user for Odoo:

sudo su - postgres
createuser -s odoo18
exit
💬 Explanation:
This user ( odoo18 ) will manage databases for Odoo. You can change the name, but keep it consistent in later steps.

👤 Step 3: Create a System User for Odoo

To keep the environment secure, it’s recommended to run Odoo under a dedicated user account.
sudo adduser --system --home=/opt/odoo18 --group odoo18

💡 This creates a system user and a home directory for Odoo at /opt/odoo18.

💾 Step 4: Download Odoo Source Code

Now clone the Odoo source code from GitHub.

sudo su - odoo18 -s /bin/bash
cd /opt/odoo18
git clone https://github.com/odoo/odoo.git --branch 18.0 --depth=1
exit

💬 Explanation:

  • --branch 18.0 ensures we’re downloading Odoo version 18
  • --depth=1 speeds up the process by only downloading the latest commit

🧱 Step 5: Create a Virtual Environment and Install Requirements

Odoo runs on Python, so we’ll set up a virtual environment for it.

sudo apt install python3-venv -y
sudo su - odoo18 -s /bin/bash
cd /opt/odoo18
python3 -m venv venv
source venv/bin/activate
pip install wheel setuptools pip --upgrade
pip install -r odoo/requirements.txt
deactivate
exit


💬 Explanation:
  • The virtual environment isolates Odoo’s dependencies from your system Python installation.
  • The requirements.txt file lists all Python libraries Odoo needs to run.

⚙️ Step 6: Configure Odoo

Next, create the Odoo configuration file at /etc/odoo18.conf.

sudo nano /etc/odoo18.conf

Paste the following:

[options]
addons_path = /opt/odoo18/odoo/addons
data_dir = /opt/odoo18/.local/share/Odoo

db_host = False
db_port = False
db_user = odoo18
db_password = False

xmlrpc_port = 8069
logfile = /var/log/odoo18/odoo.log
admin_passwd = admin

Now, create the log directory:

sudo mkdir /var/log/odoo18
sudo chown odoo18: /var/log/odoo18

💬 Explanation:

  • addons_path → where Odoo modules are stored
  • admin_passwd → the master password used to create and manage databases
  • xmlrpc_port → the port Odoo will run on (default: 8069)
🔁 Step 7: Create a Systemd Service

To manage Odoo as a background service, create a systemd service file.

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

Add this content:

[Unit]
Description=Odoo 18
Documentation=http://www.odoo.com
After=network.target postgresql.service

[Service]
User=odoo18
Group=odoo18
ExecStart=/opt/odoo18/venv/bin/python3 /opt/odoo18/odoo/odoo-bin -c /etc/odoo18.conf
StandardOutput=journal+console

[Install]
WantedBy=multi-user.target

Then enable and start the service:

sudo systemctl daemon-reload
sudo systemctl enable odoo18
sudo systemctl start odoo18

Check if Odoo is running:

sudo systemctl status odoo18

💬 Explanation:
Systemd allows you to start, stop, and restart Odoo easily:

  • sudo systemctl start odoo18
  • sudo systemctl stop odoo18
  • sudo systemctl restart odoo18

✅ Conclusion

By following this guide, you have successfully installed Odoo 18 on Ubuntu 22.04 / 24.04 — complete with:

  • PostgreSQL database setup
  • Python virtual environment
  • Configuration & systemd service
  • (Optional) Nginx reverse proxy

You can now start using Odoo to manage every aspect of your business — from accounting, sales, and inventory to HR and CRM — all in one powerful platform.