Odoo is the most popular comprehensive business software in the world. It offers a variety of business applications including CRM, Website, E-Commerce, Billing, Accounting, Manufacturing, Warehouse, Project Management, Inventory and many more, all integrated into one program.
This tutorial covers the steps required to install and configure Odoo 12 for production using a Git source and Python virtual environment on a CentOS 7 system.
Make sure you are logged in as the sudo user before starting this tutorial.
Install python 3.6 and Odoo dependencies
We will be installing the Python 3.6 package from Software Suite Repository (SCL).
Enabling SCL gives you access to newer versions of the programming language and services not available in the CentOS 7 core repositories.
Enable EPEL and SCL repositories with the following command:
sudo yum instal epel-release centos-release-scl
Once the repository is enabled, install Python 3.6 all the tools needed 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 installation, you will be asked to accept a GPG key.
Create an Odoo user
Create a new system user and group using the main directory / opt / odoo that will launch the Odoo service:
sudo useradd -m -U -r -d /opt/odoo12 -s /bin/bash odoo12
You can name the user what you want, but be sure to create a PostgreSQL user with the same name.
Install and configure PostgreSQL
At the time of writing this article, the latest PostgreSQL version available from CentOS repositories is PostgreSQL version 9.2 which is not officially supported by Odoo.
We will be installing PostgreSQL 10 from the official PostgreSQL repositories.
Get started with 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 group:
sudo yum instal postgresql10-server postgresql10-devel sudo /usr/pgsql-10/bin/postgresql-10-setup initdb
After the installation is complete, activate and start the PostgreSQL service:
sudo systemctl enable postgresql-10 sudo systemctl start postgresql-10
Create a PostgreSQL user with the same user name as the previously created system, in our case the previous username
sudo su - postgres -c "createuser -s odoo12"
The wkhtmltox package provides a set of open source command line tools that can convert HTML to PDF and various image formats. To print a PDF report, you need a tool
wkhtmltopdf. The recommended version for Odoo is
0.12.1 It is not available in the official Ubuntu 18.04 repositories.
Download the package with the following wget command:
After the download completes, install the package by typing:
sudo yum localinstall wkhtmltox-0.12.1_linux-centos7-amd64.rpm
Install and configure Odoo 12
Before starting the installation process, go to the user
sudo su - odoo12
Then clone the Odoo 12 source code from the GitHub repository:
git clone https://www.github.com/odoo/odoo --depth 1 --branch 12.0 /opt/odoo12/odoo
Enable program groups so that we can access Python 3.6 binaries:
scl enable rh-python36 bash
Create a new Python virtual environment to install Odoo 12:
cd /opt/odoo12 python3 -m venv venv
Activate the environment with the command
source the following:
Install all required Python modules:
pip3 install -r odoo/requirements.txt
If you encounter translation errors during installation, be sure to install all the required dependencies listed in the section Before starting At the top of this article.
Disable the environment with the following command:
Create a new directory of custom add-ons:
Go back to your sudo user:
Next, create a configuration file, and copy the typical included configuration file:
sudo cp /opt/odoo12/odoo/debian/odoo.conf /etc/odoo12.conf
Open the file and edit it as follows:
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
Don’t forget to change
superadmin_passwd Password more secure and easy to remember.
Create a Systemd console file
To run Odoo as a service, we need to create a system unit file
odoo12.service In the manual
Open the text editor and paste the following configuration:
sudo nano /etc/systemd/system/odoo12.service
[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
Notify systemd that there is a new module file and start the Odoo service by running:
sudo systemctl daemon-reload sudo systemctl start odoo12
Check the service status with the following command:
sudo systemctl status odoo12
The output will look as shown below indicating that Odoo is running.
● 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
Enable Odoo service to start automatically on boot:
sudo systemctl enable odoo12
If you want to see the messages recorded by Odoo service, you can use the command below:
sudo journalctl -u odoo12
Odoo install test
Open the browser and type:
Assuming the installation was successful, a screen similar to the following will appear:
If you cannot reach the page, it is possible that the firewall is blocking port 8069.
Use the following command to open the required ports:
sudo firewall-cmd --permanent --zone=public --add-port=8069/tcp sudo firewall-cmd --reload
This tutorial walks you through installing Odoo 12 on CentOS 7 in a Python virtual environment.
Originally posted 2020-11-19 01:03:05.