Knowledgebase

Question About Servers

How to install Odoo 17 on CentOS 7 Print

  • 1

This article will guide you through the installation and configuration process of Odoo 17 in a CentOS 7 system.

Prerequisites

OS: CentOS 7

Resources: 2-core CPU & 2GB of RAM

Access: SSH connection to the server

Permissions: a user with 'sudo' privileges

Note: you can execute all of the commands below from the root user, but for security purposes, it is recommended that you use a separate user with sudo privileges.

Step 1: Log in to the Linux server via SSH as the root user:

The first step in the installation is to connect to your server via ssh. You can log in to the server using ssh.

ssh username@IP_Address -p Port_number
e.g. ssh [email protected] -p 22

Step 2: Update Packages and Install Python3.10

CentOS 7 comes with Python 2 by default. Odoo17 requires Python3.10. So we need to install the required version first.

Make sure your system is updated:

sudo yum update

Install required dependencies:

sudo yum groupinstall "Development Tools"
sudo yum install wget readline-devel ncurses-devel openssl-devel sqlite-devel tk-devel gdbm-devel libc6-dev libbz2-dev libffi-dev zlib1g-dev

Download the archive from Python’s official site:

wget https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tgz

Extract the archive:

tar xzf Python-3.10.0.tgz

Move to the extracted directory:

cd Python-3.10.0 

Compile on your system

./configure --enable-optimizations 

Finally, install it on your system, make sure you are using altinstall command since this might replace your current Python version if you don’t use this command:

make altinstall

If that is successfully installed you can check the Python version:

python3.10 -V

or 

python3.10 --version

Step 3: Create an Odoo user.

Create a new user called odoo17 with home directory /opt/odoo17. This prevents the security risks posed by running Odoo under the root user. You can do it with this command. You can give any name to the user. However, be careful to create a PostgreSQL user with the same name.

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

Step 4: Install Dependencies

Since Odoo is built on Python, we need to install some dependencies to proceed with installing Odoo 17 on our CentOS 7. We can install them by running the commands below.

sudo yum install git python3-pip python3-devel libxml2-devel libxslt-devel zlib-devel libsasl2-devel libldap2-devel gcc-c++ libffi-devel openssl-devel mysql-devel libjpeg-devel postgresql nodejs

sudo npm install -g less less-plugin-clean-css

sudo yum install -y nodejs-less

Step 5: Install and configure PostgreSQL

In this step, you need to set up the database server. Odoo uses PostgreSQL as the database back-end. Install the database server for Odoo By using the following command.

sudo yum install postgresql-server

sudo postgresql-setup initdb

sudo systemctl start postgresql

sudo systemctl enable postgresql

Now you need to create a PostgreSQL user to handle the database server i.e. PostgreSQL.  In our case, we will create a PostgreSQL user with the same name as the previously created system user i.e odoo17

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 command above, superuser access rights will be guaranteed. Next, log out of Postgres and PSQL.
\q
exit

Step 6: Install Wkhtmltopdf

For printing-related purposes, Odoo 17 requires a wkhtmltopdf version higher than 0.12.2. Wkhtmltopdf is an open-source command line tool to render HTML data into PDF format using Qt webkit. To install wkhtmltopdf on your CentOS 7 server, follow the steps below.

sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.rpm

sudo rpm -i wkhtmltox_0.12.5-1.bionic_amd64.rpm

sudo yum install -y fontconfig libXrender

Step 7: Install Odoo

In CentOS 7, we can install Odoo from the default Ubuntu repository, but this will install Odoo version 17. In this article, we will install Odoo 17 in a Python virtual environment. We created a system user earlier in this article; let’s switch to system user ‘odoo17’ and then install Odoo under that username.

sudo su - odoo17

The command above should bring you to /opt/odoo17 and log you in as user ‘odoo17’. Now, download Odoo from Github.

git clone https://www.github.com/odoo/odoo --depth 1 --branch 17.0 odoo17

Execute the following command to create a new python virtual environment.

python3 -m venv odoo17-venv

The virtual environment is now installed; it is time to activate it by running this command.

source odoo17-venv/bin/activate

Next, let’s install Odoo

pip3 install wheel
pip3 install -r odoo17/requirements.txt

Once Odoo installation is completed, we can create a new directory to store our custom Odoo add-ons.

deactivate

Step 8: Create a directory for the 3rd party addons:

We’ll create a separate directory for the 3rd party addons.

mkdir /opt/odoo17/odoo17/custom-addons

This directory should later be added to the addons_path parameter that defines a list of directories where Odoo searches for modules. After this step, we will switch back to the sudo user using this command.

exit

Step 9: Create a configuration file for the Odoo Installation

The command below allows you to create and edit a *.conf file.

sudo nano /etc/odoo17.conf

Add the following configuration information to the file. 

Note: Remember to change the admin_passwd to something more secure.

[options]
admin_passwd = admin_passwd
db_host = False
db_port = False
db_user = odoo17
db_password = False
addons_path = /opt/odoo17/odoo17/addons,/opt/odoo17/odoo17/custom-addons
xmlrpc_port = 8069

Step 10: Create Odoo Systemd Unit file

In this step, we will create a systemd unit file. It is required to start/stop/restart Odoo.

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

Paste the following content into the systemd unit file above.

[Unit]
Description=Odoo17
Requires=postgresql.service
After=network.target postgresql.service

[Service]
Type=simple
SyslogIdentifier=odoo17
PermissionsStartOnly=true
User=odoo17
Group=odoo17
ExecStart=/opt/odoo17/odoo17-venv/bin/python3 /opt/odoo17/odoo17/odoo-bin -c /etc/odoo17.conf
StandardOutput=journal+console

[Install]
WantedBy=multi-user.target

With the next command, we notify systemd that the new file exists and reload the daemon.

sudo systemctl daemon-reload

Next, we start the Odoo service and enable it to run on system boot.

sudo systemctl enable --now odoo17

Now we check if the service is running.

sudo systemctl status odoo17

You should get the following output.

● odoo17.service - Odoo17
     Loaded: loaded (/etc/systemd/system/odoo17.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2023-11-28 09:56:28 UTC; 28s ago
...

This next command will allow you to check on the messages logged by the odoo17 service.

sudo journalctl -u odoo17

Step 11: Testing the Odoo Installation

On your browser, type: http://<your_domain_or_IP_address>:8069

If the installation was successful, you'll see the start page for Odoo 17. 

Congratulations! You have successfully installed Odoo 17 on CentOS 7.


Was this answer helpful?

« Back

Enterprise-Grade Hardware

  • Samsung
  • Juniper
  • Western Digital
  • Supermicro
  • LSI
  • Intel
  • R1Soft Backups
  • cPanel
  • MySQL
  • Parallels
  • HP Partner