Enable Dark Mode!
how-to-install-odoo-16-on-the-centos-server.jpg
By: Busthana Shirin

How to Install Odoo 16 on the CentOS Server

Technical

This blog will help with how to install Odoo16 in the Centos server. Here will download the Odoo from GitHub and install all other dependencies.
Step 1: Update server
Firstly, we have to log in to our server, then we can make sure our server is up to date.
To login to the server:
ssh <username>@<IP address>
Then we have to type the password also. After successful login to the server, we have to update the server.
sudo yum update
sudo yum upgrade
Step 2: Create a user for Odoo
In order to make things clean, we have to create a separate user for Odoo.
sudo useradd -m -U -r -d /opt/odoo16 -s /bin/bash odoo16
Here we created the user in the /opt/Odoo16 directory so that users can operate in this directory only.
Step 3: Installing Python packages and libraries.
Here we installed all the python packages.
Install pip3:
sudo yum install -y python3-pip
More packages required for Odoo.
sudo yum install git gcc wget nodejs libxslt-devel bzip2-devel openldap-devel libjpeg-devel freetype-devel
Step 4: Configuring Postgresql
Odoo uses postgresql for store users and the application of data, so we have to install and create new database users.
Install postgresql:
sudo yum install postgresql
We have to create a new database user. We can create a Postgres user to manage the DB in the following steps below. We have to add the user and password on the conf file later.
Postgres needs a separate system user to set up a Postgres task, which is known as postgres. The following command will help us to change the Postgres user.
sudo su - postgres
Next, we have to create a user Odoo16, and we have to set the password also. This password also we have to add in the conf file.
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo16
Once we create the user, then designate as a superuser in order to receive further privileges.
psql
ALTER USER odoo16 WITH SUPERUSER;
Then we have to exit from the psql and postgres user
\q
exit
Step 5: Get Odoo community from Git
We have to directly clone the community code from github repository. We can add the enterprise add-ons after completing the installation process.
First, we have to install the git server
sudo yum install git
We have to switch the system user to the Odoo16 user.
sudo su - odoo16
Next, we can clone the code. Here we can see the dot end of the code, which represents the home directory of the current user
git clone https://www.github.com/odoo/odoo --depth 1 --branch 16.0 --single-branch.
After installation, we have to exit from the current user.
exit
Step 6: Install Wkhtmltopdf
If we use wkhtmltopdf help to create pdf reports easily. Qweb templates are converted to HTML by the report engine.Pdf reports are produced by wkhtmltopdf.
sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
sudo yum localinstall wkhtmltox-0.12.5-1.centos8.x86_64.rpm
Step 7: Set-up the Python Environment
Odoo requires a specific python module to function properly. We have to create a python virtual environment. So it will not interfere with the system’s python modules
cd /opt/odoo && python3.8 -m venv odoo16-venv
It will create a new folder, and it maintains a python environment
source odoo16-venv/bin/activate
This command will activate the python environment.
pip3 install -r odoo16/requirements.txt
We can use this command to install all the required modules in one command.
deactivate
We can deactivate and exit from the environment by using this command.
Step 8:Setup conf file
To operate the Odoo system, Odoo needs some data like the database user, password, location of add-ons, etc., which data we will add inside of the conf file. 
The following command will help us to open the file and we can update the following details given below.
sudo nano odoo16.conf
Update the conf file same as shown below.
[options]
   ; This is the password that allows database operations:
   admin_passwd = admin
   db_host = False
   db_port = False
   db_user = odoo16
   db_password = False
   addons_path = /opt/odoo16/addons
   logfile = /var/log/odoo16.log
db_host: database host
db_port: database port
db_user:database user
db_password:password for the database user.
Addons_path: give the path to the directories of add-ons.
Logfile: log file path
Make the ‘odoo’ user the owner of this file as well:
sudo chown odoo16: /etc/odoo16.conf
And then provide required file permissions:
sudo chmod 640 /etc/odoo16.conf
Also, create a log directory of Odoo, which will help you to find Odoo-related issues and set permission to the log directory.
sudo mkdir /var/log/odoo16
sudo chown odoo16:root /var/log/odoo16
Step 9: Odoo service file
Create a service to run Odoo
sudo nano /etc/systemd/system/odoo16.service
Add the following code in the service file, make sure the conf file path is correct.
[Unit]
   Description=Odoo16
   Documentation=http://www.odoo.com
   [Service]
   # Ubuntu/Debian convention:
   Type=simple
   User=odoo16
   ExecStart=/opt/odoo16/odoo-bin -c /etc/odoo16.conf
   [Install]
   WantedBy=default.target
Set the user permission to service file by using the following commands
sudo chmod 755 /etc/systemd/system/odoo16.service
sudo chown root: /etc/systemd/system/odoo16.service
Step 10: Run Odoo 16
Run the Odoo service by using the following command.
sudo systemctl start odoo16.service
We can use the following command if we want to check the status.
sudo systemctl status odoo16.service
We can check the log in case of any issue happens
sudo tail -f /var/log/odoo16.log
Here we are using a python virtual environment, which will support Odoo and will not affect the python usage in the system, so we can run Odoo smoothly. Once the installation has been completed, we can check the logs using the above command, which will help us to find all issues if they happen.
Have a look at the following blog to explore more about to Install Odoo 16. Install Odoo 16


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



1
Comments

John

Thank you for the great tutorial. In Step 7 the following command does not create the subdirectory "/opt/odoo": cd /opt/odoo && python3.8 -m venv odoo16-venv did you mean to write "/opt/odoo16": cd /opt/odoo16 && python3.8 -m venv odoo16-venv

23/05/2023

-

8:43AM



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