How to install ODOO in CentOS 8/RHEL 8

Odoo is a suite of open source business apps that cover all your company needs: CRM, eCommerce, accounting, inventory, point of sale, project management, etc.

Step 1: Update the System

Update the server

dnf update

Install the EPEL repository

dnf install epel-release

Step 2: Install Python packages and Odoo Dependencies

Install Python 3

dnf install python36 python36-devel

Install Odoo dependencies

dnf install git gcc wget nodejs libxslt-devel bzip2-devel openldap-devel libjpeg-devel freetype-devel`

Step 3: Create an Odoo User

Create a new system user and group that we need to run the Odoo service. The home directory we will define in the /opt/odoo directory.

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

You can name the user whatever you prefer, just do not forget to create a PostgreSQL user with the same name.

Step 4: Install and Configure PostgreSQL

Install PostgreSQL

dnf install postgresql postgresql-server postgresql-contrib

Initialize the database:

/usr/bin/postgresql-setup initdb

Start and Enable PostgreSQL

systemctl start postgresql
systemctl enable postgresql

Create a new PostgreSQL user with the same name as the Odoo user

su - postgres -c "createuser -s odoo"

Step 5: Install Wkhtmltopdf

Odoo requires the wkhtmltopdf package, which is an open-source tool that converts the HTML format to PDF so that Odoo can print PDF reports.

Note The wkhtmltopdf package is not available in the official CentOS 8 repositories, so we will download and install it with the following commands:

cd /opt/ && wget https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox-0.12.5-1.centos7.x86_64.rpm
dnf localinstall wkhtmltox-0.12.5-1.centos7.x86_64.rpm

Step 6: Install and Configure Odoo

Switch the user to Odoo

su - odoo

Clone Odoo from the GitHub repository

git clone https://www.github.com/odoo/odoo --depth 1 --branch 13.0 /opt/odoo/odoo13

Create a new virtual environment.

cd /opt/odoo && python3 -m venv odoo13-venv

Activate the virtual Environment

source odoo13-venv/bin/activate

Inside the virtual environment install the required Python modules for the Odoo installation

pip3 install -r odoo13/requirements.txt

After the installation of the Python modules deactivate the virtual environment

deactivate && exit

The following few commands are optional and can be used if you want to use custom modules for the Odoo instance. The best practice is to install custom Odoo modules in a separate directory. Therefore we will create a new directory for the custom modules and change its ownership to the odoo user.

mkdir /opt/odoo/odoo13-custom-addons
chown odoo: /opt/odoo/odoo13-custom-addons

Install odoo and change it’s ownership to odoo user

mkdir /var/log/odoo13 && touch /var/log/odoo13/odoo.log
chown -R odoo: /var/log/odoo13/

Create a configuration file for the new Odoo instance.

vi /etc/odoo.conf

Paste the following lines into the file:

[options]
; This is the password that allows database operations:
admin_passwd = master_password
db_host = False
db_port = False
db_user = odoo
db_password = False
xmlrpc_port = 8069
; longpolling_port = 8072
logfile = /var/log/odoo13/odoo.log
logrotate = True
addons_path = /opt/odoo/odoo13/addons,/opt/odoo/odoo13-custom-addons

Change the master_password with a new strong password.

Step 7: Create a Service Unit File

To manage Odoo service we can create a service unit file.

vi /etc/systemd/system/odoo13.service

Paste the configuration below:

[Unit]
Description=Odoo13
#Requires=postgresql-10.6.service
#After=network.target postgresql-10.6.service

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

[Install]
WantedBy=multi-user.target

Reload the daemon

systemctl daemon-reload

Start and Enable odoo13

systemctl start odoo13
systemctl enable odoo13

We can run the status command so that we can check if the new Odoo instance is active and running:

systemctl status odoo13.service

Step 8: Accessing the Web Interface

Newly installed Odoo uses the default port 8069.

http://<your_server_IP_address>:8069

If the installation has been successfully completed, you will be able to see the Odoo setup screen.

Related Articles