sodcalculator

10 Tech How-To

Install Odoo on Ubuntu: Step-by-Step Guide

Guide 10-36558 · Updated · Step by step

Yes, you can install Odoo on Ubuntu, and this guide walks you through the standard method using the official Odoo APT repository. You will install the community edition, set up a PostgreSQL database, and configure Odoo as a system service, all from the command line.

Prerequisites and Preparation

Before starting, ensure your Ubuntu server or desktop meets these requirements:

  • Ubuntu version: 22.04 LTS or 24.04 LTS are recommended; older versions may work but are not officially supported by Odoo.
  • Root or sudo access: You need administrative privileges to install packages and create system users.
  • Internet connection: To download packages from Ubuntu and Odoo repositories.
  • At least 2 GB RAM and 10 GB free disk space for a small production instance; more if you plan heavy use.

Update your system and install essential tools:

  1. sudo apt update && sudo apt upgrade -y
  2. sudo apt install -y git python3-pip build-essential wget python3-dev python3-venv python3-wheel libxslt1-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools node-less

These packages provide the Python build tools and libraries Odoo needs to compile native extensions.

Install PostgreSQL and Create a User

Odoo uses PostgreSQL as its database. Install it and create a dedicated database user:

  1. sudo apt install -y postgresql
  2. Switch to the postgres system user: sudo su - postgres
  3. Create a database user for Odoo: createuser --createdb --username postgres --no-createrole --no-superuser odoo
  4. Set a password for the user (replace ‘your_password’ with a strong one): psql -c "ALTER USER odoo WITH PASSWORD 'your_password';"
  5. Exit the postgres user: exit

This user will own the databases Odoo creates, so it needs the CREATEDB privilege.

Add the Official Odoo Repository

Odoo provides a Debian/Ubuntu repository that simplifies installation and updates. Add it and install Odoo:

  1. Import the GPG key: wget -q -O - https://nightly.odoo.com/odoo.key | sudo gpg --dearmor -o /usr/share/keyrings/odoo-archive-keyring.gpg
  2. Add the repository to your sources list: echo 'deb [signed-by=/usr/share/keyrings/odoo-archive-keyring.gpg] https://nightly.odoo.com/16.0/nightly/deb/ ./' | sudo tee /etc/apt/sources.list.d/odoo.list
  3. Update and install: sudo apt update && sudo apt install -y odoo

This installs the latest stable Odoo 16.0 (as of this writing) with its default configuration. The package creates a system user odoo and starts the service automatically.

Configure Odoo

The main configuration file is /etc/odoo/odoo.conf. You will need to edit it to set your database password and choose a port:

  1. Open the file: sudo nano /etc/odoo/odoo.conf
  2. Set the admin_passwd (master password for database management) to a strong value.
  3. Add or modify the db_password line to match the password you set for the PostgreSQL user.
  4. Optionally change port (default 8069) if you have a conflict.
  5. Save and exit.

Restart Odoo to apply changes: sudo systemctl restart odoo

Access and Create Your First Database

After starting the service, open your web browser and go to http://your_server_ip:8069. You will see the Odoo database creation screen. Enter:

  • Master Password: the admin_passwd you set.
  • Database Name: a descriptive name like mycompany.
  • Email and Password: for the administrator login.
  • Language and Country: for localization.

Click Create Database. Odoo will set up the database and log you in as the admin user.

Enable HTTPS with a Reverse Proxy

For production, you should put Nginx or Apache in front of Odoo to handle SSL and serve on port 443. Here is a minimal Nginx configuration:

  1. Install Nginx: sudo apt install -y nginx
  2. Create a site config: sudo nano /etc/nginx/sites-available/odoo
  3. Add a server block that proxies to http://127.0.0.1:8069.
  4. Enable the site and restart Nginx.

Then use Certbot to obtain a free SSL certificate. This step is critical for protecting login credentials and data in transit.

Common Problems and Troubleshooting

Here are frequent issues and their fixes:

  • Service fails to start: Check logs with sudo journalctl -u odoo. Often it is a wrong password in odoo.conf or a missing Python dependency.
  • Port 8069 already in use: Change the port in the config or stop the conflicting service.
  • Cannot connect to PostgreSQL: Verify the db_user and db_password in the config, and that the PostgreSQL service is running (sudo systemctl status postgresql).
  • Permission errors on addons: Ensure the odoo user owns the addons directory: sudo chown -R odoo:odoo /usr/lib/python3/dist-packages/odoo/addons

Frequently Asked Questions

Can I install Odoo on Ubuntu Desktop?

Yes, the same steps work on Ubuntu Desktop. The only difference is that you may already have a graphical environment, but the command-line installation is identical.

How do I update Odoo to a newer version?

Run sudo apt update && sudo apt upgrade odoo. This will update to the latest patch release within your installed major version (e.g., 16.0). To upgrade to a new major version (e.g., 17.0), you must add a new repository and perform a database migration, which is more involved.

Is the community edition free?

Yes, Odoo Community is open-source and free to use. It lacks some enterprise features like advanced inventory and accounting, but is fully functional for many businesses.

What is the default port for Odoo?

The default HTTP port is 8069. You can change it in /etc/odoo/odoo.conf under the port parameter.

Can I install Odoo with Docker instead?

Yes, Docker is an alternative that avoids system-level dependencies. The official Odoo image is available on Docker Hub, and you can run it with a single command, but you lose the convenience of the apt service manager.

Related

General steps for current mainstream versions; menus can differ by device and version. See the disclaimer or report an error.

More in this bed

The whole Tech How-To bed →