Run Odoo 13 with Virtualenv on Ubuntu 20.04

Running Odoo 13 with Virtualenv on Ubuntu 20.04 is a little different from Ubuntu 18.04. For information, Ubuntu 20.04 using Python 3.8. Running Odoo on a local machine with virtualenv has many advantages.

Let’s check this out how to run Odoo 13 with virtualenv on Ubuntu 20.04.

Odoo Logo

Postgresql Preparation

  • Install Postgresql with sudo apt install postgresql
  • Switch to postgres account with sudo su - postgres and type psql
  • Create a new user on Postgresql for Odoo. In this tutorial I use odoo13 as username and odoo as a password. Type this SQL command CREATE USER odoo13 WITH SUPERUSER ENCRYPTED PASSWORD 'odoo';

Postgresql create new user

  • Quit from postgres account then configure postgresql pg_hba file. Open pg_hba with sudo nano /etc/postgresql/<postgresql-version>/main/pg_hba.conf add a command for Odoo custom config like image below.

Setup postgresql pg_hba

  • Restart your postgresql service with sudo service postgresql restart

Odoo Preparation

  • Download Odoo 13 source code from Odoo repository on Github or you can do git clone
  • Extract the downloaded file. We only use addons/ directory, odoo/ directory, odoo-bin file, and requirements.txt file. Make sure the directory structure like the image below.

Structure directory for Odoo

  • Install python3 pip and virtualenv with sudo apt install python3-pip python3-venv
  • Create virtualenv with python3 -m venv <venv-directory>
  • You can create virtualenv on the same directory or different directory. In this tutorial, I use the same directory as the Odoo directory.

Structure directory Odoo - 2

  • Install other dependencies for Odoo sudo apt install python3-dev libxml2-dev libxslt1-dev libldap2-dev libssl-dev libsasl2-dev libpq-dev libjpeg8-dev
  • Activate virtualenv with source <venv-directory>/bin/activate
  • We need to upgrade the pip module because the old pip usually can’t work properly with dependencies. Upgrade pip with pip install -U pip
  • Install all Odoo dependencies in the requirements.txt with pip install -r requirements.txt

Set Odoo config

Create a configuration file for Odoo named odoo.conf (or whatever you want). Fill in the file with the command below.

db_host =
db_port = 5432
db_user = odoo13
db_password = odoo
http_port = 8069
longpolling_port = 8072
addons_path = addons

Final structure for Odoo

You can read for other options of configuration. Also, you can set another port for http_port and longpolling_port.

And you just need activating virtualenv then run ./odoo-bin -c odoo.conf
Open your browser and type localhost:8069 or ip_address:port.

For Odoo 12 tutorial you can see this: Run Odoo 12 With Virtualenv on Ubuntu & Debian

That’s it. Thanks for reading. If you have a question, please write in the comments section.