Installing Odoo 9 Community on CentOS 7

Published on: Sun, May 1, 2016 at 12:04 pm EST
CentOS Linux Guides Server Apps

Odoo, formerly known as OpenERP, is a well-known open source ERP business platform. Enterprises of any size can benefit from Odoo, thanks to its abundant list of business-oriented features, which include website building, billing and accounting, human resources, customer relationship management, and inventory management.

In this tutorial, I will guide you through the process of installing Odoo 9 Community version on a Vultr CentOS 7 server instance.

Prerequisites

Before you can take advantage of the instructions in this tutorial, you need to:

  • Deploy a Vultr CentOS 7 server instance from scratch.
  • Create a sudo user and use it to log in this CentOS 7 server instance from your SSH terminal. See how to create such a sudo user in this Vultr tutorial.

Step 1: Update your system

A qualified administrator will always update the system to the latest stable status:

sudo yum update
sudo reboot

Step 2: Install and configure PostgreSQL

You need to install PostgreSQL, the default database program of Odoo, to store data for Odoo.

Install the EPEL repository before you can install Odoo using YUM:

sudo yum install -y epel-release

As you see, the EPEL repository has been installed by default when you choose the Vultr CentOS 7 image. However, executing the command above will do no harm.

Install and configure PostgreSQL using the following commands:

sudo yum install -y postgresql-server
sudo postgresql-setup initdb
sudo systemctl start postgresql.service
sudo systemctl enable postgresql.service

For security purposes, set a password for the default PostgreSQL user "postgres".

sudo -u postgres psql

# when prompt reads: postgres=# 
\password postgres

Enter your password twice, then use the following command to quit the PostgreSQL shell.

\q

Step 3: Install Odoo 9 Community version

Add the Odoo YUM repository to the system:

sudo vi /etc/yum.repos.d/odoo.repo

Populate the file with the following content:

[odoo-nightly]
name=Odoo Nightly repository
baseurl=http://nightly.odoo.com/9.0/nightly/rpm/
enabled=1
gpgcheck=1
gpgkey=https://nightly.odoo.com/odoo.key

Save and quit:

:wq

Install Odoo using YUM:

sudo yum install odoo

Perform an additional security setup:

sudo sed -i "s/xmlrpc_interface =/xmlrpc_interface = 127.0.0.1/" /etc/odoo/openerp-server.conf

Start the Odoo service and set it to start automatically after system reboot:

sudo systemctl start odoo.service
sudo systemctl enable odoo.service

Modify the firewall rules to allow visitors to access Odoo using PostgreSQL's default communicating port 8069:

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

Step 4: Configure Odoo from your web browser

Visit the following address from a web browser. Be aware that the port number 8069 cannot be ignored.

http://[your-vultr-server-IP]:8069

In the web interface, input a database name and a password for the user "admin", then click the "Create database" button.

After you have finished successfully setting up a database, you will be brought into the Odoo kanban where you can customize your Odoo system as you wish. But for now, you should log out (using the link at the upper right corner) and setup a master password in order to protect the Odoo database manager.

On the Odoo login interface, click the link "Manage Databases", then click the link "set a master password". Input your master password in the pop-up window, then click the "Continue" button.

Now, log into your Odoo system again (click the database name) to customize it.

Step 5: Install Nginx to facilitate users' access

As a matter of convenience, you can redirect traffic on the default HTTP port (80) to the Odoo communicating port 8069, so that users will no longer need to input the port number 8069 every time they access the Odoo system.

Install Nginx using YUM:

sudo yum install nginx

Open the file "nginx.conf" with vi:

sudo vi /etc/nginx/nginx.conf

Comment out the following two lines:

location / {
}

They will become:

#location / {
#}

Then add the following segment right beneath the former two lines:

location / {
    proxy_pass http://127.0.0.1:8069;
    proxy_redirect off;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

Save and quit:

:wq

Start the Nginx service:

sudo systemctl restart nginx.service
sudo systemctl enable nginx.service

Now, you can visit the Odoo system from both port 8069 and port 80.

http://[your-vultr-server-IP]:8069
http://[your-vultr-server-IP]

That's all. Your Odoo system is ready for use.

Want to contribute ?

You could earn up to $300 by adding new articles