How to install Odoo on centos 8

How To Install Odoo 14 On CentOS 8

On this article we will discuss how to install Odoo version 14 Community edition on Linux CentOS 8. We will use Odoo binary source from Odoo official GitHub repository and Python virtual environment. Also we will be using Odoo default webserver, PostgreSQL 13 and Nginx as a reverse proxy for security reason.

Introduction

Odoo is a suite of business management software tools that ships with various business applications including: CRM, e-Commerce, billing, accounting, manufacturing, warehouse, project management, inventory management and much more, all seamlessly integrated.

The Odoo Community version is a libre software, licensed under the GNU LGPLv3, while the Enterprise version has proprietary extra features and services. The source code for the framework and core ERP modules is curated by the Belgium-based Odoo S.A. Odoo is available for both on-premise and ready to use SaaS environment. On this article we will discuss how to install Odoo on Linux CentOS 8 operating system.

Odoo Installation on CentOS 8

We will use the latest stable version of Odoo, version 14.0 which was released on October 2, 2020. The binary file was hosted on Odoo official GitHub repository. The installation process will consist of several stages, namely:

Prerequisites

Odoo consists of several applications that are put together in a seemless integrated bundle, so it requires several supporting tools or libraries to make the application run smoothly.

Update CentOS 8 system

Before we add new applications or new software to our system, it is better if we update the system first. On CentOS 8, this task can be done by submitting command line : sudo dnf update.

[ramans@localhost ~]$ sudo dnf update
 [sudo] password for ramans: 
 Last metadata expiration check: 0:49:28 ago on Sun 27 Dec 2020 07:48:08 PM PST.
 Dependencies resolved.
  Package                             Arch   Version                                  Repo       Size
 Installing:
  centos-linux-release                noarch 8.3-1.2011.el8                           BaseOS     22 k
      replacing  centos-release.x86_64 8.2-2.2004.0.1.el8
      replacing  centos-repos.x86_64 8.2-2.2004.0.1.el8
  kernel                              x86_64 4.18.0-240.1.1.el8_3                     BaseOS    4.3 M
sudo dnf update
sudo dnf update

Install Prerequisites Tools

Odoo is written in Python, JavaScript and XML. The first step is to install Python 3 and all appropriate libraries and tools required to build Odoo. On this section we will install several dependcies tools, such as : Python 3, Git, GCC and other other libraries.

[ramans@localhost ~]$  sudo dnf install python36 python36-devel git gcc wget nodejs libxslt-devel bzip2-devel openldap-devel libjpeg-devel freetype-devel
 Last metadata expiration check: 1 day, 20:36:20 ago on Sun 27 Dec 2020 02:35:40 AM PST.
 Package python36-3.6.8-2.module_el8.1.0+245+c39af44f.x86_64 is already installed.
 Package gcc-8.3.1-5.el8.0.2.x86_64 is already installed.
 Package wget-1.19.5-8.el8_1.1.x86_64 is already installed.
 Dependencies resolved.
  Package                   Arch      Version                                              Repository    Size
 Installing:
  bzip2-devel               x86_64    1.0.6-26.el8                                         BaseOS       224 k
  freetype-devel            x86_64    2.9.1-4.el8_3.1                                      BaseOS       464 k
  git                       x86_64    2.27.0-1.el8                                         AppStream    164 k
  libjpeg-turbo-devel       x86_64    1.5.3-10.el8                                         AppStream    109 k
  libxslt-devel             x86_64    1.1.32-5.el8                                         AppStream    323 k
  nodejs                    x86_64    1:10.21.0-3.module_el8.2.0+391+8da3adc6              AppStream    8.9 M
  openldap-devel            x86_64    2.4.46-15.el8                                        BaseOS       811 k
  python36-devel            x86_64    3.6.8-2.module_el8.3.0+562+e162826a                  AppStream     16 k
Update Prerequisite Libraries

Install and Configure PosrgreSQL

Odoo is using PosrgreSQL as default database. The PostgreSQL installation on CentOS 8 has been discussed on previous article, PostgreSQL (Postgres) Installation on CentOS 8. At this section we will check if the PostgreSQL daemon is running properly by submitting command line : sudo systemctl status postgresql-13.

ramans@localhost ~]$ sudo systemctl status postgresql-13
 ● postgresql-13.service - PostgreSQL 13 database server
    Loaded: loaded (/usr/lib/systemd/system/postgresql-13.service; enabled; vendor preset: disabled)
    Active: active (running) since Sun 2020-12-27 23:27:06 PST; 38s ago
      Docs: https://www.postgresql.org/docs/13/static/
   Process: 12714 ExecStartPre=/usr/pgsql-13/bin/postgresql-13-check-db-dir ${PGDATA} (code=exited, status=0>
  Main PID: 12720 (postmaster)
     Tasks: 8 (limit: 49341)
    Memory: 20.9M
    CGroup: /system.slice/postgresql-13.service
            ├─12720 /usr/pgsql-13/bin/postmaster -D /var/lib/pgsql/13/data/
            ├─12721 postgres: logger 
            ├─12723 postgres: checkpointer 
            ├─12724 postgres: background writer 
            ├─12725 postgres: walwriter 
            ├─12726 postgres: autovacuum launcher 
            ├─12727 postgres: stats collector 
            └─12728 postgres: logical replication launcher 
 Dec 27 23:27:06 localhost systemd[1]: Starting PostgreSQL 13 database server…
 Dec 27 23:27:06 localhost postmaster[12720]: 2020-12-27 23:27:06.727 PST [12720] LOG:  redirecting log outp>
 Dec 27 23:27:06 localhost postmaster[12720]: 2020-12-27 23:27:06.727 PST [12720] HINT:  Future log output w>
 Dec 27 23:27:06 localhost systemd[1]: Started PostgreSQL 13 database server.
Postgres services
PostgreSQL services

For Odoo application purpose, we will create a new database user called as odoo14, by submitting command line : sudo su - posrgres -c "createuser -s odoo14"

[ramans@localhost ~]$ sudo su - postgres -c "createuser -s odoo14"

Install Wkhtmltopdf

We require wkhtmltopdf application to print PDF reports in Odoo. wkhtmltopdf is an open source (LGPLv3) and much effective command-line shell utility that enables user to convert any given HTML (Web Page) to PDF document or an image (jpg, png, etc). The installation of wkhtmltopdf has been discussed on How to Install wkthmltopdf and wkhtmltoimage on CentOS 8 article.

On this section we will query its version to ensure if the wkhtmltopdf tools has been installed on our CentOS system, by submitting command line : wkhtmltopdf -- version and wkhtmltoimage --version

[ramans@localhost ~]$ wkhtmltopdf --version  
 wkhtmltopdf 0.12.6 (with patched qt)  
[ramans@localhost ~]$ wkhtmltoimage --version  
 wkhtmltoimage 0.12.6 (with patched qt)
whkhtmltopdf version and wkhtmltoimage version
whkhtmltopdf version and wkhtmltoimage version

Install and Configure Odoo 14

At this section we will install the Odoo version 14 community edition where the binary source is located on the Odoo Github official. We will clone it to our system by using a new system user called as odoo14.

Creating a system user

So for the first time we have to create a new user first, by submitting command line : sudo useradd -m -U -r -d /opt/odoo14 -s /bin/bash odoo14.

[ramans@localhost ~] sudo useradd -m -U -r -d /opt/odoo14 -s /bin/bash odoo14.
Creating odoo14 user on CentOS

Copy Odoo Binary files from GitHub

On this step we will clone Odoo binary files from Odoo official GitHub repository by using odoo14 user and locate it to the /opt/odoo14 directory.

ramans@localhost ~]$ sudo su - odoo14
 [sudo] password for ramans: 
 [odoo14@localhost ~]$ git clone https://www.github.com/odoo/odoo --depth 1 --branch 14.0 /opt/odoo14/odoo
 Cloning into '/opt/odoo14/odoo'…
 warning: redirecting to https://github.com/odoo/odoo.git/
 remote: Enumerating objects: 30175, done.
 remote: Counting objects: 100% (30175/30175), done.
 remote: Compressing objects: 100% (23201/23201), done.
 remote: Total 30175 (delta 9375), reused 18559 (delta 5862), pack-reused 0
 Receiving objects: 100% (30175/30175), 130.66 MiB | 705.00 KiB/s, done.
 Resolving deltas: 100% (9375/9375), done.
 Updating files: 100% (26647/26647), done.
Clone odoo14 binnary files from GitHub
Clone odoo14 binnary files from GitHub

Odoo 14 Installation on CentOS 8

After cloning Odoo binary files, then we will do the installation inside Pyhon virtual environment. We will create Python virtual environment first for Odoo installation, by submitting command line :

[odoo14@localhost ~]$ cd /opt/odoo14
[odoo14@localhost ~]$ python3 -m venv venv
[odoo14@localhost ~]$ source venv/bin/activate
(venv) [odoo14@localhost ~]$

After entering inside Python virtual environment, the we will install the Odoo 14 Community edition on the system, by submitting command line : pip3 install -r odoo/requirements.txt.

(venv) [odoo14@localhost ~]$ pip3 install -r odoo/requirements.txt
Odoo installation process
Odoo installation process
Odoo installation process is completed done
Odoo installation process is completed done

After Odoo installation is completed done, then we will exit from Python virtual environment by submitting command line deactivate.

(venv) [odoo14@localhost ~]$ deactivate

The next step is creating a new directory inside /opt/odoo14, called as odoo-custom-addons. The directory will be used to hold the addons_path parameter to define a list of directories where Odoo searches for modules. Then exit from odoo14 user to the sudo user.

[odoo14@localhost ~]$ mkdir /opt/odoo14/odoo-custom-addons
[odoo14@localhost ~]$ exit
 logout
[ramans@localhost ~]$

Creating Odoo configuration file

After returning to the sudo user, then we will create Odoo configuration file which is locate on the /etc/odoo14.conf. The conten of configuration file is as follow :

[ramans@localhost ~]$ sudo vi /etc/odoo14.conf

The conten of /etc/odoo14.conf file :

 [options]
 admin_passwd = otod1g1net_oke
 db_host = False
 db_port = False
 db_user = odoo14
 db_password = False
 addons_path = /opt/odoo14/odoo/addons, /opt/odoo14/odoo-custom-addons
Odoo14 configuration file
Odoo14 configuration file

Creating Odoo Systemd Unit File

On this step, we will create an Odoo systemd unit file by creating a new file /etc/systemd/system/odoo14.service.

[ramans@localhost ~]$ sudo vi /etc/systemd/system/odoo14.service
 [Unit]
 Description=Odoo14
 Requires=postgresql-13.service
 After=network.target postgresql-13.service
 [Service]
 Type=simple
 SyslogIdentifier=odoo14
 PermissionsStartOnly=true
 User=odoo14
 Group=odoo14
 ExecStart=/opt/odoo14/venv/bin/python3 /opt/odoo14/odoo/odoo-bin -c /etc/odoo14.conf
 StandardOutput=journal+console
/etc/systemd/system/odoo14.service file
/etc/systemd/system/odoo14.service

After creating Odoo systemd file, then we have notify if there was a new unit file already exists, by submitting command line : sudo systemctl daemon-reload. Then start and enable the service. To ensure if the service is running, we also query its service by submitting command line sudo systemctl status odoo14.

[ramans@localhost ~]$ sudo systemctl enable --now odoo14
 [ramans@localhost ~]$ sudo systemctl status odoo14
 ● odoo14.service - Odoo14
    Loaded: loaded (/etc/systemd/system/odoo14.service; enabled; vendor preset: disabled)
    Active: active (running) since Sun 2020-12-27 23:57:22 PST; 52s ago
  Main PID: 30767 (python3)
     Tasks: 4 (limit: 49341)
    Memory: 61.2M
    CGroup: /system.slice/odoo14.service
            └─30767 /opt/odoo14/venv/bin/python3 /opt/odoo14/odoo/odoo-bin -c /etc/odoo14.conf
 Dec 27 23:57:22 localhost systemd[1]: Started Odoo14.
 Dec 27 23:57:24 localhost odoo14[30767]: /opt/odoo14/venv/lib64/python3.6/site-packages/psycopg2/init.p>
 Dec 27 23:57:24 localhost odoo14[30767]:   """)
 Dec 27 23:57:24 localhost odoo14[30767]: 2020-12-28 07:57:24,110 30767 INFO ? odoo: Odoo version 14.0
 Dec 27 23:57:24 localhost odoo14[30767]: 2020-12-28 07:57:24,111 30767 INFO ? odoo: Using configuration fil>
 Dec 27 23:57:24 localhost odoo14[30767]: 2020-12-28 07:57:24,111 30767 INFO ? odoo: addons paths: ['/opt/od>
 Dec 27 23:57:24 localhost odoo14[30767]: 2020-12-28 07:57:24,112 30767 INFO ? odoo: database: odoo14@defaul>
 Dec 27 23:57:24 localhost odoo14[30767]: 2020-12-28 07:57:24,724 30767 INFO ? odoo.addons.base.models.ir_ac>
 Dec 27 23:57:25 localhost odoo14[30767]: 2020-12-28 07:57:25,087 30767 INFO ? odoo.service.server: HTTP ser>
Odoo 14 service has been already running

We will use journalctl to see if the messages logged by the Odoo service.

[ramans@localhost ~]$ sudo journalctl -u odoo14
 [sudo] password for ramans: 
 -- Logs begin at Sun 2020-12-27 22:19:25 PST, end at Mon 2020-12-28 00:00:49 PST. --
 Dec 27 23:57:22 localhost systemd[1]: Started Odoo14.
 Dec 27 23:57:24 localhost odoo14[30767]: /opt/odoo14/venv/lib64/python3.6/site-packages/psycopg2/init.p>
 Dec 27 23:57:24 localhost odoo14[30767]:   """)
 Dec 27 23:57:24 localhost odoo14[30767]: 2020-12-28 07:57:24,110 30767 INFO ? odoo: Odoo version 14.0
 Dec 27 23:57:24 localhost odoo14[30767]: 2020-12-28 07:57:24,111 30767 INFO ? odoo: Using configuration fil>
 Dec 27 23:57:24 localhost odoo14[30767]: 2020-12-28 07:57:24,111 30767 INFO ? odoo: addons paths: ['/opt/od>
 Dec 27 23:57:24 localhost odoo14[30767]: 2020-12-28 07:57:24,112 30767 INFO ? odoo: database: odoo14@defaul>
 Dec 27 23:57:24 localhost odoo14[30767]: 2020-12-28 07:57:24,724 30767 INFO ? odoo.addons.base.models.ir_ac>
 Dec 27 23:57:25 localhost odoo14[30767]: 2020-12-28 07:57:25,087 30767 INFO ? odoo.service.server: HTTP ser>
Odoo Journal is running

Testing Odoo 14 Installation

So far, the Odoo installaton is completed done. On this section we will test the installation by using web browser. We will hit the http://<your_domain_or_IP_address>:8069.

Conclusion

So far, the Odoo 14 installation on CentOS 8 has been completed done successfully. On this tutorial is less of NginX installation and configuration, but as the basic function of Odoo it has been fulfilled. On the next time, we will discuss about using Odoo. Have a great day.

Share this article via :

Leave a Reply

Your email address will not be published. Required fields are marked *