Home Linux ServerTools How to install Odoo on CentOS 8 (Open Source ERP and CRM)

How to install Odoo on CentOS 8 (Open Source ERP and CRM)

by Thạch Phạm
Published: Last Updated on
A+A-
Reset

Introduction

Odoo is an all-in-one open-source CRM business management software. It offers a different set of business apps for different uses like eCommerce, project management, helpdesk, accounting, inventory and some website building tools.

In this article, AZDIGI will show you how to install Odoo (Open Source ERP&CRM) on CentOS 8. And to install it, you need a CentOS 8 server. If you don’t have a VPS/server, do not hesitate to order a KVM VPS at AZDIGI.

Steps to install Odoo on CentOS 8

Step 1: Update the system and install the EPEL repository

Starting from CentOS 8 you will no longer use the YUM command, but instead, you will use DNF.

The first step when installing Odoo is to install the EPEL repository which provides a set of additional packages for Linux. But first, make sure to update your system first.

AZDIGI Tutorial
dnf update -y
    
CleanShot 2020 10 10 at 22.48.05@2x

After the system update is complete, install the EPEL repository with the following command:

AZDIGI Tutorial
dnf install epel-release
    
CleanShot 2020 10 10 at 22.51.44@2x

Step 2: Install Python3 and other extra components

Next, install Python3 and other extra components that Odoo requires. You can use the following command to install.

AZDIGI Tutorial
dnf install python36 python36-devel git gcc wget nodejs libxslt-devel bzip2-devel openldap-devel libjpeg-devel freetype-devel -y
    
CleanShot 2020 10 10 at 22.54.37@2x

Step 3: Install and configure PostgreSQL on CentOS 8

PostgreSQL is a free and open-source relational database management system used in a wide range of applications to store data. We need to install PostgreSQL for Odoo and to do this run the following command.

AZDIGI Tutorial
dnf install postgresql-server postgresql-contrib

    
CleanShot 2020 10 10 at 22.57.36@2x

Next, to create a PostgreSQL database cluster, please use the following command:

AZDIGI Tutorial
postgresql-setup initdb
    
CleanShot 2020 10 10 at 22.59.25@2x

Now create a new PostgreSQL user with the same name as the Odoo user system.

AZDIGI Tutorial
su - postgres -c "createuser -s odoo"
    

Once the database cluster creation is complete, please restart and enable PostgreSQL by running the following command: Once restarted, use status to check the status.

AZDIGI Tutorial
systemctl restart postgresql
systemctl enable postgresql
systemctl status postgresql
    
CleanShot 2020 10 10 at 23.00.51@2x

Step 4: Install Wkhtmltopdf Tool on CentOS 8

In order for Odoo to print PDF reports, a package called Wkhtmltopdf is required. This is used to render HTML to PDF and other image formats. The rpm package is available on GitHub and you can install the following from rpm.

AZDIGI Tutorial
dnf install https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox-0.12.5-1.centos8.x86_64.rpm
    
CleanShot 2020 10 10 at 23.04.46@2x 1

Step 5: Install and configure Odoo on CentOS 8

You need to create and add a new system user to run the Odoo service. In this tutorial, I will create a user named Odoo. The home directory is in the /opt/odoo directory.

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

To start installing Odoo, switch to the user you created. But above I just created a user named Odoo.

AZDIGI Tutorial
su - odoo
    

Then clone Odoo 13 from the GIT repository.

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

    
CleanShot 2020 10 10 at 23.13.00@2x

Next, clone the virtual environment.

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

The virtual environment has been created, please activate it as follows:

AZDIGI Tutorial
source odoo13-venv/bin/activate
    
CleanShot 2020 10 10 at 23.16.24@2x

In the virtual environment, install the necessary Python modules for a smooth Odoo installation.

AZDIGI Tutorial
pip3 install -r odoo13/requirements.txt
    
CleanShot 2020 10 10 at 23.17.46@2x

After installing the Python modules, you need to exit the virtual environment and return to the previous sudo user.

AZDIGI Tutorial
deactivate && exit
    

Next, create a folder for the modules and assign ownership to the created user.

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

Create a log directory to track and handle errors later.

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

Then you create the Odoo configuration file at /etc/odoo.conf and enter the following lines:

AZDIGI Tutorial
sudo vi /etc/odoo.conf
    

Copy the content below and paste it into the file: odoo.conf

AZDIGI Tutorial
[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
    
CleanShot 2020 10 10 at 23.33.52@2x

Step 6: Create Systemd Unit File Odoo

Now create a systemd unit file for Odoo as follows:

AZDIGI Tutorial
vi /etc/systemd/system/odoo13.service
    

Then paste the following code and the file you just created.

[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 system to apply the changes.

AZDIGI Tutorial
systemctl daemon-reload
    

Next, start and enable Odoo.

AZDIGI Tutorial
systemctl start odoo13
systemctl enable odoo13
systemctl status odoo13
    

Odoo uses port 8069 so you need to open this port with Firewall. If you use firewalld use the following command to open it.

AZDIGI Tutorial
firewall-cmd --add-port=8069/tcp --zone=public --permanent
firewall-cmd --reload
    

Step 7: Install Nginx as Reverse Proxy for Odoo

Finally, I will install the Nginx web server that will act as a reverse proxy for the Odoo instance. To install it, run the command:

AZDIGI Tutorial
dnf install nginx
    
CleanShot 2020 10 10 at 23.46.37@2x

After installing NGINX, create a virtual host file and copy and paste the following code:

AZDIGI Tutorial
vi /etc/nginx/conf.d/odoo13.conf
    
upstream odoo {
 server 127.0.0.1:8069;
}
server {
    listen 80;
    server_name server-IP;

    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;
}

Then you save and do not restart NGINX

AZDIGI Tutorial
systemctl start nginx
systemctl enable nginx
    
CleanShot 2020 10 10 at 23.49.34@2x

Step 8: Setup Odoo Setup web browser

Now go to https://server-ip to access Odoo and set up the next steps.

A web page similar to the one below will be displayed: For the main password, use the password specified in Step 5 when creating the custom Odoo configuration file. Then proceed to fill in all the other entries and click the Create database button.

CleanShot 2020 10 10 at 23.51.17@2x

After successfully entering the information, it will take you to the dashboard interface as shown below: You will see different applications and can install applications.

Screenshot 2021 04 16 at 21.06.59

So AZDIGI has just shown you to complete the installation of Odoo on CentOS 8. Hopefully, the above article will help you to be proactive in the installation without any problems.

If you have questions or need support, please live chat with Technical Department. Or send the ticket to the Technical Department according to the information below.

  • Hotline 247: 028 888 24768 (Ext 0)
  • Ticket/Email: You can use your email to register for the service and send it directly to: support@azdigi.com

Đánh giá

Tham gia nhóm hỗ trợ Server - Hosting

Tham gia nhóm Hỗ trợ Server - Hosting & WordPress để cùng nhau hỏi đáp và hỗ trợ các vấn đề về WordPress, tối ưu máy chủ/server.

Tham gia ngay

Bài viết cùng chuyên mục

AZDIGI – Không chỉ là đơn vị hàng đầu trong lĩnh vực Web Hosting và Máy chủ, chúng tôi mong muốn mang lại những kiến thức bổ ích nhất và luôn cập nhật thường xuyên cho cộng đồng người đam mê thiết kế website, công nghệ,…

Vui lòng không sao chép nội dung nếu chưa xin phép. Designed and Developed by PenciDesign