How to Install Odoo 12 on CentOS 7

Installing Odoo 12 on CentOS 7Odoo is among the most popular business software which you can find nowadays. The things that make so popular this application is that offers a range of business application in one place. Some of the applications we can mention are Point of Sale (POS), Inventory, CRM, VoIP, Website, Live Chat, e-Commerce, manufacturing, billing, accounting, warehouse, project management, inventory, Forum, Android & iPhone Apps, eCommerce, and much more, all seamlessly integrated. Odoo comes up with a new version 12 this October. In this article, we will show you how to install Odoo 12 on CentOS 7.

Install Odoo 12 on CentOS 7Odoo is known as resource intensive application, so our recommendation is to start with our SSD 2 VPS hosting plan or higher.

1. Log in as root to your server via SSH

ssh root@your_server_ip

If you want to check the version of CentOS installed on your machine you can run the following command:

cat /etc/redhat-release

the output we receive is:

CentOS Linux release 7.5.1804 (Core)

2. Update the system

By running the command below, you can update your server:

yum update

Once this is done, enable the EPEL repository by typing:

yum install epel-release

3. Install Python 3.5 packages and Odoo dependencies

With the next command, you can enable the Software Collections (SCL) repository so you can install Python 3.5 packages.

yum install centos-release-scl

Execute the following command to install Python 3.5:

yum install rh-python35

With the next command, you should install all the tools and dependencies that you need to build the latest Odoo 12.

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

4. Create Odoo user

Create a new system user and group that you need to run the Odoo service. In this case, we will define /opt/odoo as a home directory.

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

Feel free to name the user whatever you like, just don’t forget to create a PostgreSQL user with the same name.

5. Install and configure PostgreSQL

You can first list the available packages:

yum list postgresql*

We will use PostgreSQL version 9.6 in this tutorial. If you do not have this version of the list, you can manually add from the Postgres Yum repository using the command below:

yum install https://download.postgresql.org/pub/repos/yum/9.6/redhat/rhel-7-x86_64/pgdg-redhat96-9.6-3.noarch.rpm -y

Install PostgreSQL 9.6 by executing:

yum install postgresql96 postgresql96-server postgresql96-contrib postgresql96-libs -y

Initialize your database:

usr/pgsql-9.6/bin/postgresql96-setup initdb

Start the PostgreSQL:

systemctl start postgresql-9.6.service

Optional: You can configure PostgreSQL to start on boot by enabling it:

systemctl enable postgresql-9.6.service

Next, you need to create a PostgreSQL user who uses the same name as the user you are creating already for Odoo.

su - postgres -c "createuser -s odoo"

6. Install Wkhtmltopdf

The wkhtmltopdf package is an open source tool that Odoo uses to make HTML in PDF formats so that it can print PDF reports. We will install version 0.12.5 which is not available in the official CentOS 7 repositories. In order to download and install this version you need to run the following commands:

cd /opt/

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

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

7. Install and configure Odoo 12

We are going to install Odoo 12 from GitHub repository and use virtualenv so can create an isolated Python environment. The first step you need to do is switch to the odoo user:

su - odoo

Clone the Odoo from the GitHub repository:

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

In the next step we should enable the software collections in order to access the python 3.5 binaries:

scl enable rh-python35 bash

Then create a new virtual environment with the commands below:

cd /opt/odoo
python3 -m venv odoo12-venv

activate the virtual environment:

source odoo12-venv/bin/activate

Upgrade pip with the command and install the Wheel library:

pip install --upgrade pip

pip3 install wheel

Run the following command to install all the required Python modules:

pip3 install -r odoo12/requirements.txt

When the installation is complete, you can deactivate the virtual environment and return to the root user with the commands:

deactivate && exit
exit

If you consider that you will use custom modules for your Odoo instance you should install them in a separate directory. Create a new directory and change the owner to odoo with the following commands:

mkdir /opt/odoo/odoo12-custom-addons

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

Next step is to create a configuration file for the Odoo.

nano /etc/odoo.conf

paste the following lines in the configuration file:

[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
addons_path = /opt/odoo/odoo12/addons
; You can enable log file with uncommenting the next line
; logfile = /var/log/odoo12/odoo.log
; If you are using custom modules
; addons_path = /opt/odoo/odoo12/addons,/opt/odoo/odoo12-custom-addons

Please do not forget to change the master_password with a new strong password. You can generate one through the command line. Save and close the file.

8. Create a systemd unit file

In the next step, we will create a service unit file so we can run Odoo as a service.

Open your text editor :

nano /etc/systemd/system/odoo12.service

and paste the configuration below:

[Unit]
Description=Odoo12
Requires=postgresql-9.6.service
After=network.target postgresql-9.6.service

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

[Install]
WantedBy=multi-user.target

You need to reload the daemon so he can take the new unit that we created in systemd.

systemctl daemon-reload

Finally, we can start the Odoo instances with the command:

systemctl start odoo12

To check the status for the Odoo service you can execute the following command:

systemctl status odoo12
● odoo12.service - Odoo12
Loaded: loaded (/etc/systemd/system/odoo12.service; disabled; vendor preset: disabled)
Active: active (running) since Thu 2018-10-18 07:28:28 CDT; 6s ago
Main PID: 24592 (scl)
CGroup: /system.slice/odoo12.service
├─24592 /usr/bin/scl enable rh-python35 -- /opt/odoo/odoo12-venv/bin/python3 /opt/odoo/odoo12/odoo-bin -c /etc/odoo.conf
├─24593 /bin/bash /var/tmp/scly7P6bo
└─24596 /opt/odoo/odoo12-venv/bin/python3 /opt/odoo/odoo12/odoo-bin -c /etc/odoo.conf

If there are no errors you can enable the Odoo service to start on boot with the command:

systemctl enable odoo12

For more information about the messages logged by the Odoo service you can check:

journalctl -u odoo12

9. Test the installation

Now when you have Odoo running on your server it is time to open your favorite browser and navigate to http://<your_server_IP_address>:8069

If that the installation has been successfully completed, you should be able to see the Odoo screen so you can create your first database.

Install Odoo 12 CentOS 7

Conclusion

Congratulations, if you follow carefully our instructions in this tutorial, you have installed the latest Odoo 12 on your CentOS 7 VPS. You can create your first database and start using the lastest Odoo 12. Use this tutorial if you are installing Odoo 12 on Ubuntu 16.04, and this tutorial if you are installing Odoo 12 on Debian 9.


Install Odoo 12 on CentOSOf course, you don’t have to install Odoo 12 on CentOS 7, if you use one of our Odoo VPS Hosting services, in which case you can simply ask our expert Linux admins to install and configure Odoo 12 for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post on how to install Odoo 12 on CentOS 7, please share it with your friends on the social networks using the buttons below or simply leave a reply. Thanks.