You can support us by downloading this article as PDF from the Link below. Download the guide as PDF

This post has been written to guide Linux users through the installation of Odoo 14 ERP system on CentOS 8. Odoo is an open source business management application with features of POS, CRM, Project Management, Website builder, Marketing, Warehouse Management, eCommerce, Billing & Accounting, Manufacturing and many other cool features. These extra features can be unlocked through plenty of Odoo Plugins available for installation.

As of this article update the latest release of Odoo ERP software is version 14. We will kickoff the installation with the upgrade of the system, installing all required dependencies such PostgreSQL database server and finally doing the actual installation of Odoo ERP 14 on CentOS 8. Nginx will be used as frontend proxy to the Odoo 14 ERP & CRM System on CentOS 8.

Step 1: Update OS, Setup Hostname and DNS

Login to CentOS 8 Server and perform system update, then reboot.

sudo dnf -y update
sudo reboot

After the system is rebooted, configure correct hostname.

sudo hostnamectl set-hostname erp.hirebestengineers.com --static
sudo hostnamectl set-hostname erp.hirebestengineers.com --transient

Also add a valid A record in your DNS server.

Save the record and validate it is working by doing ping or dig.

$ sudo dnf -y install bind-utils
$ dig A erp.hirebestengineers.com +short
168.119.127.45

Step 2: Add EPEL Repository to CentOS server

Add EPEL repository to CentOS 8 by running the command.

sudo yum -y install epel-release vim bash-completion

Put SELinux in permissive mode.

sudo setenforce 0
sudo sed -i 's/^SELINUX=.*/SELINUX=permissive/g' /etc/selinux/config

Run the yum repolist command.

$ sudo yum repolist
repo id                                                     repo name
AppStream                                                   CentOS-8 - AppStream
BaseOS                                                      CentOS-8 - Base
epel                                                        Extra Packages for Enterprise Linux 8 - x86_64
epel-modular                                                Extra Packages for Enterprise Linux Modular 8 - x86_64
extras                                                      CentOS-8 - Extras

Step 3: Install PostgreSQL Database Server

Odoo ERP repository uses PostgreSQL database server for data storage. The packages are available in DNF Modules.

Disable current default PostgreSQL module.

sudo dnf -qy module disable postgresql

Enable PostgreSQL 12 module.

sudo dnf module -y enable postgresql:12

Then install PostgreSQL server and client packages.

sudo dnf -y install @postgresql

After installation, database initialization is required before service can be started.

$ sudo /usr/bin/postgresql-setup --initdb --unit postgresql
 * Initializing database in '/var/lib/pgsql/data'
 * Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log

Start and enable Database server.

$ sudo systemctl enable --now postgresql
Created symlink /etc/systemd/system/multi-user.target.wants/postgresql.service → /usr/lib/systemd/system/postgresql.service.

Create odoo database user.

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

Step 4: Install wkhtmltopdf on CentOS 8

Odoo uses wkhtmltopdf to generate reports in PDF format. The recommended version of wkhtmltopdf to install is 0.12.5 and is available on the wkhtmltopdf download page, in the archive section.

sudo dnf install -y https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox-0.12.5-1.centos8.x86_64.rpm

Confirm installed version.

$ wkhtmltopdf --version
wkhtmltopdf 0.12.5 (with patched qt)

You’re good to proceed to the next step of actual installation of Odoo 14 on CentOS 8.

Step 5: Install Odoo 14 on CentOS 8

Add EPEL repositpory:

yum -y install epel-release

Also enable PowerTools repository.

sudo dnf config-manager --set-enabled PowerTools

Install Python and other build dependencies:

sudo yum -y install vim bash-completion zip git gcc openldap-devel python3 python3-devel redhat-rpm-config libxslt-devel libjpeg-devel freetype-devel bzip2-devel

Add Odoo system user and group.

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

Set password for the user account created.

$ sudo passwd odoo
Changing password for user odoo.
New password:
Retype new password:
passwd: all authentication tokens updated successfully.

Check user details:

$ id odoo
uid=992(odoo) gid=989(odoo) groups=989(odoo)

Switch to the account of the user created:

$ sudo su - odoo

Clone release 14 branch from Github.

git -C /opt/odoo/ clone https://www.github.com/odoo/odoo --depth 1 --branch 14.0

Create Python Virtualenv.

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

Activate the virtual environment created.

source odoo-venv/bin/activate

Install Python dependencies in requirements file.

pip3 install -r odoo/requirements.txt

After successful installations deactivate the virtual environment,

deactivate
exit

Create Odoo log file:

sudo touch /var/log/odoo.log

Create Custom Addons Path:

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

Set correct directory permissions:

sudo chown -R odoo:odoo /opt/odoo/ /var/log/odoo.log

Create Odoo instance configuration file:

sudo tee  /etc/odoo.conf<<EOF
[options]
proxy_mode = True
; This is the password that allows database operations:
admin_passwd = [email protected]
db_host = False
db_port = False
db_user = odoo
db_password = False
xmlrpc_port = 8069
logfile = /var/log/odoo.log
logrotate = True
addons_path = /opt/odoo/odoo/addons,/opt/odoo/odoo/custom-addons
EOF

Create Systemd Service unit file.

sudo tee /etc/systemd/system/odoo.service<<EOF
[Unit]
Description=Odoo ERP Server
Requires=postgresql.service
After=network.target postgresql.service

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

[Install]
WantedBy=multi-user.target
EOF

Reload System services:

sudo systemctl daemon-reload

Start the odoo service created.

sudo systemctl start odoo
sudo systemctl restart odoo

Enable it to start at boot.

$ sudo systemctl enable odoo
Created symlink /etc/systemd/system/multi-user.target.wants/odoo.service → /etc/systemd/system/odoo.service.

Confirm if Odoo service is set to start at boot.

$ systemctl is-enabled odoo
enabled

Check if running.

$ systemctl status odoo
● odoo.service - Odoo ERP Server
   Loaded: loaded (/etc/systemd/system/odoo.service; enabled; vendor preset: disabled)
   Active: active (running) since Sun 2020-10-11 18:38:30 CEST; 48s ago
 Main PID: 25201 (python3)
    Tasks: 4 (limit: 24392)
   Memory: 59.2M
   CGroup: /system.slice/odoo.service
           └─25201 /opt/odoo/odoo-venv/bin/python3 /opt/odoo/odoo/odoo-bin -c /etc/odoo.conf

Oct 11 18:38:30 erp.hirebestengineers.com systemd[1]: Started Odoo ERP Server.

The Odoo service should bind to TCP port 8069 once started.

$ sudo ss -tunelp | grep 8069
tcp     LISTEN   0        128              0.0.0.0:8069          0.0.0.0:*       users:(("python3",pid=25201,fd=4)) uid:992 ino:64882 sk:5 <->

Install Nginx Web server on CentOS 8:

sudo yum -y install nginx
sudo systemctl enable --now nginx

Create a new configuration file for odoo.

sudo vim /etc/nginx/conf.d/odoo.conf

Modify this configuration snippet to fit your setup.

# Odoo Upstreams
upstream odooserver {
 server 127.0.0.1:8069;
}

server {
    listen 80;
    server_name erp.hirebestengineers.com;
    access_log /var/log/nginx/odoo_access.log;
    error_log /var/log/nginx/odoo_error.log;


    # Proxy settings
    proxy_read_timeout 720s;
    proxy_connect_timeout 720s;
    proxy_send_timeout 720s;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;

    # Request for root domain
    location / {
       proxy_redirect off;
       proxy_pass http://odooserver;
    }

    # Cache static files
    location ~* /web/static/ {
        proxy_cache_valid 200 90m;
        proxy_buffering on;
        expires 864000;
        proxy_pass http://odooserver;
    }

    # Gzip
    gzip_types text/css text/less text/plain text/xml application/xml applicationhttps://computingforgeeks.com/json application/javascript;
    gzip on;
}

Replace erp.computingforgeeks with your domain name, then validate Nginx configuration file.

$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

If all looks good, restart Nginx.

sudo systemctl restart nginx

If your server has a public IP, you can create a DNS A record for your domain to point to Odoo Server and request for free Let’s Encrypt SSL certificate.

Install Nginx on CentOS 8 Server.

sudo yum -y install nginx
sudo systemctl enable --now nginx

Install certbot-auto tool.

sudo yum -y install wget
wget https://dl.eff.org/certbot-auto
chmod +x certbot-auto
sudo mv certbot-auto /usr/local/bin/certbot-auto

Stop Nginx service.

sudo systemctl stop nginx

Get Let’s Encrypt SSL certificates for your domain.

export DOMAIN="erp.hirebestengineers.com"
export EMAIL="[email protected]"
sudo /usr/local/bin/certbot-auto certonly --standalone -d ${DOMAIN} --preferred-challenges http --agree-tos -n -m ${EMAIL} --keep-until-expiring

The path to certificate files is shown in the “IMPORTANT NOTES” section.

IMPORTANT NOTES:
Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/erp.hirebestengineers.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/erp.hirebestengineers.com/privkey.pem
Your cert will expire on 2021-01-09. To obtain a new or tweaked
version of this certificate in the future, simply run certbot-auto
again. To non-interactively renew all of your certificates, run
"certbot-auto renew"
Your account credentials have been saved in your Certbot
configuration directory at /etc/letsencrypt. You should make a
secure backup of this folder now. This configuration directory will
also contain certificates and private keys obtained by Certbot so
making regular backups of this folder is ideal.
If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le

Create cron for certificate renewal.

$ sudo crontab -e
15 3 * * * /usr/local/bin/certbot-auto renew --pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx"

Create Nginx configuration file.

sudo vim /etc/nginx/conf.d/odoo.conf

Paste below into the file and modify it to suit your environment.

# Odoo Upstreams
upstream odooserver {
 server 127.0.0.1:8069;
}

# http to https redirection
server {
    listen 80;
    server_name erp.hirebestengineers.com;
    return 301 https://erp.hirebestengineers.com$request_uri;
}

server {
    listen 443 ssl;
    server_name erp.hirebestengineers.com;
    access_log /var/log/nginx/odoo_access.log;
    error_log /var/log/nginx/odoo_error.log;
   
   # SSL
    ssl_certificate /etc/letsencrypt/live/erp.hirebestengineers.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/erp.hirebestengineers.com/privkey.pem;
    ssl_trusted_certificate /etc/letsencrypt/live/erp.hirebestengineers.com/chain.pem;


    # Proxy settings
    proxy_read_timeout 720s;
    proxy_connect_timeout 720s;
    proxy_send_timeout 720s;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;

    # Request for root domain
    location / {
       proxy_redirect off;
       proxy_pass http://odooserver;
    }

    # Cache static files
    location ~* /web/static/ {
        proxy_cache_valid 200 90m;
        proxy_buffering on;
        expires 864000;
        proxy_pass http://odooserver;
    }

    # Gzip Compression
    gzip_types text/css text/less text/plain text/xml application/xml applicationhttps://computingforgeeks.com/json application/javascript;
    gzip on;
}

Validate your Nginx configurations.

$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Restart Nginx.

sudo systemctl restart nginx

Step 8: Access Odoo 14 on CentOS 8 Server

Access Odoo Web page on your domain name from a web – https://DNShostname.

You can also access the Odoo Web page directly on:

http://<your_server_IP_address>:8069

On the first page, set database name, admin user email address and password for the admin user.

You now have Odoo ERP installed and running on CentOS 8 server. Keep checking our website for latest articles.

More articles on CentOS 8:

How To Install MicroK8s Kubernetes Cluster on CentOS 8

How To Configure TigerVNC on CentOS 8 for RDP

Install Google Hangouts Client on CentOS 8

You can support us by downloading this article as PDF from the Link below. Download the guide as PDF