Install Odoo 12 on CentOS 7
5 min read
Odoo is the most popular all-in-one business software in the world. It offers a range of business applications including CRM, website, e-Commerce, billing, accounting, manufacturing, warehouse, project management, inventory and much more, all seamlessly integrated.
In this tutorial, we’ll show you how to install Odoo 12 from source inside a Python virtual environment on a CentOS 7 machine.
Make sure you are logged in as a user with sudo privileges before proceeding with the tutorial.
Install Python 3.6 and Odoo Dependencies
We will install Python 3.6 packages from the Software Collections (SCL) repository.
By enabling SCL you will gain access to the newer versions of programming languages and services which are not available in the core repositories.
Enable the EPEL and SCL repositories with the following command:
sudo yum install epel-release centos-release-scl
Once the repositories are enabled, install Python 3.6 all the tools required to build Odoo dependencies:
sudo yum install rh-python36 git gcc wget nodejs-less libxslt-devel bzip2-devel openldap-devel libjpeg-devel freetype-devel
During the installation you will be prompted to accept the GPG keys.
Create Odoo User
Create a new system user and group with home directory
/opt/odoo that will run the Odoo service:
sudo useradd -m -U -r -d /opt/odoo12 -s /bin/bash odoo12
Install and configure PostgreSQL
At the time of writing this article, the latest version of PostgreSQL available from the CentOS repositories is PostgreSQL version 9.2 which is not officially supported by Odoo.
We’ll install PostgreSQL 10 from the official PostgreSQL repositories.
Start by enabling the PostgreSQL repository:
sudo yum install https://download.postgresql.org/pub/repos/yum/10/redhat/rhel-7-x86_64/pgdg-centos10-10-2.noarch.rpm
Install the PostgreSQL server and create a new PostgreSQL database cluster:
sudo yum install postgresql10-server postgresql10-devel
sudo /usr/pgsql-10/bin/postgresql-10-setup initdb
Once the installation is completed, enable and start the PostgreSQL service:
sudo systemctl enable postgresql-10
sudo systemctl start postgresql-10
Create a PostgreSQL user with the same name as the previously created system user, in our case
sudo su - postgres -c "createuser -s odoo12"
wkhtmltox package provides a set of open-source command line tools which can render HTML into PDF and various image formats. In order to print PDF reports, you will need the
wkhtmltopdf tool. The recommended version for Odoo is
0.12.1 which is not available in the official CentOS 7 repositories.
Download the recommended version with the following wget command:
Once the download is complete, install the
rpm package by typing:
sudo yum localinstall wkhtmltox-0.12.1_linux-centos7-amd64.rpm
Install and Configure Odoo 12
Before starting with the installation process, make sure you switch to user “odoo12”:
sudo su - odoo12
Start by cloning the Odoo 12 source code from the Odoo GitHub repository:
git clone https://www.github.com/odoo/odoo --depth 1 --branch 12.0 /opt/odoo12/odoo
Enable software collections so we can access the python 3.6 binaries:
scl enable rh-python36 bash
Create a new Python virtual environment for the Odoo installation with:
python3 -m venv venv
Activate the environment:
Install all required Python modules:
pip3 install -r odoo/requirements.txt
Install Python 3.6 and Odoo Dependenciessection.
Once the installation is completed deactivate the environment using the following command:
Create a new directory for the custom addons:
Switch back to your sudo user:
Next, open your text editor and create the following configuration file:
sudo nano /etc/odoo12.conf
[options] ; This is the password that allows database operations: admin_passwd = superadmin_passwd db_host = False db_port = False db_user = odoo12 db_password = False addons_path = /opt/odoo12/odoo/addons, /opt/odoo12/odoo-custom-addons
Save and close the file.
superadmin_passwdto something more secure.
Create a systemd unit file
To run Odoo as a service we will create a unit file.
Open your text editor and create a file named
odoo12.service inside the
sudo nano /etc/systemd/system/odoo12.service
Paste the following content:
[Unit] Description=Odoo12 Requires=postgresql-10.service After=network.target postgresql-10.service [Service] Type=simple SyslogIdentifier=odoo12 PermissionsStartOnly=true User=odoo12 Group=odoo12 ExecStart=/usr/bin/scl enable rh-python36 -- /opt/odoo12/venv/bin/python3 /opt/odoo12/odoo/odoo-bin -c /etc/odoo12.conf StandardOutput=journal+console [Install] WantedBy=multi-user.target
Save the file and close the editor.
Notify Systemd that we created a new unit file:
sudo systemctl daemon-reload
Start and enable the Odoo service by executing:
sudo systemctl enable odoo12
sudo systemctl start odoo12
You can check the service status with the following command:
sudo systemctl status odoo12
● odoo12.service - Odoo12 Loaded: loaded (/etc/systemd/system/odoo12.service; disabled; vendor preset: disabled) Active: active (running) since Tue 2018-10-30 16:35:09 UTC; 6s ago Main PID: 24649 (scl) CGroup: /system.slice/odoo12.service ├─24649 /usr/bin/scl enable rh-python36 -- /opt/odoo12/venv/bin/python3 /opt/odoo12/odoo/odoo-bin -c /etc/odoo12.conf ├─24650 /bin/bash /var/tmp/scldyaa9h └─24653 /opt/odoo12/venv/bin/python3 /opt/odoo12/odoo/odoo-bin -c /etc/odoo12.conf
If you want to see the messages logged by the Odoo service you can use the command below:
sudo journalctl -u odoo12
Test the Installation
Open your browser and type:
Assuming the installation is successful, a screen similar to the following will appear:
If you can’t access the page then probably your firewall is blocking port
Use the following commands to open the necessary port:
sudo firewall-cmd --permanent --zone=public --add-port=8069/tcp
sudo firewall-cmd --reload
This tutorial walked you through the installation of Odoo 12 on CentOS 7 in a Python virtual environment.
You may also want to check our tutorial about how to create automatic daily backups of your Odoo databases.
If you hit any problems, leave a comment below.