Install Odoo 8 on a CentOS 7 VPS

Odoo is a suite of business applications, organized in 6 groups: front-end applications, sales management applications, business operations applications, marketing applications, human resources and productivity applications.
The installation of Odoo 8 on a CentOS 7 VPS should take about ten minutes if you follow the very easy steps described below.

Remove MariaDB from your server:

yum remove mariadb mariadb-server

Ensure that your yum package repository is up to date and all installed packages have been upgraded with the latest bug fixes and security patches using the following commands:

yum clean all
yum update

Install PostgreSQL and PHP PostgreSQL extension:

yum install postgresql-libs postgresql-server postgresql php-pgsql php-gd

Install all prerequisite packages using the following command:

yum install babel python-devel libxslt-python pyparsing python-dateutil python-decorator python-imaging python-jinja2 python-ldap python-lxml python-mako python-psycopg2 python-reportlab python-requests python-werkzeug python-yaml python-docutils  python-matplotlib python-unittest2.noarch python-babel python-gevent pygtk2 glade3 pytz libxslt-devel bzr automake gcc gcc-c++ byacc kernel-headers

Restart the Apache web server:

systemctl restart httpd.service

Initialize the PostgreSQL database cluster:

postgresql-setup initdb

Configure the PostgreSQL service to start automatically on server boot:

systemctl enable postgresql.service

Start PostgreSQL service and set a password for the ‘postgres’ user:

systemctl start postgresql.service
su - postgres
\password postgres
(Enter new password twice)

Create new system user named ‘odoo’:

adduser odoo
passwd odoo

Create ‘odoo’ user in PostgreSQL using the following command:

su - postgres -c "createuser --pwprompt --createdb --no-createrole --no-superuser odoo"
(Enter new 'odoo' user password twice)

Download the latest version of Odoo and extract it to the ‘/opt’ directory on your virtual server:

cd /opt 
wget http://nightly.odoo.com/8.0/nightly/src/odoo_8.0.latest.tar.gz
tar -xvzf /root/odoo_8.0.latest.tar.gz
mv odoo-8.* odoo
cd odoo

Install Odoo 8:

python setup.py install
cp openerp-server /usr/local/bin/odoo-server
mkdir -p /var/log/odoo/
touch /var/log/odoo/odoo-server.log
chown odoo /var/log/odoo/odoo-server.log
chmod 644 /var/log/odoo/odoo-server.log

Give the ‘odoo’ user permission to install new modules:

chown odoo -R /usr/lib/python2.7/site-packages/odoo-8*/openerp/addons/

Run the following commands:

vi ~odoo/.bashrc
export LD_LIBRARY_PATH; LD_LIBRARY_PATH=/usr/local/lib
source ~odoo/.bashrc

Edit the ‘/etc/odoo-server.conf’ configuration file and add the following lines:

; This is the password that allows database operations:
; admin_passwd = admin
db_host = localhost
db_port = 5432
db_user = odoo
db_password = False
addons_path = /usr/lib/python2.7/site-packages/odoo-8.0_20150306-py2.7.egg/openerp/addons/
#do not forget to change 'odoo-8.0_20150306-py2.7.egg' with the actual directory on your server
logfile = /var/log/odoo/odoo-server.log
log_level = error

Edit the ‘/var/lib/pgsql/data/pg_hba.conf’ configuration file and allow local access to PostgreSQL databases:

vi /var/lib/pgsql/data/pg_hba.conf
# TYPE  DATABASE        USER            ADDRESS                 METHOD

# "local" is for Unix domain socket connections only
local   all             all                                     trust # changed from 'peer'
# IPv4 local connections:
host    all             all               trust # changed from 'ident'
# IPv6 local connections:
host    all             all             ::1/128                 trust # changed from 'ident'

Optionally, if you want to allow remote access to PostgreSQL databases, add the following line to ‘/var/lib/pgsql/data/pg_hba.conf’ configuration file:

host    all             all                  md5

Check the PostgreSQL server encoding:

su - postgres
postgres=# \l
                             List of databases
   Name    |  Owner   | Encoding  | Collate | Ctype |   Access privileges
 postgres  | postgres | SQL_ASCII | C       | C     |
 template0 | postgres | SQL_ASCII | C       | C     | =c/postgres          +
           |          |           |         |       | postgres=CTc/postgres
 template1 | postgres | SQL_ASCII | C       | C     | =c/postgres          +
           |          |           |         |       | postgres=CTc/postgres

To change the template1 encoding to UTF8, run the following commands:

update pg_database set datallowconn = TRUE where datname = 'template0';
\c template0
update pg_database set datistemplate = FALSE where datname = 'template1';
drop database template1;
create database template1 with template = template0 encoding = 'UTF8';
update pg_database set datistemplate = TRUE where datname = 'template1';
\c template1
update pg_database set datallowconn = FALSE where datname = 'template0';

Restart the PostgreSQL server:

systemctl restart postgresql.service

To start Odoo automatically when the server is booted, add a systemd unit file with the following content:

vi /usr/lib/systemd/system/odoo.service
Description=Advanced OpenSource ERP and CRM server
ExecStartPre=/usr/bin/install -d -m755 -o odoo -g odoo /run/odoo
ExecStart=/usr/local/bin/odoo-server -c /etc/odoo-server.conf --pid=/run/odoo/odoo-server.pid --syslog $OPENERP_ARGS
ExecStop=/bin/kill $MAINPID

The last thing left to do is enabling and starting up the service:

systemctl enable odoo.service

Start Odoo:

systemctl start odoo.service

Open http://your-server-IP:8069/web/database/manager and create a new database.

Then, you should be able to log in to the administrator back-end at http://server_IP:8069 using ‘admin’ as username and your newly created password. To reset your ‘admin’ password, navigate to:

Administrator -> Preferences -> Change password

That is it. Odoo 8 has been successfully installed on your CentOS 7 VPS.

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

PS. If you liked this post please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

Categories: Tutorials

View Comments

Leave a Comment