How to Install Odoo 18 on Ubuntu 22.04 Step-by-Step
Odoo,  How To

A Step-by-Step Guide to Installing Odoo 18 on Ubuntu 22.04+

Date Published

Date Updated

Share This

Odoo is a powerful, all-in-one business management software with a comprehensive suite of applications for various business needs, including CRM, accounting, inventory, and more. This guide provides a detailed walkthrough for installing Odoo 18 on an Ubuntu 22.04 server and above.

Prerequisites

Before you begin, ensure your system meets the following requirements:

  • An Ubuntu 22.04+ server with at least 2GB of RAM and a 2-core CPU.
  • SSH access to the server with sudo privileges.

Step 1: Update System Packages

Start by updating and upgrading your server's package list to ensure all existing packages are up to date.

1sudo apt-get update && sudo apt-get upgrade -y

Step 2: Install PostgreSQL

Odoo uses PostgreSQL as its database backend. Install it and start the service.

1sudo apt-get install postgresql -y

After installation, you can verify the service status with: systemctl status postgresql

Step 3: Create a System User and PostgreSQL User

For security, it's best to run Odoo under a dedicated system user, not as the root user. Create a system user named odoo and a corresponding PostgreSQL user with the same name.

1sudo adduser --system --home=/opt/odoo --group odoo
2sudo su - postgres -c "createuser -s odoo"

Step 4: Install Required Dependencies

Odoo is built on Python, and it requires several dependencies to run correctly. Install the necessary packages.

1sudo apt-get install -y git python3-pip python3-dev python3-venv libxml2-dev libxslt1-dev zlib1g-dev libsasl2-dev libldap2-dev build-essential libssl-dev libffi-dev libmysqlclient-dev libjpeg-dev libpq-dev libjpeg8-dev liblcms2-dev libblas-dev libatlas-base-dev npm node-less
2sudo ln -s /usr/bin/nodejs /usr/bin/node
3sudo npm install -g less less-plugin-clean-css
4sudo python3 -m pip install libsass

Step 5: Install Wkhtmltopdf

Wkhtmltopdf is an essential tool for generating PDF reports in Odoo. Odoo 18 requires a specific version. Download and install it using the following commands:

1sudo wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb
2sudo dpkg -i wkhtmltox_0.12.6-1.bionic_amd64.deb
3sudo apt install -f

Step 6: Clone Odoo 18 from GitHub and Set Up a Virtual Environment

Switch to the odoo user and clone the Odoo 18 source code from its official GitHub repository. It's recommended to install the Python dependencies in a virtual environment.

1sudo su - odoo18 -s /bin/bash
2git clone https://www.github.com/odoo/odoo --depth 1 --branch 18.0 /opt/odoo/odoo-server
3python3 -m venv venv
4source venv/bin/activate
5pip install --upgrade pip
6pip3 install wheel
7pip3 install -r odoo-server/requirements.txt
8deactivate
9exit

Step 7: Create the Odoo Configuration File

Create a configuration file to define Odoo's settings, such as the database user, host, and addons path.

1sudo mkdir -p /var/log/odoo
2sudo chown odoo:odoo /var/log/odoo
3sudo nano /etc/odoo-server.conf
4sudo mkdir -p /opt/odoo/custom-addons
5sudo chown odoo:odoo /opt/odoo/custom-addons

Paste the following content, adjusting the admin_passwd and other settings as needed:

1[options]
2admin_passwd = your_secure_password
3db_host = False
4db_port = False
5db_user = odoo
6db_password = False
7addons_path = /opt/odoo/odoo-server/addons,/opt/odoo/custom-addons
8logfile = /var/log/odoo/odoo-server.log

Save and close the file. Then, set the appropriate permissions.

1sudo chown odoo: /etc/odoo-server.conf
2sudo chmod 640 /etc/odoo-server.conf

Step 8: Create a Systemd Service File

To manage Odoo as a service, create a systemd unit file that allows you to start, stop, and restart the application easily.

1sudo nano /etc/systemd/system/odoo-server.service

Add the following content to the file:

Save and close the file. Reload the systemd daemon and enable and start the service.

1sudo systemctl daemon-reload
2sudo systemctl enable --now odoo-server.service

Step 9: Access Odoo

Once the service is active, you can access your Odoo instance by navigating to your server's IP address or domain on port 8069.

http://your_server_ip:8069

Alternative Installation Methods

While the manual installation provides a great understanding of the system, you can also use automated scripts to streamline the process.

Using a Bash Script: Many Odoo developers create scripts that automate the entire installation process. A popular odoo 18 install script from a company like HeliconiaIO can be downloaded and run with a few commands, handling all dependencies, users, and service configuration for you. You typically just need to configure a few variables at the top of the script.

1# Example commands for a typical bash script installation
2sudo wget https://raw.githubusercontent.com/HeliconiaIO/InstallScript/18.0/odoo_install.sh
3sudo chmod +x odoo_install.sh
4sudo ./odoo_install.sh

Using install-odoo CLI: For those who prefer a command-line interface (CLI) tool, a Node.js package like install-odoo can manage the setup. This method simplifies the process, particularly for developers who are already using Node.js and npm. You would install the CLI tool globally and then use a single command to install a new Odoo instance.

1# Example commands for a CLI tool installation
2sudo npm install -g install-odoo
3install-odoo --version 18.0 --path /opt/odoo --user odoo

While this guide provides a solid foundation for a self-hosted setup, the journey to a fully optimized business management system is just beginning. For expert Odoo implementation, bespoke development, seamless data migration, and robust deployment services, consider partnering with a team that has deep expertise. Contact Heliconia Solutions to transform your Odoo instance into a powerful, customized solution tailored to your business needs.

Read Next

blog-odoo-database-auto-backup
Odoo,  How To

Ensure data security with Odoo Database Auto Backup on Linux. Effortless and space-efficient backup strategy for uninterrupted business operations.