How to install Odoo ERP 13 on CentOS 8

How to install Odoo ERP 13 on CentOS 8

Odoo is a free, open source, and most popular ERP software that provides a wide range of business applications, including customer relationship management (CRM), sales channels, project management, manufacturing, invoices, accounting, e-commerce, and more. It is a web-based, full-featured application that helps you maintain ERP in any business. Odoo comes with 30 core modules and more than 4,500 community-created modules to help you customize it as a small business company.

In this tutorial, we will learn how to install and configure Odoo 13 using Nginx as a reverse proxy on a CentOS 8 server.

Claim

  • A server running CentOS 8 with at least 2 GB of RAM.
  • A valid domain name points to your server IP. In this tutorial, we will use the exmaple.com domain.
  • A root password is configured on the server.

getting Started

First, update your system and install the EPEL repository using the following command:

dnf update dnf install epel-release

Next, you will need to install some of the tools and dependencies needed to build Odoo on your system.

You can install all components with:

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

Once all packages are installed, you can proceed to the next step.

Create Odoo User

Next, you will need to create a new system user with the name odoo and home directory / opt / odoo using the following command:

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

When you are done, you can proceed to the next step.

Install and configure PostgreSQL

Odoo uses PostgreSQL to store its data. Therefore, you will need to install PostgreSQL on the server. You can use the following command to install:

dnf install postgresql postgresql-server postgresql-contrib

After installation, use the following command to initialize the database:

/usr/bin/postgresql-setup initdb

You should get the following output:

 * Initializing database in '/var/lib/pgsql/data'
 * Initialized, logs are in /var/lib/pgsql/initdb_postgresql.log

Next, start the PostgreSQL service and use the following command to start it after the system restarts:

systemctl start postgresql systemctl enable postgresql

You can now verify PostgreSQL using:

systemctl status postgresql

You should see the following output:

? postgresql.service - PostgreSQL database server
   Loaded: loaded (/usr/lib/systemd/system/postgresql.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2019-12-02 01:01:44 EST; 6s ago
  Process: 31805 ExecStartPre=/usr/libexec/postgresql-check-db-dir postgresql (code=exited, status=0/SUCCESS)
 Main PID: 31808 (postmaster)
    Tasks: 8 (limit: 12552)
   Memory: 16.5M
   CGroup: /system.slice/postgresql.service
           ??31808 /usr/bin/postmaster -D /var/lib/pgsql/data
           ??31809 postgres: logger process   
           ??31811 postgres: checkpointer process   
           ??31812 postgres: writer process   
           ??31813 postgres: wal writer process   
           ??31814 postgres: autovacuum launcher process   
           ??31815 postgres: stats collector process   
           ??31816 postgres: bgworker: logical replication launcher   

Next, you will need to create a new PostgreSQL user with the same name as the system user, as shown below:

su - postgres -c "createuser -s odoo"

Install Wkhtmltopdf

Next, you will need to install the wkhtmltopdf tool in your system so that Odoo can print PDF reports. You can use the following command to install:

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

After the installation is complete, you can proceed to the next step.

Install and configure Odoo 13

First, switch to the Odoo user using the following command:

su - odoo

Next, download the latest version of Odoo 13 from the Git repository using the git command:

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

Next, create a new virtual environment for the Odoo 13 instance using the following command:

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

Next, activate the virtual environment using the following command:

source odoo13-venv/bin/activate

You should get the following output:

(odoo13-venv) [[email protected] ~]$

Next, install all required Python modules for Odoo 13 using the following command:

pip3 install -r odoo13/requirements.txt

Once all required modules are installed, use the following command to deactivate the virtual environment:

deactivate

Finally, log out of the Odoo user using the following command:

exit

Next, create a new directory to store Odoo custom modules and Odoo logs:

mkdir /opt/odoo/odoo13-custom-addons mkdir /var/log/odoo13 touch /var/log/odoo13/odoo.log

Next, change the ownership of both directories to the odoo user using the following command:

chown -R odoo:odoo /opt/odoo/odoo13-custom-addons chown -R odoo:odoo /var/log/odoo13/

Next, create a new profile for Odoo 13 using the following command:

nano /etc/odoo.conf

Add the following lines:

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

Save and close the file when you are finished.

Create system service files for Odoo 13

Next, you will need to create a new systemd unit file for Odoo 13 to manage Odoo services.

You can create it using:

nano /etc/systemd/system/odoo13.service

Add the following lines:

[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

Save and close the file. Then, reload the systemd daemon using the following command:

systemctl daemon-reload

Next, start the Odoo service and use the following command to start it after the system reboots:

systemctl start odoo13 systemctl enable odoo13

You can also use the following command to verify Odoo status:

systemctl status odoo13

You should get the following output:

? odoo13.service - Odoo13
   Loaded: loaded (/etc/systemd/system/odoo13.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2019-12-02 01:15:43 EST; 2s ago
 Main PID: 17022 (python3)
    Tasks: 4 (limit: 12552)
   Memory: 63.7M
   CGroup: /system.slice/odoo13.service
           ??17022 /opt/odoo/odoo13-venv/bin/python3 /opt/odoo/odoo13/odoo-bin -c /etc/odoo.conf

Dec 02 01:15:43 centos8 systemd[1]: Started Odoo13.

By default, Odoo listens on port 8069. You can check it with:

netstat -plntu | grep 8069

You should see the following output:

tcp        0      0 0.0.0.0:8069            0.0.0.0:*               LISTEN      17022/python3

Configure Nginx as a reverse proxy for Odoo 13

Next, you will need to install Nginx and configure it as a reverse proxy for the Odoo 13 instance.

First, install the Nginx web server using the following command:

dnf install nginx

After installation, use the following command to create a new virtual host profile:

nano /etc/nginx/conf.d/odoo13.conf

Add the following lines:

upstream odoo {
 server 127.0.0.1:8069;
}
server {
    listen 80;
    server_name example.com;

    access_log /var/log/nginx/odoo13.access.log;
    error_log /var/log/nginx/odoo13.error.log;

        location / {
        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;


        proxy_redirect off;
        proxy_pass http://odoo;
    }

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

    gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
    gzip on;
}

Save and close the file when you are finished. Then, start the Nginx service and use the following command to start it after the system reboots:

systemctl start nginx systemctl enable nginx

You can use the following command to verify the status of the Nginx service:

systemctl status nginx

You should see the following output:

? nginx.service - The nginx HTTP and reverse proxy server
   Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2019-12-02 01:25:15 EST; 6s ago
  Process: 17244 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS)
  Process: 17241 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
  Process: 17239 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
 Main PID: 17245 (nginx)
    Tasks: 3 (limit: 12552)
   Memory: 5.4M
   CGroup: /system.slice/nginx.service
           ??17245 nginx: master process /usr/sbin/nginx
           ??17246 nginx: worker process
           ??17247 nginx: worker process

Dec 02 01:25:15 centos8 systemd[1]: Starting The nginx HTTP and reverse proxy server...
Dec 02 01:25:15 centos8 nginx[17241]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
Dec 02 01:25:15 centos8 nginx[17241]: nginx: configuration file /etc/nginx/nginx.conf test is successful
Dec 02 01:25:15 centos8 systemd[1]: Started The nginx HTTP and reverse proxy server.

Configure firewall

Next, you will need to allow the Nginx service to access the Odoo 13 instance from a remote system through Firewalld.

You can run the following command to allow Nginx services through firewalld:

firewall-cmd --permanent --zone=public --add-service=nginx firewall-cmd --reload

SELinux is enabled by default in CentOS 8. So you will need to allow HTTP via SELinux. You can allow it using:

setsebool -P httpd_can_network_connect on

Access to Odoo 13 web interface

Odoo 13 is now installed and configured. It’s time to access the Odoo 13 web interface.

Open your web browser and enter the URL http://example.com. You will be redirected to the following page:

Now provide your master password, database name, email, password, country, and click create database Button. You will be redirected to the Odoo 13 Administration page:

Odee ERP application

in conclusion

In the above tutorial, you learned how to install and configure Odoo 13 on a CentOS 8 server. You also learned how to configure Nginx as a reverse proxy for Odoo 13. You can now customize Odoo 13 instances based on your business needs.

Sidebar