Enable Dark Mode!
how-to-install-odoo-17-on-ubuntu-20-04-lts-server.jpg
By: Rahna Rasheed

How to Install Odoo 17 on Ubuntu 20.04 LTS Server

Technical Odoo 17

Odoo 17 offers more performance enhancements, an enhanced user interface, and new functionality. PostgreSQL and Python 3.10 were needed for Odoo 17's database management system. This article will walk you through the process of installing Odoo 17 on an Ubuntu 20.04 LTS server step-by-step.

Step -1: Login to the Ubuntu server via SSH

ssh username@IP_Address -p Port_number 
Connect via SSH to your server. 

Step-2: Update Server

sudo apt-get update
sudo apt-get upgrade
Make sure the system is up to date.

Step-3: Secure Server

sudo apt-get install openssh-server fail2ban
SSH assaults can be avoided by utilizing Fail2ban.

Step-4: Install Packages and libraries

Install Odoo's necessary Python packages. Set up pip3.
sudo apt-get install -y python3-pip
Use the methods below to install web dependencies and packages. Verify that every package has been installed correctly and without any problems.
sudo apt-get install python-dev python3-dev libxml2-dev libxslt1-dev zlib1g-dev libsasl2-dev libldap2-dev build-essential libssl-dev libffi-dev libmysqlclient-dev libjpeg-dev libpq-dev libjpeg8-dev liblcms2-dev libblas-dev libatlas-base-dev
sudo apt-get install -y npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo npm install -g less less-plugin-clean-css
sudo apt-get install -y node-less

Step-5: Setup Database Server

As previously mentioned, PostgreSQL is the database server used by Odoo. 
sudo apt-get install postgresql
Setup and install the database. Establish a user to manage the database
sudo su - postgres
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo17
The user and the password are needed for the conf file. Postgres uses a distinct system user to perform tasks. To switch between users, run sudo su -postgres. Next, create a database user for Odoo 17.
psql
ALTER USER odoo17 WITH SUPERUSER;
If the user runs the aforementioned command, superuser access rights will be guaranteed. Next, log out of Postgres and PSQL.
\q
exit

Step-6: Create a system user

sudo adduser --system --home=/opt/odoo17 --group odoo17
Make a system user for security and to carry out Odoo tasks. This user will only have limited access to all of Odoo's files and directories.

Step-7: Get Odoo17 community from git

The Odoo source file needs to be uploaded to our server right now. Install git on the server first.
sudo apt-get install git
The file will then be added to the directory when you change the system user to Odoo17.
sudo su - odoo17 -s /bin/bash
The operator dot(.) at the end of the command is used to clone the files to the current user's home directory, which is /opt/odoo and was specified at the time of user creation. The following command will clone the source directory.
git clone https://www.github.com/odoo/odoo --depth 1 --branch 17.0 --single-branch .
Proceed with the installation after logging out of the user now.
exit

Step-8:Install Required Python Packages

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

Step-9:Install Wkhtmltopdf

Reports can be printed from Odoo as PDF files. Wkhtmltopdf facilitates the creation of PDF reports from HTML data. Additionally, the report engine converts the Qweb template reports to HTML format, and Wkhtmltopdf creates the PDF report:
sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb
sudo apt install -f

Step-10:Setup Conf file

Odoo requires certain information in order to function, such as the database user, password, locations of add-ons, etc. The configuration file will also have these available. Thus, the first thing we should do is create an Odoo configuration file. You can also find an example configuration file in the Odoo folder, which you can copy to the desired location. Configuration files are typically kept in /etc.
The configuration file should be copied to /etc.
sudo cp /opt/odoo17/debian/odoo.conf /etc/odoo17.conf
sudo nano /etc/odoo17.conf
Update the conf file same as shown in the code below.
[options]
   ; This is the password that allows database operations:
   admin_passwd = admin
   db_host = False
   db_port = False
   db_user = odoo17
   db_password = False
   addons_path = /opt/odoo17/addons
   logfile = /var/log/odoo/odoo17.log
Prior to conducting the operations, the following parameters need to be configured.
The master password for Odoo is admin_passwd, which can be used to create, delete, duplicate, and perform a variety of other database management operations.
the database host, or db_host.
Database port: db_port.
db_user: the name of the database user.
db_password: Enter the password that was entered when the database user was created.
addons_path: Provide the path to the directories containing the Odoo addon directories.
It is possible to list more than one directory, separated by commas:
Logfile: the path to the log file. For example, addons_path = /opt/odoo17/addons, /opt/odoo17/enterprise, /opt/odoo17/custom.
Next, you need to grant system user Odoo access to the conf file.
sudo chown odoo17: /etc/odoo17.conf
sudo chmod 640 /etc/odoo17.conf
Additionally, create an Odoo log directory and set permissions for it to assist you in identifying Odoo-related problems.
sudo mkdir /var/log/odoo
sudo chown odoo17:root /var/log/odoo

Step-11:Odoo service file

We have to create a service to run Odoo. Let’s create a service file ‘odoo.service’ in /etc/systemd/system.
sudo nano /etc/systemd/system/odoo17.service
Add the following aspects to the newly created service file.
[Unit]
   Description=Odoo17
   Documentation=http://www.odoo.com
   [Service]
   # Ubuntu/Debian convention:
   Type=simple
   User=odoo17
   ExecStart=/opt/odoo17/odoo-bin -c /etc/odoo17.conf
   [Install]
   WantedBy=default.target
Finally, set the root user's permissions for this service file.
sudo chmod 755 /etc/systemd/system/odoo17.service
sudo chown root: /etc/systemd/system/odoo17.service

Step-12:Run Odoo17

sudo systemctl start odoo17.service
Use the above command to launch the Odoo instance. Then, use the following command to see the service's current status. Furthermore, the installation of Odoo was successful if it is shown as active.
sudo systemctl status odoo17.service
Now, you can access Odoo by entering the following URL. It will reroute to the database creation page.
"http://<your_domain_or_IP_address>:8069"
Check Odoo logs
If you are experiencing problems with the installation or for any other reason, you can use the following command to examine the logs of the Odoo platform that you have configured. You can view the real-time logs in the terminal by using this command.
sudo tail -f /var/log/odoo/odoo.log
Finally, use the following command to start the Odoo service automatically after restarting the server:
sudo systemctl enable odoo17.service
Use the following command to restart the Odoo service if you have made any modifications to the add-ons so that your instance will reflect the updates
sudo systemctl restart odoo17.service
After installing Odoo successfully, you can start your career in Odoo development and learn more about it by using our Odoo Development Tutorial App, which you can access from the Odoo Apps Page.
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.



10
Comments

Nada

give me error because version of python in ubuntu 20 is 3.8 and odoo 17 needs at least python3.10

28/11/2023

-

7:09AM

Salman

The only information missing in the document is Python 3.10 as a pre-requisite. Rest is OK.

26/02/2024

-

8:11AM

josi

cant we ave a deb file tat can install it itself?

23/01/2024

-

9:30AM

Chijioke Kanu

After all the installation and you run the : #sudo systemctl status odoo17.service It'll show an error message saying: "AssertionError: Outdated python version detected, Odoo requires Python >= 3.10 to run."

20/11/2023

-

6:02AM

Jerom

Bonjour, Vous avez fait une erreur : sudo pip3 install -r /opt/odoo/requirements.txt mais sudo pip3 install -r /opt/odoo17/requirements.txt Bonne soirée

18/12/2023

-

7:29PM

muhammad

I try to install depend on your document but at last my odoo service is not active due to python version error!i want to install ubuntu 20.04 lts server odoo v17.Any changes for your document?

16/01/2024

-

9:53AM

Hieu

Get error on Step-8 :Install Required Python Packages: "error: externally-managed-environment × This environment is externally managed ?-> To install Python packages system-wide, try apt install python3-xyz, where xyz is the package you are trying to install. If you wish to install a non-Debian-packaged Python package, create a virtual environment using python3 -m venv path/to/venv. Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make sure you have python3-full installed. If you wish to install a non-Debian packaged Python application, it may be easiest to use pipx install xyz, which will manage a virtual environment for you. Make sure you have pipx installed. See /usr/share/doc/python3.11/README.venv for more information."

13/12/2023

-

3:32AM

arj

this document install python 3.8.so not start odoo service.

12/01/2024

-

9:43AM

Olive Godswill

for step 7, if the repo is cloned in the odoo user directory, we cant install requirements outside it

05/01/2024

-

3:38PM

Gulshan Kumar

This is not working. Install Required Python Packages gives error

04/01/2024

-

3:16PM



Leave a comment

 


whatsapp
location

Calicut

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

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