Odoo is a suite of business management software tools including, for example, CRM, e-commerce, billing, accounting, manufacturing, warehouse, project management, and inventory management.
There are different ways to install Odoo 15 application but if you want more control over the application you can install it in a virtual environment or in a Docker container.
This tutorial will focus on the virtual environment deployment.
1. Updating the System
First we need to make sure that our operating system is updated.
sudo apt update -y && apt upgrade -y
2. Installing the Dependencies
sudo apt install python3-pip python-dev wget python3-dev python3-venv python3-wheel libxml2-dev libpq-dev libjpeg8-dev liblcms2-dev libxslt1-dev zlib1g-dev libsasl2-dev libldap2-dev build-essential git libssl-dev libffi-dev libmysqlclient-dev libjpeg-dev libblas-dev libatlas-base-dev -y
3. Installing the Database
Odoo uses PostgreSQL as a database. To install PostgresSQL server on Ubuntu run the follwing command.
sudo apt install postgresql -y
4. Creating System and PostgreSQL user
First we need to create a system user named odoo15 and set the home directory to /opt/odoo15. To do that we need to run the following command.
sudo useradd -m -d /opt/odoo15 -U -r -s /bin/bash odoo15
After creating the system user, we need to create a PostgreSQL user and we will named it also as odoo15.
sudo su - postgres -c "createuser -s odoo15"
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.
The version of wkhtmltopdf that we are going to install is version 0.12.5, as this is the recommended version for Odoo 15. Here are the steps in installing wkhtmltopdf.
First we need to download wkhtmltopdf 0.12.5.
sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
Then make it executable.
chmod +x wkhtmltox_0.12.5-1.bionic_amd64.deb
After making the file executable, install it by typing:
sudo apt install ./wkhtmltox_0.12.5-1.bionic_amd64.deb
6. Odoo 15 installation and configuration
First we need to switch to user odoo15.
su - odoo15
Cloning Odoo15 repository from Github
git clone https://www.github.com/odoo/odoo --depth 1 --branch 15.0 /opt/odoo15/odoo
Go to the Odoo directory.
cd /opt/odoo15
Create a virtual environment for your Odoo application.
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 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/odoo15/custom-addons
Let’s exit to odoo15 user and go back to our sudo user.
exit
Now we need to create the Odoo configuration file.
sudo nano /etc/odoo15.conf
Insert the content below:
[options]
; This is the password that allows database operations:
admin_passwd = admin_password
db_host = False
db_port = False
db_user = odoo15
db_password = False
xmlrpc_port = 8069
logfile = /var/log/odoo15/odoo.log
addons_path = /opt/odoo15/odoo/addons,/opt/odoo15/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/odoo15
Set the ownership to odoo15.
chown odoo15:root /var/log/odoo15
7. Create a Odoo 15 Systemd Service
We need to create a systemd service file to manage the Odoo 15 application.
sudo nano /etc/systemd/system/odoo15.service
Add or insert the following.
[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/myodoo-venv/bin/python3 /opt/odoo15/odoo/odoo-bin -c /etc/odoo15.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 Odoo15 service.
sudo systemctl enable --now odoo15
Check the status of the Odoo15 service.
systemctl status odoo15
You can now access your Odoo 15 application at http://ipaddress:8069
Conclusion
In this tutorial you have learned how to install Odoo 15 on Ubuntu 20.04. If you like this article you might also like our article on Odoo 15 on Ubuntu 22.04
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 ?
Hope you enjoy our tutorial ?