Odoo is a suite of business management software tools including, for example, CRM, e-commerce, billing, accounting, manufacturing, warehouse, project management, and inventory management.
In this tutorial we will demonstrate how to install Odoo 13 on Ubuntu 20.04. It is also recommended to install Odoo on a virtual environment so in this article we will guide you on how to setup Odoo 13 in a virtual environment.
The main advantage of using a virtual environment is the ability to completely isolate the Odoo instance to other Odoo instance. This is a good setup if you have multiple Odoo instances setup on your server.
Let us start with the installation.
1. Updating the system
sudo apt update -y && apt upgrade -y
2. Installing Python Dependencies
Since Odoo is built with Python we need to install all the Odoo dependencies on Python.
sudo apt-get install python3-venv build-essential python3-pip python3-setuptools python3-pillow python3-lxml python3-dev npm nodejs git gdebi libldap2-dev libsasl2-dev libxml2-dev libxslt1-dev libjpeg-dev libpq-dev -y
3. Installing the Database
The default database used in Odoo is PostgreSQL. Let us install PostgreSQL.
sudo apt install postgresql -y
Check the version of PostgresSQL.
# psql --version
psql (PostgreSQL) 12.9 (Ubuntu 12.9-0ubuntu0.20.04.1)
To check the status.
systemctl status postgresql
OUTPUT:
● postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
Active: active (exited) since Wed 2021-12-08 06:13:54 EST; 6h ago
Main PID: 104438 (code=exited, status=0/SUCCESS)
Tasks: 0 (limit: 9485)
Memory: 0B
CGroup: /system.slice/postgresql.service
4. Creating System and PostgreSQL user
Let us create a Odoo13 user set the home directory to /opt/odoo13.
sudo useradd -m -d /opt/odoo13 -U -r -s /bin/bash odoo13
Now we need to create a PostgreSQL user and we will named it odoo13.
sudo su - postgres -c "createuser -s odoo13"
5. Installing wkhtmltopdf
Wkhtmltopdf is an open source command line tool that render HTML into PDF format using the Qt WebKit rendering engine. This tool is necessary for printing PDF reports in Odoo.
Let us download and install wkhtmltopdf 0.12.5.
sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
Make it executable.
chmod +x wkhtmltox_0.12.5-1.bionic_amd64.deb
Let us Install it.
sudo apt install ./wkhtmltox_0.12.5-1.bionic_amd64.deb
6. Odoo 13 installation and configuration
First we need to switch to user odoo13.
su - odoo13
Cloning Odoo13 repository from Github.
git clone https://www.github.com/odoo/odoo --depth 1 --branch 13.0 /opt/odoo13/odoo
Create a virtual environment for your Odoo application.
cd /opt/odoo13
python3 -m venv myodoo-venv
Activate the virtual environment
source myodoo-venv/bin/activate
After activating the virtual environment, we will install the Odoo dependencies. The Python modules dependencies needed to run Odoo is set in the requirements.txt file. To install it run the following command.
(myodoo-venv) $ pip3 install wheel
(myodoo-venv) $ pip3 install -r odoo/requirements.txt
After installing the dependencies we need to deactivate the virtual environment.
(myodoo-venv) $ deactivate
Now we need to create an Addons directory for third party addons.
mkdir /opt/odoo13/custom-addons
Let’s exit to odoo13 user and go back to our sudo user.
exit
Now we need to create the Odoo13 configuration file.
sudo nano /etc/odoo13.conf
Append the content below.
[options]
; This is the password that allows database operations:
admin_passwd = admin_password
db_host = False
db_port = False
db_user = odoo13
db_password = False
xmlrpc_port = 8069
logfile = /var/log/odoo13/odoo.log
addons_path = /opt/odoo13/odoo/addons,/opt/odoo13/custom-addons
Please make sure to change the “admin_password” to your preferred password, then save and close the file.
Next, we need to create a log directory.
mkdir /var/log/odoo13
Set the ownership to odoo15.
chown odoo13:root /var/log/odoo13
7. Create a Odoo 13 Systemd Service
To manage our Odoo 13 we need to create a systemd file.
sudo nano /etc/systemd/system/odoo13.service
Add or insert the following.
[Unit]
Description=Odoo13
Requires=postgresql.service
After=network.target postgresql.service
[Service]
Type=simple
SyslogIdentifier=odoo13
PermissionsStartOnly=true
User=odoo13
Group=odoo13
ExecStart=/opt/odoo13/myodoo-venv/bin/python3 /opt/odoo13/odoo/odoo-bin -c /etc/odoo13.conf
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target
Save and close the file and reload the systemd daemon to apply the changes:
sudo systemctl daemon-reload
Start and enable the Odoo13 service
sudo systemctl enable --now odoo13
Check the status of the Odoo13 service.
systemctl status odoo13
Congratulations, you can now access your Odoo 13 application at http://ipaddress:8069
Conclusion
In this tutorial you have learned how to install Odoo 13 on Ubuntu 20.04. If you like this article you might also like our article on Odoo 14 and Odoo 15
If you have questions, feel free to leave a comment and we will try to answer it.
Thank you and hope you enjoy our tutorial ?