Enable Dark Mode!
how-to-install-odoo-16-on-ubuntu-22-04-lts-server.jpg
By: Mohamed Aslam AK

How to Install Odoo 16 on Ubuntu 22.04 LTS Server

Technical Odoo 16 Odoo Enterprises Odoo Community

Odoo 16, the most recent version of Odoo, is renowned for its extensive and advanced features that make it a prime choice for comprehensive business management solutions. Powered by Python 3.8+ for backend development, PostgreSQL as the database server, and JavaScript for frontend development, Odoo 16 offers a cutting-edge framework. 

Ubuntu 22.04, a Long-Term Support (LTS) release, guarantees ongoing app updates and critical security fixes for an impressive five-year span post-release. This includes regular software updates like new Linux kernel releases and graphics driver enhancements every six months. 

In this article, we will guide you through the process of establishing a development environment for Odoo 16 on Ubuntu 22.04 LTS Server. We will break down the steps to ensure a smooth setup that allows you to harness the full potential of Odoo 16.

Update the system:

To install Odoo16 on an Ubuntu 22.04 LTS Server Open terminal and in the terminal, use the ssh command followed by the remote server's IP address or hostname and your username. Replace <server_ip> with the actual IP address or hostname, and <username> with your username on the server.

ssh <username>@<server_ip>

For example, 

ssh ubuntu@192.168.1.100

After logging in to the server by providing the password, verify that the server version is Ubuntu 22.04 itself. To verify the version, use the command

lsb_release -a 

Which will provide the version details like this.

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 22.04.2 LTS
Release: 22.04
Codename: jammy

Next, run the following command to ensure that all installed packages on the server are updated to their most current available versions:

sudo apt update && sudo apt upgrade

Create a System User:

We're installing Odoo 16 on a specific system user account. For this, we need to make a new system account. Use the given command to create a user called "odoo16".

sudo useradd -m -d /opt/odoo16 -U -r -s /bin/bash odoo

Install Dependencies for Odoo:

We have to add some extra Python packages like Python version, wheel, venv, etc., to our Ubuntu 22.04 system before we can install Odoo 16. To do this, Run the following command:

sudo apt install build-essential wget git python3-pip python3-dev python3-venv python3-wheel libfreetype6-dev libxml2-dev libzip-dev libsasl2-dev python3-setuptools libjpeg-dev zlib1g-dev libpq-dev libxslt1-dev libldap2-dev libtiff5-dev libopenjp2-7-dev

Install  and Configure the PostgreSQL database server:

Odoo exclusively uses PostgreSQL for its data storage. Now run this command to install the PostgreSQL server on our Ubuntu 22.04 system.

sudo apt install postgresql

After installation, run this command to create a new Postgresql user for Odoo16.

sudo su - postgres -c "createuser -s odoo16"

Install Wkhtmltopdf:

Odoo requires the Wkhtmltopdf package for printing-related purposes, which is a free, open-source command-line utility that utilizes the Qt webkit engine to transform HTML content into PDF. Install Wkhtmltopdf by executing this command.

sudo apt install wkhtmltopdf

Since Odoo requires a wkhtmltopdf 0.12.1 or higher version verify it by using

wkhtmltopdf --version

And the output will be as follows:

wkhtmltopdf 0.12.6

Install Odoo:

To install Odoo 16, we can clone odoo16 from the odoo git repository. So first, we need to install Git to clone odoo16 to our server.

sudo apt-get install git

Next, it's important to switch to the system user we established for Odoo. This step is crucial to avoid encountering issues related to access rights. So we can switch to the user that we have created before. 

sudo su - odoo16

Now we are ready to clone Odoo 16 (Community Edition)

git clone https://www.github.com/odoo/odoo --depth 1 --branch 16.0 odoo16

In this guide, we will set up Odoo 16 within a Python virtual environment. Once the cloning process is finished, run the subsequent command to generate a new Python virtual environment.

python3 -m venv odoo16-venv

After the virtual environment is installed, we need to activate it by running

source odoo16-venv/bin/activate

After running the command, your shell prompt will appear like this:

(odoo16-venv) odoo16@ubuntu:~$

Now, let's proceed to install Odoo.

(odoo16-venv) odoo16@ubuntu:~$ pip3 install wheel
(odoo16-venv) odoo16@ubuntu:~$ pip3 install -r odoo16/requirements.txt

After completing the process of installing all requirements and building wheels exit from the odo16-venv 

(odoo16-venv) odoo16@ubuntu:~$ deactivate

Now we can now make a new directory where we'll store our customized Odoo add-ons.

mkdir /opt/odoo16/odoo16/custom

Now exit from the user “odoo16” and create the Odoo16 Configuration file.

exit
sudo nano /etc/odoo16.conf

Now paste this configuration into it.

[options]
admin_passwd = admin
db_host = False
db_port = False
db_user = odoo16
db_password = False
addons_path = /opt/odoo16/odoo16/addons,/opt/odoo16/odoo16/custom
xmlrpc_port = 8016

Remember to update the value of the "admin" key above with a more secure password. This password acts as your Odoo master password, which is necessary for creating or deleting databases.

Create an Odoo Service

We have to create a systemd unit for Odoo16 So that it can behave like a service.

sudo nano /etc/systemd/system/odoo16.service

Copy and paste the following content into the systemd unit file odoo16.service:

[Unit]
Description=Odoo16
Requires=postgresql.service
After=network.target postgresql.service
[Service]
Type=simple
SyslogIdentifier=odoo16
PermissionsStartOnly=true
User=odoo16
Group=odoo16
ExecStart=/opt/odoo16/odoo16-venv/bin/python3 /opt/odoo16/odoo16/odoo-bin -c /etc/odoo16.conf
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target

That concludes the setup. You can now reload systemd and start running Odoo16. Since we edited the service file, we need to run daemon-reload

sudo systemctl daemon-reload
sudo systemctl start odoo16

Check if Odoo is active by running this command:

sudo systemctl status odoo16

Now open your web browser and go to http://your_server_ip_address:8016. This will take you to the Odoo page.

how-to-install-odoo-16-on-ubuntu-22-04-lts-server-1-cybrosys

Finally, after creating the database, you will be redirected to the Odoo login page.

how-to-install-odoo-16-on-ubuntu-22-04-lts-server-2-cybrosys

To read more about installing Odoo 16 on Ubuntu 20.04 LTS, refer to our blog How to Install Odoo 16 on Ubuntu 20.04 LTS


If you need any assistance in odoo, we are online, please chat with us.



1
Comments

Paul

Thank you for this article. Please note there is an error in the CLI statements for creating the odoo user: Where it says "sudo useradd -m -d /opt/odoo16 -U -r -s /bin/bash odoo" it shoud read: "sudo useradd -m -d /opt/odoo16 -U -r -s /bin/bash odoo16"

15/09/2023

-

11:59AM



Leave a comment

 


whatsapp
location

Calicut

Cybrosys Technologies Pvt. Ltd.
Neospace, Kinfra Techno Park
Kakkancherry, Calicut
Kerala, India - 673635

location

London

Cybrosys Limited
Alpha House,
100 Borough High Street, London,
SE1 1LB, United Kingdom

location

Kochi

Cybrosys Technologies Pvt. Ltd.
1st Floor, Thapasya Building,
Infopark, Kakkanad,
Kochi, India - 682030.

location

Bangalore

Cybrosys Techno Solutions
The Estate, 8th Floor,
Dickenson Road,
Bangalore, India - 560042

Send Us A Message