How to install Odoo 16 on Ubuntu 20.04
Install Odoo 16 on Ubuntu 20.04 with PostgreSQL, wkhtmltopdf, a Python virtual environment, and a systemd service.
Looking for Odoo 19? Read our updated installation guide.
This guide installs Odoo 16 on Ubuntu 20.04 from source. You will create the Odoo system user, install PostgreSQL and wkhtmltopdf, set up a Python virtual environment, and run Odoo through systemd. If you want Cloudpepper to provision the server instead, start from Cloudpepper and skip the manual setup.
Step 1: Open the Terminal
To begin, you need to access the command line interface in Ubuntu. Press Ctrl + Alt + T to open the Terminal application.
Step 2: Update Your System
First, update your system packages to ensure you’re working with the latest versions. Type the following command and press Enter:
sudo apt update && sudo apt upgradeEnter your password when prompted, and wait for the update process to complete.
Step 3: Install Dependencies
Odoo requires certain dependencies to function correctly. Run the following command to install them:
sudo apt install git python3-pip 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 libldb-dev libldap2-dev libtirpc-devStep 4: Create an Odoo User
Create a new system user for Odoo and assign it a home directory:
sudo useradd -m -d /opt/odoo -U -r -s /bin/bash odooStep 5: Install PostgreSQL
Odoo uses PostgreSQL as its database management system. Install PostgreSQL with this command:
sudo apt install postgresqlAfter installation, create a new PostgreSQL user for Odoo:
sudo su - postgres -c "createuser -s odoo"Step 6: Install Wkhtmltopdf
Wkhtmltopdf is a dependency for generating PDF reports in Odoo. Download and install it using these commands:
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.debsudo apt install ./wkhtmltox_0.12.5-1.bionic_amd64.debStep 7: Download Odoo 16
Switch to the Odoo user and download the Odoo 16 source code:
sudo su - odoogit clone https://github.com/odoo/odoo.git --depth 1 --branch 16.0 /opt/odoo/odoo16Step 8: Create a Virtual Environment
Create a new virtual environment for Odoo and activate it:
python3 -m venv /opt/odoo/odoo16-venvsource /opt/odoo/odoo16-venv/bin/activateStep 9: Install Python Dependencies
Within the virtual environment, install the required Python packages:
pip install wheelpip install -r /opt/odoo/odoo16/requirements.txtDeactivate the virtual environment when finished:
deactivateSwitch back to your sudo user:
exitStep 10: Configure Odoo
Create a configuration file for Odoo:
sudo mkdir /etc/odoosudo touch /etc/odoo/odoo.confsudo nano /etc/odoo/odoo.confCopy and paste the following configuration settings into the /etc/odoo/odoo.conf file:
[options]; This is the password that allows database operations:admin_passwd = your_strong_admin_passworddb_host = Falsedb_port = Falsedb_user = odoodb_password = Falseaddons_path = /opt/odoo/odoo16/addonsReplace your_strong_admin_password with a secure password of your choice. Save the file and exit by pressing Ctrl + X, followed by Y and Enter.
Step 11: Create a Systemd Service File
Create a systemd service file to manage the Odoo service:
sudo nano /etc/systemd/system/odoo.servicePaste the following content into the odoo.service file:
[Unit]Description=Odoo16Requires=postgresql.serviceAfter=network.target postgresql.service
[Service]Type=simpleSyslogIdentifier=odoo16PermissionsStartOnly=trueUser=odooGroup=odooExecStart=/opt/odoo/odoo16-venv/bin/python3 /opt/odoo/odoo16/odoo-bin -c /etc/odoo/odoo.confStandardOutput=journal+console
[Install]WantedBy=multi-user.targetSave and exit by pressing Ctrl + X, followed by Y and Enter.
Step 12: Enable and Start the Odoo Service
Enable the Odoo service to start automatically at boot:
sudo systemctl enable odooStart the Odoo service:
sudo systemctl start odooCheck the status of the Odoo service to ensure it’s running:
sudo systemctl status odooIf the service is running, you’ll see an “active (running)” status.
Step 13: Access Odoo in Your Web Browser
Open your web browser and navigate http://your\_server\_ip\_or\_domain:8069
Replace your_server_ip_or_domain with your server’s IP address or domain name. You should see the Odoo setup page, where you can create a new database and start using Odoo 16.
Odoo 16 is now running on Ubuntu 20.04. If you do not want to maintain the server yourself, Cloudpepper can provision and manage the same kind of Odoo server for you.