How to Install Odoo on Ubuntu 20.04
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
Connect to your server as the non-root example_user account via SSH.
Update the system packages.
$ sudo apt update
Install Git.
$ sudo apt install git -y
Install Pip.
$ sudo apt install python3-pip -y
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
Create a new
odoo
user.$ sudo adduser odoo
2. Install and Configure PostgreSQL
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 -
Install PostgreSQL.
$ sudo apt install postgresql postgresql-contrib -y
Start the database server.
$ sudo systemctl start postgresql
Enable the database server to start automatically on system boot.
$ sudo systemctl enable postgresql
Change the default PostgreSQL password.
$ sudo passwd postgres
Switch to the
postgres
user.$ su - postgres
Create a database user named
odoo
.$ createuser odoo
Go to the PostgreSQL interactive shell.
$ psql
Give the database user
odoo
permission to create databases.ALTER USER odoo WITH CREATEDB;
Exit the interactive shell.
\q
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.
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
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.
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
Switch to the
odoo
user account.$ sudo su - odoo
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
Create a new Python virtual environment for Odoo.
$ cd /opt/odoo $ python3 -m venv odoo-venv
Activate the virtual environment.
$ source odoo-venv/bin/activate
Install all required Python modules with pip3.
$ pip3 install wheel $ pip3 install -r odoo/requirements.txt
Deactivate the environment.
$ deactivate
Create a new directory for 3rd party add-ons.
$ mkdir /opt/odoo/odoo-custom-addons
Switch back to your non-root example_user account.
$ exit
Create a configuration file.
$ sudo nano /etc/odoo.conf
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
Close and save the file.
5. Create a Service Unit File
Create a service unit file called
odoo.service
.$ sudo nano /etc/systemd/system/odoo.service
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
Reload system daemon for changes to take effect.
$ sudo systemctl daemon-reload
Start the Odoo service.
$ sudo systemctl start odoo
Enable the service to start on system boot.
$ sudo systemctl enable odoo
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:
- 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.