How to Install Odoo on Ubuntu 20.04

Updated on July 25, 2024
How to Install Odoo on Ubuntu 20.04 header image

Introduction

Odoo is an open-source, self-hosted ERP business suite with modules for accounting, CRM, sales, purchasing, Point of Sale, E-Commerce, project management, inventory, and more. This guide explains how to install Odoo on Ubuntu 20.04.

Prerequisites

  • Deploy a fully updated Ubuntu 20.04 cloud VPS server at Vultr.
  • Create a non-root user with sudo access.
    • This guide uses example_user as the non-root account.

1. Set Up the Installation Environment

  1. Connect to your server as the non-root example_user account via SSH.

  2. Update the system packages.

     $ sudo apt update
  3. Install Git.

     $ sudo apt install git -y
  4. Install Pip.

     $ sudo apt install python3-pip -y
  5. Install other required dependencies.

     $ sudo apt install -y build-essential wget python3-dev python3-venv \
     python3-wheel libfreetype6-dev libxml2-dev libzip-dev libldap2-dev libsasl2-dev \
     python3-setuptools node-less libjpeg-dev zlib1g-dev libpq-dev \
     libxslt1-dev libldap2-dev libtiff5-dev libjpeg8-dev libopenjp2-7-dev \
     liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev libxcb1-dev
  6. Create a new odoo user.

     $ sudo adduser odoo

2. Install and Configure PostgreSQL

  1. Download and add PostgreSQL Repositories.

     $ sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
    
     $ wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O - | sudo apt-key add -
  2. Install PostgreSQL.

     $ sudo apt install postgresql postgresql-contrib -y
  3. Start the database server.

     $ sudo systemctl start postgresql
  4. Enable the database server to start automatically on system boot.

     $ sudo systemctl enable postgresql
  5. Change the default PostgreSQL password.

     $ sudo passwd postgres
  6. Switch to the postgres user.

     $ su - postgres
  7. Create a database user named odoo.

     $ createuser odoo
  8. Go to the PostgreSQL interactive shell.

     $ psql
  9. Give the database user odoo permission to create databases.

     ALTER USER odoo WITH CREATEDB;
  10. Exit the interactive shell.

     \q
  11. Return to the non-root example_user account.

     $ exit

3. Install Wkhtmltopdf

Wkhtmltopdf is a group of open-source command-line tools for rendering HTML pages into PDF and other image formats. It enables Odoo to print PDF reports.

  1. Download Wkhtmltopdf from GitHub.

      $ sudo wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb
  2. Install Wkhtmltopdf.

     $ sudo apt install ./wkhtmltox_0.12.6-1.bionic_amd64.deb -y

4. Install Odoo

At the time of this writing, Odoo 14 is the latest version.

  1. Create a directory for Odoo and set the owner to the Odoo user.

     $ sudo mkdir -p /opt/odoo/odoo
     $ sudo chown -R odoo /opt/odoo
     $ sudo chgrp -R odoo /opt/odoo
  2. Switch to the odoo user account.

     $ sudo su - odoo
  3. Clone the Odoo 14 source code from GitHub to /opt/odoo/odoo directory.

     $ git clone https://www.github.com/odoo/odoo --depth 1 --branch 14.0 /opt/odoo/odoo
  4. Create a new Python virtual environment for Odoo.

     $ cd /opt/odoo
     $ python3 -m venv odoo-venv
  5. Activate the virtual environment.

     $ source odoo-venv/bin/activate
  6. Install all required Python modules with pip3.

     $ pip3 install wheel
     $ pip3 install -r odoo/requirements.txt
  7. Deactivate the environment.

     $ deactivate
  8. Create a new directory for 3rd party add-ons.

     $ mkdir /opt/odoo/odoo-custom-addons
  9. Switch back to your non-root example_user account.

     $ exit
  10. Create a configuration file.

     $ sudo nano /etc/odoo.conf
  11. Add the following code to the file. Change StrongMasterPassword to a unique password.

     [options]
     ; This is the password that allows database operations:
     admin_passwd = StrongMasterPassword
     db_host = False
     db_port = False
     db_user = odoo
     db_password = False
     addons_path = /opt/odoo/odoo/addons,/opt/odoo/odoo-custom-addons
  12. Close and save the file.

5. Create a Service Unit File

  1. Create a service unit file called odoo.service.

     $ sudo nano /etc/systemd/system/odoo.service
  2. Add the following code to the file. Close and save the file.

     [Unit]
     Description=Odoo14
     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 /opt/odoo/odoo/odoo-bin -c /etc/odoo.conf
     StandardOutput=journal+console
    
     [Install]
     WantedBy=multi-user.target
  3. Reload system daemon for changes to take effect.

     $ sudo systemctl daemon-reload
  4. Start the Odoo service.

     $ sudo systemctl start odoo
  5. Enable the service to start on system boot.

     $ sudo systemctl enable odoo
  6. Check the service status.

     $ sudo systemctl status odoo

6. Access Web Interface

To access the Odoo web interface, navigate to your server's IP address at port 8069 in your web browser. For example, http://192.0.2.11:8069. You should see the database setup screen:

Odoo login screen

  • Enter the admin_password value you chose in /etc/odoo.conf for the Master Password field.
  • Enter the other information as desired for your installation.

Conclusion

You have installed Odoo. You can now access the Dashboard and configure it to begin managing your business.

More Information

To learn more about Odoo, go to the official documentation page.