Introduction
This article shows how to install Odoo 15 on Ubuntu 20.04. Odoo is a popular open-source suite of business apps that help companies to manage and run their business. It includes a wide range of applications such as CRM, e-Commerce, website builder, billing, accounting, manufacturing, warehouse, project management, inventory, and much more, all seamlessly integrated.
Installing Odoo in a virtual environment, or deploying as a Docker container, gives you more control over the application and allows you to run multiple Odoo instances on the same system.
Prerequisites
OS: Ubuntu 20.04
Resources: 2-core CPU & 2GB of RAM
Access: SSH connection to the server
Permissions: a user with ‘sudo’ privileges
Step 1. Log in to the Ubuntu VPS via SSH
The first step in the installation is to connect to your server via ssh. You can log in to the server using ssh:
$ ssh username@IP_Address -p Port_number
Step 2. Update Packages
Then let’s update existing Ubuntu packages and upgrade them into newer versions.
$ sudo apt-get update $ sudo apt-get upgrade -y
Step 3. Install Dependencies
The first step is to install Git , Pip , Node.js , and development [tools required to build]
$ 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 libldap2-dev libtiff5-dev libjpeg8-dev libopenjp2-7-dev \ liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev libxcb1-dev
Step 4. Create an Odoo user
Create a new user called odoo15 with home directory /opt/odoo15. This prevents the security risks posed by running odoo under the root user. You can do it with this command. You can give any name to the user. However, be careful to create a PostgreSQL user with the same name.
$ sudo useradd -m -d /opt/odoo15 -U -r -s /bin/bash odoo15
Step 5. Install and configure PostgreSQL
In this step, you need to set up the database server. Odoo uses PostgreSQL as the database back-end. Install the database server for Odoo By using the following command.
$ sudo apt install postgresql -y
Now you need to create a PostgreSQL user for the handling of the database server i.e. PostgreSQL. In our case, we will create a PostgreSQL user with the same name as the previously created system user i.e odoo15
$ sudo su - postgres -c "createuser -s odoo15"
Step 6. Installing wkhtmltopdf
Wkhtmltopdf is the package that allows Odoo 15 to print PDF reports. It converts HTML (web page markup) to PDF, but it’s not present in the official package list nor the EPEL repository. We’ll download and install the package from Github.
$ sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
After it has downloaded, we’ll use this command to install it.
$ sudo apt install ./wkhtmltox_0.12.5-1.bionic_amd64.deb
Step 7. Install Odoo 15 on Ubuntu and Configure Odoo 15
First, we’ll change the user to the one we created i.e odoo15.
$ sudo su - odoo15
Next, we’ll clone the Odoo 15 source code from github.
odoo15$ git clone https://www.github.com/odoo/odoo --depth 1 --branch 15.0 /opt/odoo15/odoo
To separate Odoo’s Python modules from the system’s Python modules, we’ll need to set up a Python Virtual Environment inside which we’ll install Odoo. Use these commands to achieve this.
odoo15$ cd /opt/odoo15 odoo15$ python3 -m venv odoo-venv
Then we activate the virtual environment.
$ source odoo-venv/bin/activate
Step 8. Install Odoo Dependencies
All dependencies for Odoo are specified in the requirements.txt file. We’ll use pip to install all required Python modules.
(odoo-venv) odoo15$ pip3 install wheel (odoo-venv) odoo15$ pip3 install -r odoo/requirements.txt
When we’re finished, we deactivate the virtual environment
(odoo-venv)$ deactivate
Step 9. Create directory for the 3rd party addons
We’ll create a new directory a separate directory for the 3rd party addons.
odoo15$ mkdir /opt/odoo15/odoo-custom-addons
This directory should later be added to the addons_path parameter which defines a list of directories where Odoo searches for modules. After this step we will switch back to the sudo user using this command.
odoo15$ exit
Step 10. Create a configuration file for the Odoo Installation
The command below allow you to create and edit a *.conf file.
$ sudo nano /etc/odoo15.conf
Add the following configuration information to the file.
Note: Remember to change the admin_passwd to something more secure.
[options] ; This is the password that allows database operations: admin_passwd = my_admin_passwd db_host = False db_port = False db_user = odoo15 db_password = False xmlrpc_port = 8060 logfile = /var/log/odoo15/odoo.log logrotate = True addons_path = /opt/odoo15/odoo/addons,/opt/odoo15/odoo-custom-addons
Step 11. Creating Systemd Unit File
This is a configuration ini-style file that holds configuration information about a service. We’ll be creating a file named “odoo15.service”.
$ sudo nano /etc/systemd/system/odoo15.service
Add the following configuration information to the file.
[Unit] Description=Odoo15 Requires=postgresql.service After=network.target postgresql.service [Service] Type=simple SyslogIdentifier=odoo15 PermissionsStartOnly=true User=odoo15 Group=odoo15 ExecStart=/opt/odoo15/odoo-venv/bin/python3 /opt/odoo15/odoo/odoo-bin -c /etc/odoo15.conf StandardOutput=journal+console [Install] WantedBy=multi-user.target
With the next command we are notifying systemd that the new file exists and reloading the daemon.
$ sudo systemctl daemon-reload
Next, we start the Odoo service and enable it to run on system boot.
$ sudo systemctl enable --now odoo15
Now we check if the service is running.
$ sudo systemctl status odoo15
You should get the following output.
This next command will allow you to check on the messages logged by the odoo15 service.
$ sudo journalctl -u odoo15
Step 12. Testing the Odoo Installation
Conclusion
Congratulations! You have successfully installed Odoo 15 on Ubuntu 20.04. The tutorial is tested on VPS Mart, so it works fine on Our Ubuntu VPS Hosting.