How to install Odoo 15 on CentOS 9 / AlmaLinux 9

by time news

2023-06-14 08:30:00

This article will show you how to install Odoo 15 on CentOS 9 / AlmaLinux 9

previous requirements

  • Operating system: CentOS 9 or AlmaLinux 9
  • Access: Possibility to connect to the server via SSH.
  • permissions : a user with root privileges (ie, able to use the ‘sudo’ command).
  • Minimum version of Python recommended 3.7.0 (or higher) This will be required to install the Python dependency “Pillow 9.5.0” or higher.

Note: Although you can run all of the commands below from the root user, it is highly recommended that you use a separate user with ‘sudo’ privileges.

If you have a version of AlmaLinux 8 we recommend: Upgrade from AlmaLinux 8 to AlmaLinux 9

Step 1 – Login to the AlmaLinux 9 server via SSH as root user:

ssh root@IP_Address -p Port_number

Replace ‘IP_Address’ and ‘Port_number’ with the respective IP address and SSH port number of your server.

Step 2 – Update the system

Once you are connected to your server, refresh the list of available packages using the following command.

sudo dnf update -y

Step 3: Install Python and other dependencies

Now, you need to install Python and other required dependencies on your server.

sudo dnf install python3 python3-devel git gcc git redhat-rpm-config libxslt-devel bzip2-devel openldap-devel libjpeg-devel freetype-devel -y

Verifique que la versión de python es al menos 3.7.0

python3 --version

Step 4: Install the wkhtmltopdf package

Wkhtmltopdf is the package that allows Odoo 15 to print PDF reports. It converts HTML (web page markup) to PDF, but it is not present in the official package list or in the EPEL repository.

sudo dnf install 

Once all the packages are installed, it’s time to install PostgreSQL and Odoo. Below are the steps for its installation.

Next, you will need to install the PostgreSQL package on your server.

Step 5 – Create a dedicated Linux user for Odoo

You need to create a dedicated Linux user to keep Odoo’s permissions strict and predefined.

The following command will create a user named odoo and a group of users with the same name. The user’s home directory will be /opt/odoo and Bash will be the default shell.

sudo useradd -m -U -r -d /opt/odoo -s /bin/bash odoo

Note: You can choose any name for the user, but be sure to use that same name in the next step when you go to create a database user.

Step 6: Install PostgreSQL

You can install PostgreSQL with the following command:

sudo yum -y install postgresql.x86_64 postgresql-server.x86_64 postgresql-contrib.x86_64

Step 7: Initialize the PostgreSQL database

sudo /usr/bin/postgresql-setup initdb

Step 8 – Start the PostgreSQL process and make sure the database process is always running

sudo systemctl start postgresql
sudo systemctl enable postgresql

Step 9: Create a new PostgreSQL user (remember to use the username from the previous step)

Now the user will have the correct place to create a new PostgreSQL user configured for Odoo with the following command:

sudo su - postgres -c "createuser -s odoo"

Step 10: Installation of Odoo

Secondly, for Odoo installation, login to Odoo user and download Odoo 15.

sudo su - odoo
git clone  --depth 1 --branch 15.0 /opt/odoo/odoo15
cd /opt/odoo

Step 11: Set up the new Python virtual environment and its activation

The virtual environment is necessary to separate the Odoo Python modules from the system Python modules so that the two do not interfere with each other.

python3 -m venv odoo15-venv
source odoo15-venv/bin/activate

Step 12: Install the required dependencies

Install the required dependencies or the python module

pip3 install -r odoo15/requirements.txt

Step 13: Disable dependencies

Deactivate the virtual environment and revert to the previous system user (you no longer have to do anything with the odoo user)

deactivate

Step 14: Prepare for Odoo Custom Plugins

Create a separate directory for odoo custom plugins and change its owner to odoo user

sudo mkdir /opt/odoo/odoo15-custom-addons

exit

sudo mkdir /var/log/odoo15 && touch /var/log/odoo15/odoo.log

chown odoo:odoo /var/log/odoo15 ; chown odoo:odoo /var/log/odoo15/odoo.log

Step 15 – Create a configuration file for your Odoo instance

Now, it’s time to configure Odoo using several commands:

sudo nano /etc/odoo15.conf

Add the following lines:

[options]
admin_passwd = odoo_master_password
db_host = False
db_port = False
db_user = odoo
db_password = False
xmlrpc_port = 8069
logfile = /var/log/odoo15/odoo.log
logrotate = True
addons_path = /opt/odoo/odoo15/addons,/opt/odoo/odoo15-custom-addons

Close the after Odoo configuration, but don’t forget to save it.

Step 16: Create a system service file for Odoo

A system service file for Odoo can be obtained with the following command:

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

Add the following lines:

[Unit]
Description=Odoo15
#Requires=postgresql-10.6.service
#After=network.target postgresql-10.6.service
 
[Service]
Type=simple
SyslogIdentifier=odoo15
PermissionsStartOnly=true
User=odoo
Group=odoo
ExecStart=/opt/odoo/odoo15-venv/bin/python3 /opt/odoo/odoo15/odoo-bin -c /etc/odoo15.conf
StandardOutput=journal+console
 
[Install]
WantedBy=multi-user.target

Save and close the file, then reload the systemd daemon to apply the changes:

sudo systemctl daemon-reload

Next, start the Odoo service and enable it to start on system reboot:

sudo systemctl start odoo
sudo systemctl enable odoo

Now check the status of the Odoo service with the following command:

sudo systemctl status odoo

You should get the following output:

odoo.service - Odoo15
   Loaded: loaded (/etc/systemd/system/odoo.service; disabled; vendor preset: disabled)
   Active: active (running) since Sun 2021-06-06 09:41:59 EDT; 4s ago
 Main PID: 23729 (python3)
    Tasks: 4 (limit: 25014)
   Memory: 55.6M
   CGroup: /system.slice/odoo.service
           └─23729 /opt/odoo/odoo15-venv/bin/python3 /opt/odoo/odoo15/odoo-bin -c /etc/odoo.conf
Nov 25 21:41:59 AlmaLinux systemd[1]: Started Odoo15.

At this point, Odoo starts up and listens on port 9069. You can verify this with the following command:

ss -antpl | grep 8069  

You should get the following output:

LISTEN    0         129                0.0.0.0:8069             
0.0.0.0:*        users:(("python3",pid=23729,fd=4)) 

Step 17 – Configuring the Firewall

The firewall will allow you port 9069. But here, you can also use the following command:

sudo firewall-cmd --permanent --zone=public --add-port=8069/tcp

Now just apply the changes:

sudo firewall-cmd --reload

Step 19: Access the odoo web user interface

Insert your Odoo master password, database, admin username, password, email and click the button Create database . You should see the Odoo dashboard on the following page:

odoo-0

Congratulations! You have successfully installed Odoo 15 on AlmaLinux 9.

Pin It

#install #Odoo #CentOS #AlmaLinux

You may also like

Leave a Comment