Innovate | Connect | Transform
ContactService statusUSD $

GICT knowledge base

Installing Odoo 16 on Ubuntu 20.04: A Complete Guide

Published

Install_odoo16_in_ubuntu

Installing Odoo 16 on an Ubuntu system requires a systematic approach to ensure smooth configuration and functionality. This tutorial serves as a comprehensive guide to walk you through each step of the installation process. From establishing an SSH connection to executing Odoo 16, every crucial aspect will be covered to facilitate a successful installation.

You will be guided through the installation process of Odoo 16 on an Ubuntu 20.04 system in this blog. In this tutorial, the entire configuration procedure will be covered.

Step 1. Connect to the Ubuntu server via SSH.

The first stage involves establishing an SSH connection to the server. Establish a connection to the server with ease using SSH:

The command to establish a connection is ssh username@IP_Address -p Port_number.

For instance, execute ssh [email protected] -p 22

Step 2. Upgrade your server.

Subsequently, log in to verify that your server is current.

sudo apt-get update

sudo apt-get upgrade

Step 3. Secure your server.

Ensure that the system is safeguarded against SSH attacks; Fail2ban can offer support with this concern.

Develop a system user account.

A system user will then be assigned the responsibility of executing Odoo functions and ensuring security.

The user is granted restricted access to Odoo locations and files.

Following this, we shall subsequently deny this user access to any directories or files associated with Odoo.

sudo adduser --system --home=/opt/odoo16—group "odoo16"

Step 4. Install the packages and libraries.

Install the Python packages required by Odoo.
Install pip3:

sudo apt-get install -y python 3-pip

Install the libraries and packages.

Execute the following to install libraries and packages;

sudo apt-get install python-dev python3.-dev libxml2, libxslt1, and zlib1g.-dev libsasl2.-dev libldap2-dev; build-essential libssl-dev libffi.-dev libmysqlclient, libjpeg.--dev libpq, libjpeg8-dev liblcms2.--dev libblas.--dev libatlas-base.-dev

Consolidate every web dependency.

sudo apt-get install -y npm

Then execute:

npm install -g less-plugin-clean-css and apt-get install -y node-lessto install less.

Step 5: PostgreSQL configuration.

Odoo uses PostgreSQL as a database server. To configure and install the Odoo database server, follow the instructions below.

sudo apt-get install postgresql

In the following step, you will create a PostgreSQL user to administer the databases. Finally, the user and password are requested in the configuration file.

The Postgres actions are carried out by a different system user named “Postgres.” To change the PostgreSQL user, run the following command:

sudo su postgres

To create an Odoo16 user account, follow the steps below.

Additionally, the Odoo16 password must be changed at this time. After completing the installation process, the newly generated password must be entered into the Odoo configuration file.

createuser --createdb --username postgres --no-createrole --no-superuser —pwprompt odoo16

To receive further authorizations, the user must be promoted to the position of superuser.

psql ALTER USER odoo16 WITH SUPERUSER

Exit

Step 6: Download the Odoo 16 community from Git.

At this time, the Odoo source file must be uploaded to our server. The Community Edition source code is clonable from the Odoo GitHub repository. After the installation is finished, the Enterprise edition add-ons can be added.

Install Git on the server initially.

sudo apt-get install git

In order to increase the security of the Odoo system, the system user must be changed to Odoo (as outlined in Step 3), followed by cloning.

sudo su Odoo16 -s /bin/bash

By appending the dot (.) operator to the command, the files are copied to the home directory (/opt/odoo) of the current user. The home directory that was designated during the user’s creation remains unchanged.

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

Following that, log out of the user and complete the installation.

exit

Step 7: Install the required Python packages.

Odoo makes use of a wide variety of Python packages and libraries in order to accomplish a wide range of goals. Before we can begin using Odoo, it is necessary to install it using the pip3 package. In addition, the requirement.txt file that is located in the Odoo folder contains a list of the most important prerequisites that must be met. As a consequence of this, the pip install command will automatically install all of the packages that are specified in the requirement.txt file if this file is passed to it as an argument.

sudo pip3 install -r /opt/odoo16/requirements.txt

Every package must be installed in the correct way for Odoo to operate at its intended level.

Install WkhtmltoPDF.

When utilizing Odoo, users can export reports to PDF format. Utilizing Wkhtmltopdf makes the process of converting HTML data into PDF reports much more straightforward. Wkhtmltopdf is responsible for the generation of the PDF report, whereas the report engine is responsible for converting the Qweb template reports to the HTML version.

sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb

sudo apt install -f

Step 8: Set up the Conf file.

Odoo needs specific information to work right, like the database user name, password, addresses of add-ons, and so on. The configuration file also has information about these. Making an Odoo configuration file is the first thing that you do. You can also take a sample configuration file from the Odoo folder and then import it where you want it to go. In most cases, configuration files are kept in /etc.  

To copy the setup file to /etc:

sudo copy /opt/odoo16/debian/odoo.conf to /etc/odoo16.conf

running the command sudo

After that, the file needs to have the right information added to it.

Run the command

sudo nano /etc/odoo16.conf

Replace the placeholders in the configuration file with your actual details:

  • admin_passwd: Set a strong password for the Odoo administrator account.
  • db_name: The name of the database created for Odoo.
  • db_user: The username for the database user created for Odoo.
  • db_password: The password for the database user created for Odoo.
  • addons_path: The directory containing Odoo addons (default: /opt/odoo16/addons).
  • logfile: The path to the log file for Odoo (default: /var/log/odoo/odoo16.log).

 

Save the changes made to the configuration file.

After saving the configuration file, run the following commands to restrict access:

sudo chown odoo16:odoo16 /etc/odoo16.conf

sudo chmod 640 /etc/odoo16.conf

Create a dedicated directory for Odoo logs:

sudo mkdir /var/log/odoo

 Set the ownership and permissions for the log directory:

sudo chown odoo16:odoo16 /var/log/odoo

Step 9: Service File for Odoo

Following the creation of the conf file, a service must be created to run Odoo. Create the ‘odoo16.service’ service file in the /etc/systemd/system directory.

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

The following components should be incorporated into the service file that was just recently generated:

[Unit]

Description=Odoo 16

[Service]

Type=simple

User=odoo16

WorkingDirectory=/opt/odoo16 # Replace with your Odoo directory if different

ExecStart=/opt/odoo16/odoo-bin -c /etc/odoo16.conf

[Install]

WantedBy=multi-user.target

Ultimately, bestow permissions to access this service file on the root user.

sudo chmod 755 /etc/systemd/system/odoo16.service

sudo chown root: /etc/systemd/system/odoo16.service

Step 10: Execute Odoo 16.

Following the successful completion of all of the procedures that came before it, proceed to execute the following command on the Odoo instance:

sudo systemctl start odoo16.service

To determine the Odoo service’s status, execute the command below.

sudo systemctl status Odoo16.service

Odoo can be accessed via the subsequent URL.

“http://:8069”

After the configuration has been completed successfully, you will be taken to the interface where you will be able to continue with the process of creating a database.
Examine Odoo’s logs.

In the case that you experience any difficulties during the installation process or for any other reason, you have the option of consulting the logs of the Odoo platform that has been configured by providing the following command. These live logs of the terminal are displayed by the command that comes after it:

sudo tail -f /var/log/odoo/odoo.log

Lastly, the following command should be executed in order to initiate the Odoo service automatically after the server has been restarted:

sudo systemctl enable odoo16.service

It is suggested that you use the following command to restart the Odoo service after making changes to any add-ons. This will make sure that the changes are seen in your case.

sudo systemctl restart Odoo16.service

Please use our Odoo Development Tutorial App from start to end; there, you can find it on the Odoo Apps Page after you have successfully installed Odoo 16. Get this app to learn more about Odoo Development and start your professional Odoo journey.

Conclusion

In this article, we’ve covered a lot in this guide to installing Odoo 16 on Ubuntu 20.04. From getting your server ready to firing up Odoo, we’ve gone step by step to make sure everything runs smoothly.

By now, you’ve learned how to connect to your server using SSH, upgrade it to keep things current, and secure it against any pesky attacks. Plus, we’ve installed all the necessary packages and libraries Odoo needs to do its thing, and set up PostgreSQL as its database server.

With all that done, you should be good to go with Odoo 16. Whether you’re using it for business or just to learn, you’re all set to dive in and explore what Odoo has to offer. And if you run into any hiccups along the way, don’t forget to check the logs for clues.

Account services are unavailable until the production backend is configured.