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
psql
\password postgres
(Enter new password twice)
\q
exit
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.gztar -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:
[options]
; 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 127.0.0.1/32 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 0.0.0.0/0 md5
Check the PostgreSQL server encoding:
su - postgres
psql
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';
\q
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
[Unit]
Description=Advanced OpenSource ERP and CRM server
Requires=postgresql.service
After=postgresql.service
[Install]
Alias=odoo.service
[Service]
Type=simple
PermissionsStartOnly=true
EnvironmentFile=-/etc/conf.d/odoo-server
User=odoo
Group=odoo
SyslogIdentifier=odoo-server
PIDFile=/run/odoo/odoo-server.pid
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
[Install]
WantedBy=multi-user.target
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.