How to install Odoo 12 with PostgreSQL 11 on CentOS 7

The Community version of Odoo is an open-source version, while the Enterprise version adds proprietary features and services to the Community edition. We shall focus on the open-source version installation.

Odoo is a business software that comes packed with CRM, e-commerce, billing, accounting, project management, manufacturing, warehouse, and inventory apps. The Community version is an open-source version, while the Enterprise version adds proprietary features and services to the Community edition.

At FOSS Linux, we are focused on open-source apps, so in this tutorial, we are going to install and configure the Oddo community version on CentOS.

Installing Odoo 12 on CentOS

We shall execute commands using the root user.

1. Update System

yum update

Update Server
Update Server

The server will ask to update or no. Type “y” and hit enter. It will get some time to update the system.

Update Completed
Update Completed

2. Configure Needed Repositories

Enable Epel repository:

yum install epel-release

Add EPEL Repository
Add EPEL Repository

Enable the Software Collections (SCL) repository:

yum install centos-release-scl

Enable SCL Repository

Enable SCL Repository

3. Install Python 3.6 and Dependencies

yum install rh-python36

Install Python 3.6
Install Python 3.6

Install needed dependencies.

yum install bzip2-devel freetype-devel nodejs-less libxslt-devel openldap-devel libjpeg-devel gcc

Install Dependencies
Install Dependencies

4. Create Odoo User

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

Create Odoo User
Create Odoo User

5. Install and configure PostgreSQL

Check repositories from the official site and install the Postgres repository for Centos 7 64bit.

rpm -Uvh https://yum.postgresql.org/11/redhat/rhel-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm

Configure PostgreSQL Repository
Configure PostgreSQL Repository

Now Install PostgreSQL 11 server.

yum install postgresql11-server

Install PostgreSQL 11
Install PostgreSQL 11

Initialize PGDATA

Initialize the database using the below command. It should create a data directory and other configuration files on the system.

/usr/pgsql-11/bin/postgresql-11-setup initdb

Initialize PGDATA
Initialize PGDATA

Now, check PostgreSQL Service Status.

systemctl status postgresql-11.service

PostgreSQL Service Status
PostgreSQL Service Status

If service is not started. Run the following command to start service:

systemctl start postgresql-11.service

Enable service on the system boot.

systemctl enable postgresql-11.service

Enable Service OnBoot
Enable Service OnBoot

Need to Check and Verify PostgreSQL Installation.

su - postgres -c "psql"

Check Installation
Check Installation

If you want, you can create a password too.

 \password postgres

Configure PostgreSQL Password.
Configure PostgreSQL Password

Create a PostgreSQL user.

su - postgres -c "createuser -s odoousr"

Create PostgreSQL User
Create PostgreSQL User

6. Install Wkhtmltopdf

It is an open-source tool that Odoo uses to make HTML in PDF formats so that it can print PDF reports.

wget https://downloads.wkhtmltopdf.org/0.12/0.12.5/wkhtmltox-0.12.5-1.centos7.x86_64.rpm

Download Package
Download Package

“wget” is not available. need to install it first

yum install wget -y

Install the downloaded package using below command:

yum localinstall wkhtmltox-0.12.5-1.centos7.x86_64.rpm

Install wkhtmltopdf Package
Install wkhtmltopdf Package

7. Install and configure Odoo 12

Git is not installed on your system Install git first.

 yum install git -y

Change user to odoo user:

su - odoousr

Now we are going to clone odoo 12 from its repository. We are going to download it to the “/opt/odoo/odoo12” directory.

git clone https://www.github.com/odoo/odoo --depth 1 --branch 12.0 /opt/odoo/odoo12

Git Clone Odoo12
Git Clone Odoo12

To enable python36, run the following command:

scl enable rh-python36 bash

8. Create a new virtual environment

Go to odoo directory:

cd /opt/odoo

Run the below command to create an environment.

python3 -m venv odoo12-venv

Activate the environment:

source odoo12-venv/bin/activate

Create Virtual Environment
Create Virtual Environment

Upgrade pip:

pip install --upgrade pip

Upgrade Pip
Upgrade Pip

Install the Wheel library, followed by all the required Python modules.

pip3 install wheel
pip3 install -r odoo12/requirements.txt

Install Required Python Modules
Install Required Python Modules

After installation is complete, Deactivate the virtual environment and return to the root user.

Return to root
Return to root

9. Other configurations for Odoo12

Create a directory for custom modules.

 mkdir /opt/odoo/odoo12-custom-addons
chown odoousr: /opt/odoo/odoo12-custom-addons

Folder For Custom Modules
Folder For Custom Modules

Create a configuration file for the Odoo12.

vim /etc/odoo12.conf

If vim is not available, you should install it first, or you can use any editor of your choice.

yum install vim

Add the following lines to file:

 [options]
; This is the password that allows database operations:
admin_passwd = Foss@343fd<?Linux
db_host = False
db_port = False
db_user = odoousr
db_password = False
addons_path = /opt/odoo/odoo12/addons,/opt/odoo/odoo12-custom-addons
logfile = /var/log/odoo12/odoo.log

Configurations
Configurations

Save, and exit. Then create a log folder and grant permission to it.

mkdir -p /var/log/odoo12
chown -R odoousr: /var/log/odoo12

10. Manually start odoo12

Now start service and check whether it is working correctly. Change the user and then start command.

su - odoousr
/usr/bin/scl enable rh-python36 -- /opt/odoo/odoo12-venv/bin/python3 /opt/odoo/odoo12/odoo-bin -c /etc/odoo12.conf

Start Service
Start Service

Check Odoo12 port is up and running. Then open another terminal and run below command:

netstat -tunlp | grep 8069

Odoo12 Port

11. Configure firewall

Check firewall status.

systemctl status firewalld

Firewall Status
Firewall Status

If the service has not started, start it using the following command:

systemctl start firewalld

Add firewall rules and reload firewall:

firewall-cmd --zone=public --permanent --add-service=http
firewall-cmd --zone=public --permanent --add-port=8069/tcp
systemctl reload firewalld

Firewall Rules
Firewall Rules

12. Browse Application

http://Ip or domain name:8069

You will get the Start page.

Start Page
Start Page

If you get a “Service Unavailable” message, temporary change Selinux mode.

setenforce 0

13. Configure Odoo12 run as a Service

Create a systemd file and add the following content to the file:

vim /etc/systemd/system/odoo12.service
[Unit]
Description=Odoo12
Requires=postgresql-11.service
After=network.target postgresql-11.service

[Service]
Type=simple
SyslogIdentifier=odoo12
PermissionsStartOnly=true
User=odoousr
Group=odoousr
ExecStart=/usr/bin/scl enable rh-python36 -- /opt/odoo/odoo12-venv/bin/python3 /opt/odoo/odoo12/odoo-bin -c /etc/odoo12.conf
StandardOutput=journal+console

[Install]
WantedBy=multi-user.target

Save, and exit.

Reload systemctl daemon.

systemctl daemon-reload

14. Now stop previously started odoo12

Check process.

ps -aux | grep odoo

Odoo Process

Odoo ProcessKill process.

kill -9 28416 28417 28420

Make sure to replace process IDs with yours.

15. Now start odoo12  service

systemctl start odoo12

Check status.

systemctl status odoo12

Odoo Service Status
Odoo Service Status

Monitor the log file using the following command:

tail -f /var/log/odoo12/odoo.log

Check status and enable Odoo service on system boot.

systemctl enable odoo12

16. Browse the web site and continue

http://Ip Or Domain name:8069

Add a Master password, database name, and other details.

Odoo DB Creation
Odoo DB Creation

Then click “create database” (Here I added demo data too). You should be redirected to the welcome page.

Welcome Page
Welcome Page

After sign out from the above page, you should go to the login page.

Login Page
Login Page

That’s all about the installation of the latest Odoo 12 on Centos 7. I hope you enjoyed the tutorial.

Darshana
Hey! I'm Darshana, a Linux / DevOps Engineer and also a contributor to FOSS Linux. I enjoy working on various kind of Linux distributions and cloud technologies. During my free time, I love to swim and hike across nature trails. Linux is my love and I'm here to share all my learnings with all of you! Hope you enjoyed reading my article.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

STAY CONNECTED

23,538FansLike
365FollowersFollow
16SubscribersSubscribe

LATEST ARTICLES

How to install CouchPotato on Ubuntu

Downloading movies and copying them over to your home server can get frustrating, especially if you are doing it daily! What if you have an option to download videos automatically, quickly, and above all with excellent quality. CouchPotato allows you to download movies easily once they are available and released automatically.

Top 20 Rsync Examples in Linux

The Rsync (remote sync) command is a Linux/Unix utility used to synchronize and copy files and directories either locally or remotely. Most Linux geeks use Rsync to mirror, backup or migrate data across folders, across disks and networks. One notable feature with the Rsync command is that it uses the "delta transfer algorithm."

Setting up NFS Server on Ubuntu Server

We have put together a detailed step-by-step tutorial that will guide you on how to install and set up NFS Server on Ubuntu so you too can start sharing data with other client systems. It is divided into sections, the first part discussing how to set up the host server and the second part showing you how to set up the client-side. For this tutorial, we will be using Ubuntu 20.04 LTS.

Crontab in Linux Explained With Examples

Crontab is the Linux equivalent of the Window's Task Scheduler. It can help you set up a task to run automatically at a regular...

The 10 Best Linux Server Distros For Home And Businesses

By the year 2020, it is estimated that there are close to 600 Linux distributions in the market. It includes both servers and Desktop versions; therefore, if you are looking for lightweight Linux distribution for your old PC or a reliable desktop version for employees in your organization, you may be overwhelmed with the number of choices for finding one for your use.

How to list the installed Packages on Ubuntu

It is only natural to start installing more and more software on your Ubuntu PC once you start using it. Similarly, it is also natural to lose track of the different packages that you have installed on your system. Eventually, you may be overwhelmed with the number of packages in your system and with the ones you hardly used.

MUST READ

Linux is growing faster than ever. As per the latest report, there is a drop in the Windows 10 market share for the first time, and Linux's market share has improved to 2.87% this month. Most of the features in the list were rolled out in the Pop OS 20.04. Let's a detailed look into the new features, how to upgrade, and a ride through video.
Elementary OS 5.1 Hera has received a point release with a handful of new features and bug fixes, and we will be reviewing the significant changes in this article. For those new to elementary OS, this Ubuntu-based Linux distribution uses their inhouse built Pantheon desktop environment and AppCenter.

Ubuntu MATE 20.04 LTS Review: Refinement at its Best

Ubuntu MATE 20.04 LTS was released a week ago after two years of development. Official updates and security patches will be provided until April 2025. I have installed it on my test laptop for a spin and here are my observations based on almost a week usage.

Installing multiple Linux distros on a USB drive

A bootable Linux USB drive, which also referred to as a Live USB drive, is a drive containing files that enable a computer to boot into a specific Linux distro. It is most commonly used to test-drive various Linux distros before installing on the computer for use as a daily driver.

What is FOSS, and how does it differ from Freeware

The rise of the Linux operating system, in all its various distributions, over the past few decades has catapulted the popularity of Free or Open Source Software (FOSS). Let's guide you in understanding what is FOSS, how it differs from freeware and is Linux a FOSS.

5 Best Music Players for Linux

For sure, there will be Linux users out there who cannot live without music. If you're one of those people, you would know how important it is to have a good music player installed on your computer system. In this article, we present to you the five Best Music Players for Linux, which will hopefully be able to satisfy each of our readers' needs.