Enable Dark Mode!
how-to-install-odoo-15-on-ubuntu-2004-lts-server.jpg
By: Hajaj Roshan

How to Install Odoo 15 on Ubuntu 20.04 LTS Server

Technical Odoo 15

Odoo 15 comes with exciting new features, a better user experience, and more improvements in performance. Odoo 15 required Python 3.8 and PostgreSQL for the database management system. Let’s get started from the very beginning.

How to Install Odoo 15 on Ubuntu 20.04?

This blog will describe the installation aspects of Odoo 15 in an Ubuntu server 20.04 LTS and will help to understand its process.
Note: All of these steps will go through the terminal(Command Line Interface).

Step-1: Login to the Server and Update

Login to the server using ssh: 
	ssh <username>@<IP address>
eg: ssh root@127.0.0.1
Ensure that system is updated:
sudo apt-get update
sudo apt-get upgrade

Step 2: Secure Server

Ensure the system is secure from ssh attacks, the use of Fail2ban will help to prevent ssh attacks:
sudo apt-get install openssh-server fail2ban

Step 3: Install Python 3 and its Dependencies

Install the required python packages for Odoo:
Install pip3:
sudo apt-get install -y python3-pip
Then install Packages and libraries:
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
Make sure that all packages are installed correctly without any errors. After successful installation of Python packages, some web dependencies are also needed to be installed. 
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 4: Setup Database Server(PostgreSQL)

Odoo uses PostgreSQL as its database server. Follow the steps to install and setup the database server for Odoo:
sudo apt-get install postgresql
In the next step, create a Postgres user to handle the database. The user and given password are needed for the conf file later.
Postgres has its own system user called ‘Postgres to perform the operations. So next command for changing user to Postgres:
sudo su - postgres
Next, let's create a database user for Odoo15. When you enter the following command, it will ask for a password and re-enter it again. Remember this for later use:
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo15
The following command ensures that the user has superuser access rights:
psql
ALTER USER odoo15 WITH SUPERUSER;
Exit from psql and Postgres user:
\q
exit

Step 5: System User

Next, let's create a system user to perform Odoo roles and also for security purposes. All the files and directories of Odoo’s access and operations will be limited for this user. 
Now let us create a new system user for the Odoo service and further then we will limit the permissions of all Odoo-related files and directories for this specific user.
sudo adduser --system --home=/opt/odoo --group odoo

Step 6: Clone Odoo Source from Github Repository

With the Community Edition source code, we can directly clone from Odoo’s GitHub repository. You can add the Enterprise edition add-ons after the installation process is completed.
So first install git to the server:
sudo apt-get install git
Next, switch the system user to ‘odoo’ and the files will be added to the user’s home directory:
sudo su - odoo -s /bin/bash
The following command will clone the source directory and the operator dot(.) at the end of the command is used to clone the files to the home directory of the current user which is /opt/odoo and is the same home directory mentioned at the time of user creation:
git clone https://www.github.com/odoo/odoo --depth 1 --branch 15.0 --single-branch .
Then exit from the user and continue the installation:
exit

Step 7: Install Required Python Packages

The next step is to install the required packages. All the packages are listed in the requirement.txt file. Therefore, we can easily install these packages with a single command:
sudo pip3 install -r /opt/odoo/requirements.txt
To run Odoo smoothly, all the packages should be installed properly and you should ensure that.

Step 8: Install Wkhtmltopdf

Odoo supports printing reports as PDF files. Wkhtmltopdf helps to generate PDF reports from HTML data format. Moreover, the Qweb template reports are converted to HTML format by the report engine and Wkhtmltopdf will produce 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 9: Setup Conf file

Next, we have to configure the conf file for Odoo which contains certain necessary information such as the addons path, database-related parameters, proxy parameters, and many more. 
Therefore, you should create a configuration file inside the /etc directory. There is a sample conf file inside Odoo’s source, in the Debian directory. To copy from Debian to the /etc directory use the following command:
sudo cp /opt/odoo/debian/odoo.conf /etc/odoo.conf
This file contains sample values, and you should edit the file with proper values:
sudo nano /etc/odoo.conf
Update admin password and db_password from the following sample.
[options]
   ; This is the password that allows database operations:
   admin_passwd = admin
   db_host = False
   db_port = False
   db_user = odoo15
   db_password = False
   addons_path = /opt/odoo/addons
   logfile = /var/log/odoo/odoo.log
The following aspects should be configured before the operations are conducted:
db_user: the database user name.
db_password: provide db user password which is given while creating the db user.
admin_passwd: This is the master password of Odoo which is used to perform database operations in the database manager like create, delete, duplicate, and many more.
db_host: the database host.
db_port:  the database port.
addons_path: provide the path of directories that contain the Odoo addons directories. You can mention multiple directories separated by commas:
Eg: addons_path = /opt/odoo/addons,  /opt/odoo/enterprise, /opt/odoo/custom
logfile: the log file path.
Finally, you should set access rights of the conf file for the system user odoo:
sudo chown odoo: /etc/odoo.conf
sudo chmod 640 /etc/odoo.conf
And create a log directory to store the log file of odoo which will help you to find Odoo-related issues and also set permissions for the user odoo as we did earlier:
sudo mkdir /var/log/odoo
sudo chown odoo:root /var/log/odoo

Step 10: Odoo service file

Finally, 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/odoo.service
Add the following content to the newly created service file
[Unit]
   Description=Odoo
   Documentation=http://www.odoo.com
   [Service]
   # Ubuntu/Debian convention:
   Type=simple
   User=odoo
   ExecStart=/opt/odoo/odoo-bin -c /etc/odoo.conf
   [Install]
   WantedBy=default.target
Next set the permissions for the root user to this service file:
sudo chmod 755 /etc/systemd/system/odoo.service
sudo chown root: /etc/systemd/system/odoo.service

Step 11: Test Odoo 15

Now all the steps of installation are completed. Let's test the Odoo instance with the following command:
sudo systemctl start odoo.service
Then check the status of the service using the following command. And if it depicts as active, the installation of Odoo was successful:
sudo systemctl status odoo.service
Now you can access Odoo by entering the following URL:
“http://<your_domain_or_IP_address>:8069”
This will redirect you to the database creation page if everything is set up correctly.

Check Odoo logs

You can also check the logs of the Odoo platform that you have set up if you are facing any issues related to the installation or any other reasons with the following command. This command will show you the live logs in the terminal:
sudo tail -f /var/log/odoo/odoo.log
At last, if you want to start the Odoo service automatically after rebooting the server, use the following command:
sudo systemctl enable odoo.service
If you have made any changes in the addons, restart the Odoo service to reflect the updates on your instance using the following command:
sudo systemctl restart odoo.service
Have a look at the following blog to explore more about Install Odoo 16 Ubuntu 22.04. Install Odoo 16 Ubuntu 22.04


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



18
Comments

DK

I have same error with odoo15 user in bd

31/05/2022

-

4:51PM

Sergey

Step 7 - correct will sudo pip3 install -r /opt/odoo/odoo/requirements.txt

27/09/2021

-

6:47PM

reply REPLY

Cybrosys

Hi Sergey, That's because you cloned into a different directory. I suggest you follow all steps as same as in the blog, Step 7 is the correct one.

David

Problems / fixes Ubuntu-22.04.1 link already present so ignore error = sudo ln -s /usr/bin/nodejs /usr/bin/node install Packages and libraries: = change python-dev to python-dev-is-python3 Install Required Python Packages = before running requirements.txt run sudo apt install python3-cffi Setup Conf file = db_host = localhost and set your password :)

24/08/2022

-

8:35PM

faydra

psycopg2.OperationalError: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: FATAL: Peer authentication failed for user "odoo15" - - -

22/03/2022

-

10:44AM

Ousman

Hello I want to recall my previous comment You already fixed the issue in this procedure https://www.cybrosys.com/blog/how-to-solve-the-peer-authentication-failed-issue-in-odoo Thank you

21/10/2022

-

5:14AM

Ousman

Hello I follow all the steps above., then I enter http://mydomain.com:8069, and it asked me to create a database. Ifill my admin password and db_password exactly like the one in /etc/odoo.conf but I'm not able to create the Database I'm getting the error: Database creation error: FATAL: Peer authentication failed for user "odoo15" In postgres I ran ALTER user odoo15 with password 'xxxxxxxxxx'; I use that password in /etc/odoo.conf then I started odoo, I'm getting the same issue Please can you help?

21/10/2022

-

4:53AM

basha

Hi, I have the same error.. I followed exact steps.. iam receiving the following erro.... ERROR: Could not open requirements file: [Errno 2] No such file or directory: '/opt/odoo/requirements.txt' Any help?

20/02/2022

-

12:27PM

noufal

role "odoo" does not exist ------------------------------------------ systemctl status odoo.service ? odoo.service - Odoo Loaded: loaded (/etc/systemd/system/odoo.service; disabled; vendor preset: enabled) Active: active (running) since Fri 2022-03-18 12:44:12 UTC; 7min ago Docs: http://www.odoo.com Main PID: 34866 (python3 /source) Tasks: 2 (limit: 1081) Memory: 69.3M CGroup: /system.slice/odoo.service +-34866 python3 /source_file/odoo/odoo-bin -c /etc/odoo.conf Mar 18 12:44:13 app odoo-bin[34866]: return Cursor(self.__pool, self.dbname, self.dsn, serialized=serialized) Mar 18 12:44:13 app odoo-bin[34866]: File "/source_file/odoo/odoo/sql_db.py", line 256, in __init__ Mar 18 12:44:13 app odoo-bin[34866]: self._cnx = pool.borrow(dsn) Mar 18 12:44:13 app odoo-bin[34866]: File "/source_file/odoo/odoo/sql_db.py", line 589, in _locked Mar 18 12:44:13 app odoo-bin[34866]: return fun(self, *args, **kwargs) Mar 18 12:44:13 app odoo-bin[34866]: File "/source_file/odoo/odoo/sql_db.py", line 655, in borrow Mar 18 12:44:13 app odoo-bin[34866]: result = psycopg2.connect( Mar 18 12:44:13 app odoo-bin[34866]: File "/usr/local/lib/python3.8/dist-packages/psycopg2/__init__.py", line 127, in connect Mar 18 12:44:13 app odoo-bin[34866]: conn = _connect(dsn, connection_factory=connection_factory, **kwasync) Mar 18 12:44:13 app odoo-bin[34866]: psycopg2.OperationalError: FATAL: role "odoo" does not exist

18/03/2022

-

12:54PM

reply REPLY

Cybrosys

In this blog we created the database user 'odoo15', maybe you provided db_user in the conf file as 'odoo'. you can change it into odoo15 and restart the service.

kia

i installed an odoo but this is not full program .for example havent accountig ,... how can i used acountig? i think i have to cracked it. can you help me?

17/07/2023

-

12:21PM

tuanphamdvf

Hi, I have the same error.. Feb 14 06:03:33 vps-23-02-13-09-50-03-031 python3[23613]: 2023-02-14 06:03:33,704 23613 ERROR ? odoo.service.server: Failed to load server-wide module `web`. Feb 14 06:03:33 vps-23-02-13-09-50-03-031 python3[23613]: The `web` module is provided by the addons found in the `openerp-web` project. Feb 14 06:03:33 vps-23-02-13-09-50-03-031 python3[23613]: Maybe you forgot to add those addons in your addons_path configuration. Feb 14 06:03:33 vps-23-02-13-09-50-03-031 python3[23613]: Traceback (most recent call last): Feb 14 06:03:33 vps-23-02-13-09-50-03-031 python3[23613]: File "/opt/odoo/duoc_nam_yen/odoo/service/server.py", line 1196, in load_server_wide_modules Feb 14 06:03:33 vps-23-02-13-09-50-03-031 python3[23613]: odoo.modules.module.load_openerp_module(m) Feb 14 06:03:33 vps-23-02-13-09-50-03-031 python3[23613]: File "/opt/odoo/duoc_nam_yen/odoo/modules/module.py", line 396, in load_openerp_module Feb 14 06:03:33 vps-23-02-13-09-50-03-031 python3[23613]: __import__('odoo.addons.' + module_name) Feb 14 06:03:33 vps-23-02-13-09-50-03-031 python3[23613]: ModuleNotFoundError: No module named 'odoo.addons.web'

14/02/2023

-

6:05AM

Vinicius Sa

solved Peer authentication failed for user "odoo15"" edit: nano /etc/postgresql/12/main/pg_hba.conf add the line: # Database administrative login by Unix domain socket ... local all odoo15 md5 restart database service: service postgresql restart voalà!! :)

10/02/2023

-

1:23AM

elshafey

Database creation error: FATAL: Peer authentication failed for user "odoo15"

09/12/2022

-

11:20PM

khattab

when i usnig sudo systemctl status odoo.service why :| and how can i start to using odoo ? https://imgur.com/a/hjBRlc4 khattab2@khattab2-Pred1:~$ sudo systemctl status odoo.service ? odoo.service - Odoo Loaded: loaded (/etc/systemd/system/odoo.service; enabled; vendor preset: > Active: active (running) since Sat 2022-05-07 19:49:22 +03; 21s ago Docs: http://www.odoo.com Main PID: 32754 (python3) Tasks: 2 (limit: 18928) Memory: 60.4M CGroup: /system.slice/odoo.service +-32754 python3 /opt/odoo/odoo-bin -c /etc/odoo.conf ???? 07 19:49:23 khattab2-Predator-PH315-51 odoo-bin[32754]: result = psyco> ???? 07 19:49:23 khattab2-Predator-PH315-51 odoo-bin[32754]: File "/usr/local> ???? 07 19:49:23 khattab2-Predator-PH315-51 odoo-bin[32754]: conn = _connec> ???? 07 19:49:23 khattab2-Predator-PH315-51 odoo-bin[32754]: psycopg2.Operation> ???? 07 19:49:23 khattab2-Predator-PH315-51 odoo-bin[32754]: Is the ser> ???? 07 19:49:23 khattab2-Predator-PH315-51 odoo-bin[32754]: TCP/IP con> ???? 07 19:49:23 khattab2-Predator-PH315-51 odoo-bin[32754]: conn = _connec> ???? 07 19:49:23 khattab2-Predator-PH315-51 odoo-bin[32754]: psycopg2.Operation> ???? 07 19:49:23 khattab2-Predator-PH315-51 odoo-bin[32754]: Is the ser> ???? 07 19:49:23 khattab2-Predator-PH315-51 odoo-bin[32754]: TCP/IP con> lines 1-20/20 (END)

07/05/2022

-

4:53PM

dani

test odoo15 in sudo systemctl status odoo.service corect : odoo.service - Odoo Loaded: loaded (/etc/systemd/system/odoo.service; disabled; vendor preset: enabled) Active: active (running) since Thu 2022-04-07 10:48:03 WIB; 45min ago Docs: http://www.odoo.com Main PID: 59851 (python3) Tasks: 2 (limit: 9235) Memory: 78.2M CGroup: /system.slice/odoo.service +-59851 python3 /opt/odoo/odoo-bin -c /etc/odoo.conf Apr 07 10:48:04 ubuntu20 odoo-bin[59851]: return Cursor(self.__pool, self.dbname, self.dsn, serialized=serialized) Apr 07 10:48:04 ubuntu20 odoo-bin[59851]: File "/opt/odoo/odoo/sql_db.py", line 256, in __init__ Apr 07 10:48:04 ubuntu20 odoo-bin[59851]: self._cnx = pool.borrow(dsn) Apr 07 10:48:04 ubuntu20 odoo-bin[59851]: File "/opt/odoo/odoo/sql_db.py", line 589, in _locked Apr 07 10:48:04 ubuntu20 odoo-bin[59851]: return fun(self, *args, **kwargs) Apr 07 10:48:04 ubuntu20 odoo-bin[59851]: File "/opt/odoo/odoo/sql_db.py", line 655, in borrow Apr 07 10:48:04 ubuntu20 odoo-bin[59851]: result = psycopg2.connect( Apr 07 10:48:04 ubuntu20 odoo-bin[59851]: File "/usr/local/lib/python3.8/dist-packages/psycopg2/__init__.py", line 127, in connect Apr 07 10:48:04 ubuntu20 odoo-bin[59851]: conn = _connect(dsn, connection_factory=connection_factory, **kwasync) Apr 07 10:48:04 ubuntu20 odoo-bin[59851]: psycopg2.OperationalError: FATAL: Peer authentication failed for user "odoo15"

07/04/2022

-

4:36AM

Mahmoud Saed

After doing the steps you have mentioned above, the installation of odoo was successful but there is an issue that I couldn't resolve it I have installed pycharm and when I try to open odoo code from its path /opt/odoo, all the files are in read-only status so I couldn't edit or modify on it please help me with that issue suggestions: Have I login with the system user which I created in step 5 (System User) odoo?

07/03/2022

-

6:04AM

Daniel Bazzi

sud oapt --fix-broken install if you get an error in Wkhtmltopdf

06/12/2022

-

1:11AM

Supachai Nilcha

Jun 06 09:47:13 odoo15 odoo-bin[1978]: return Cursor(self.__pool, self.dbname, self.dsn, serialized=serialized) Jun 06 09:47:13 odoo15 odoo-bin[1978]: File "/opt/odoo/odoo/sql_db.py", line 256, in __init__ Jun 06 09:47:13 odoo15 odoo-bin[1978]: self._cnx = pool.borrow(dsn) Jun 06 09:47:13 odoo15 odoo-bin[1978]: File "/opt/odoo/odoo/sql_db.py", line 589, in _locked Jun 06 09:47:13 odoo15 odoo-bin[1978]: return fun(self, *args, **kwargs) Jun 06 09:47:13 odoo15 odoo-bin[1978]: File "/opt/odoo/odoo/sql_db.py", line 655, in borrow Jun 06 09:47:13 odoo15 odoo-bin[1978]: result = psycopg2.connect( Jun 06 09:47:13 odoo15 odoo-bin[1978]: File "/usr/local/lib/python3.8/dist-packages/psycopg2/__init__.py", line 127, in connect Jun 06 09:47:13 odoo15 odoo-bin[1978]: conn = _connect(dsn, connection_factory=connection_factory, **kwasync) Jun 06 09:47:13 odoo15 odoo-bin[1978]: psycopg2.OperationalError: FATAL: Peer authentication failed for user "odoo15"

06/06/2022

-

2:49AM

Ruthvick

× odoo.service - Odoo Loaded: loaded (/etc/systemd/system/odoo.service; disabled; vendor preset: enabled) Active: failed (Result: exit-code) since Thu 2023-01-05 22:28:42 UTC; 2s ago Docs: http://www.odoo.com Process: 14662 ExecStart=/opt/odoo/odoo-bin -c /etc/odoo.conf (code=exited, status=1/FAILURE) Main PID: 14662 (code=exited, status=1/FAILURE) CPU: 638ms Jan 05 22:28:42 ip-172-31-86-22 odoo-bin[14662]: import odoo Jan 05 22:28:42 ip-172-31-86-22 odoo-bin[14662]: File "/opt/odoo/odoo/__init__.py", line 117, in <> Jan 05 22:28:42 ip-172-31-86-22 odoo-bin[14662]: from . import service Jan 05 22:28:42 ip-172-31-86-22 odoo-bin[14662]: File "/opt/odoo/odoo/service/__init__.py", line 8> Jan 05 22:28:42 ip-172-31-86-22 odoo-bin[14662]: from . import server Jan 05 22:28:42 ip-172-31-86-22 odoo-bin[14662]: File "/opt/odoo/odoo/service/server.py", line 21,> Jan 05 22:28:42 ip-172-31-86-22 odoo-bin[14662]: import psutil Jan 05 22:28:42 ip-172-31-86-22 odoo-bin[14662]: ModuleNotFoundError: No module named 'psutil' Jan 05 22:28:42 ip-172-31-86-22 systemd[1]: odoo.service: Main process exited, code=exited, status=1> Jan 05 22:28:42 ip-172-31-86-22 systemd[1]: odoo.service: Failed with result 'exit-code'. lines 1-18/18 (END)

05/01/2023

-

10:32PM



Leave a comment



whatsapp_icon
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