How to Install Odoo 17 on Ubuntu 20.04 LTS Server

How to Install Odoo 17 on Ubuntu 20.04 LTS Server

5 minutes, 34 seconds Read

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

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *