How To Install Odoo on CentOS 7?

Introduction

Odoo is a popular open source platform for enterprise management applications. Formerly known as OpenERP, Odoo features a variety of applications for businesses such as CRM, e-commerce, website, billing, manufacturing, accounting, inventory, project management, warehouse, and more.

For Odoo version 11 to run properly, you need to install Python version 3.5 which may not be present in CentOS repository. For this reason, it’s not possible to use yum for Odoo repository in the installation process of Odoo package.

In this tutorial, we will take you through the installation process of Odoo version 11 using Python virtual environment and Git source on your CentOS 7 server.

Step 1 - Updating System

Before you start, make sure the system is updated with the up-to-date packages by running the following command:

$ sudo yum update

Now, verify that the EPEL repository is enabled using the following command:

$ sudo yum install epel-release

The Software Collections (SCL) repository will help you install Python packages. Once you enable SCL, it will be easier to access the recent versions of services and programming languages that may not be present in the main repositories.

Use the command below to activate the SCL repository:

$ sudo yum install centos-release-scl

To start installing Python 3.5, run the command below:

$ sudo yum install rh-python35

Now, install git, pit and other tools needed to create Odoo dependences:

$ sudo yum install git gcc wget nodejs-less libxslt-devel bzip2-devel openldap-devel libjpeg-devel freetype-devel postgresql-devel

Step 2: Creating Odoo User

To create a system user besides a group for Odoo service with the/opt/odoo home directory run the following command:

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

Note: You can choose a name for the user as long as you have created a user for PostgreSQL bearing the same name.

Step 3 - Installing and Configuring PostgreSQL

Next, start the installation process of PostgreSQL server then create a database for the same. To do so, run the following command:

$ sudo yum install postgresql-server$ sudo postgresql-setup initdb

After the installation process is complete, activate PostgreSQL:

$ sudo systemctl enable postgresql$ sudo systemctl start postgresql

Next, create a new PostgreSQL user with a similar name used when creating the system user, in this case, we will use odoo:

$ sudo su - postgres -c "createuser -s odoo"

Step 4 - Installing Wkhtmltopdf

The next step is to install wkhtmltox package. It offers a set of command lines tools that integrate HTML into a PDF file as well as other image formats. To get the printed PDF details, you need this tool. By default, wkhtmltopdf version 0.12.1 is what is recommended for Odoo, but it’s not present in the CentOS 7 repository. So, you should make sure you have downloaded and installed it using the commands below:

$ wgethttps://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.1/wkhtmltox-0.12.1_linux-centos7-amd64.rpm$ sudo yum localinstall wkhtmltox-0.12.1_linux-centos7-amd64.rpm

Step 5 - Installing And Configuring Odoo

Now, we need to install the latest stable Odoo version from the GitHub repository to control all its current versions and available updates. It is also recommended to use virtualenv to help create several remote environments for Python.

Before you start the installation, ensure you shift to odoo user using the command below:

$ sudo su - odoo

To verify that your system is logged-in as the odoo use, run the command below:

$ whoami

Now, start installing oddo. But before that, create a clone for Odoo from the GitHub repository:

$ git clone https://www.github.com/odoo/odoo --depth 1 --branch 11.0 /opt/odoo/odoo11

Next, make sure the software collections are enabled to access the binaries for Python version 3.5:

$ scl enable rh-python35 bash

Next, use the command below to create a virtual environment for Odoo:

$cd /opt/odoo$ python3 -m venv odoo11-venv

Now, activate the virtual environment:

$source odoo11-venv/bin/activate

Next, install the necessary modules for Python:

$ pip3 install -r odoo11/requirements.txt

If there are no errors after running the installation, ensure you have installed all the necessary dependencies as indicated in step 1 on this tutorial.

After odoo is installed, deactivate the virtual environment and resume to the sudo user with the command below:

$ deactivate && exit$exit

Make sure you install the custom modules in a different file. If you want to create another directory to store these modules, run the command below:

$ sudo mkdir /opt/odoo/odoo11-custom-addons$ sudo chown odoo: /opt/odoo/odoo11-custom-addons

The next thing is to create a new file to configure Odoo:

/etc/odoo11.conf

[options]; This is the password that allows database operations:admin_passwd = superadmin_passwddb_host = Falsedb_port = Falsedb_user = odoodb_password = Falseaddons_path = /opt/odoo/odoo11/addons; If you are using custom modules; addons_path = /opt/odoo/odoo11/addons,/opt/odoo/odoo11-custom-addons

Note: Remember to adjust the section superadmin_passwd to make it secure and if you plan to use the custom modules, adjust the addons_path.

Step 6 - Creating A Systemd Unit File

To make sure odoo will run as a service, create a unit file known as odoo11.service in the /etc/systemd/system/ directory and add the content below:

[Unit]Description=Odoo11Requires=postgresql.serviceAfter=network.target postgresql.service[Service]Type=simpleSyslogIdentifier=odoo11PermissionsStartOnly=trueUser=odooGroup=odooExecStart=/usr/bin/scl enable rh-python35 -- /opt/odoo/odoo11-venv/bin/python3 /opt/odoo/odoo11/odoo-bin -c /etc/odoo11.confStandardOutput=journal+console[Install]WantedBy=multi-user.target

Now, inform systemd that you have created a unit file and restart Odoo using the following command:

$ sudo systemctl daemon-reload$ sudo systemctl start odoo11

Check to verify the status of the service with the command below:

$ sudo systemctl status odoo11

The output should look like this:

● odoo11.service - Odoo11   Loaded: loaded (/etc/systemd/system/odoo11.service; disabled; vendor preset: disabled)   Active: active (running) since Wed 2018-03-2820:13:30 UTC; 6s ago Main PID:16174 (scl)   CGroup: /system.slice/odoo11.service           ├─16174 /usr/bin/scl enable rh-python35 -- /opt/odoo/odoo11-venv/bin/python3 /opt/odoo/odoo11/odoo-bin -c /etc/odoo11.conf           ├─16175 /bin/bash /var/tmp/sclihoNjg           └─16178 /opt/odoo/odoo11-venv/bin/python3 /opt/odoo/odoo11/odoo-bin -c /etc/odoo11.conf

If you find no errors after running this command, go ahead and set the Odoo to automatically start at boot time:

$ sudo systemctl enable odoo11

Use the following command to access the messages in Odoo:

$ sudo journalctl -u odoo11

Step 7 - Testing Tthe Installation

To test whether the installation is working, go to your web browser and enter: http://<your_domain_or_IP_address>:8069.

If the installation of Odoo service is successful, you should see the screen below:

How To Install Odoo on CentOS 7

If the page is inaccessible, then check the firewall to ensure that port 8069 is not blocked.

Conclusion

That’s it! You have successfully installed Odoo on CentOS 7. Odoo is a user-friendly ERP based package, so you don’t need any technical expertise to either add, remove or even manage multiple modules.

Check out these top 3 VPS services:

Was this article helpful?