Install Odoo 8 on CentOS 7
In this article, we will go through the installation of Odoo 8 on CentOS 7 machine. We will create a Python virtual environment and use the Odoo source code from Github.
Install and configure PostgreSQL 9.3
First of all, we need to install PostgreSQL. We’ll install PostgreSQL version 9.3 from the official PostgreSQL repository.
rpm -Uvh http://yum.postgresql.org/9.3/redhat/rhel-7-x86_64/pgdg-centos93-9.3-1.noarch.rpm
yum -y install postgresql93 postgresql93-server postgresql93-devel --disablerepo=* --enablerepo=pgdg93
After installing the packages, we’ll initialize the database, enable the service on boot and start the PostgreSQL server.
/usr/pgsql-9.3/bin/postgresql93-setup initdb
systemctl enable postgresql-9.3.service
systemctl start postgresql-9.3
The following command will create a new PostgreSQL user named odoo
:
su - postgres -c "createuser -s odoo" 2> /dev/null || true
Install all nessesary packages
We need the development tools installed:
yum -y groupinstall "Development tools"
Next, we’ll install a few dependencies:
yum -y install zlib-devel bzip2-devel openssl openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel libpcap-devel xz-devel git libpng libjpeg libXext curl xorg-x11-font-utils fontconfig python-virtualenv libevent-devel libxml2-devel libxslt-devel openldap-devel openjpeg-devel freetype-devel libjpeg-turbo-devel libtiff-devel kernel-devel
Enable EPEL Repository:
wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
rpm -ivh epel-release-7-5.noarch.rpm
To be able to print documents in Odoo we’ll need the wkhtmltopdf
package, which is available in the EPEL repository.
To install wkhtmltopdf
run the following command:
yum --enablerepo=epel install wkhtmltopdf
We’ll install Python packages with pip
, so let’s install pip
from the EPEL repository:
yum --enablerepo=epel install python-pip
Clone Odoo 8 from GitHub
We are going to clone the Odoo 8 repository from GitHub to the /opt/odoo
directory.
git clone --branch 8.0 https://www.github.com/odoo/odoo /opt/odoo
Later, if you want to update your Odoo repository to the latest version just rungit pull
.
Create a virtual environment for Odoo
Create a new system user named odoo
, change the owner ship of the /opt/odoo
directory to odoo
user and group and switch to it, using the following commands:
useradd odoo
chown -R odoo: /opt/odoo
su - odoo
Now we’ll create a virtual environment and install all necessary packages from therequirements.txt
file:
/bin/virtualenv odoo
source odoo/bin/activate
PATH=$PATH:/usr/pgsql-9.3/bin
pip install -r /opt/odoo/requirements.txt
exit
The installation will take a few minutes so go grab a coffee.
Create configuration file and systemctl
service
Next, we’ll create a basic configuration file and systemctl
service for our Odoo instance.
cat > /etc/odoo-server.conf << EOF
[options]
admin_passwd = admin
db_host = False
db_port = False
db_user = odoo
db_password = False
addons_path = /opt/odoo/addons
without-demo=all
no-xmlrpc = True
no-xmlrpcs = True
no-netrpc = True
log_db = False
log_handler = ['['["[\':INFO\']"]']']
log_level = info
logfile = False
login_message = False
logrotate = True
syslog = False
EOF
cat > /usr/lib/systemd/system/odoo.service << EOF
[Unit]
Description=Odoo 8.0 ERP and CRM server
After=postgresql-9.3.service
[Service]
Type=simple
User=odoo
Group=odoo
ExecStart=/home/odoo/odoo/bin/python /opt/odoo/openerp-server --config=/etc/odoo-server.conf
[Install]
WantedBy=multi-user.target
EOF
You can use the following command to view Odoo log: journalctl -f -u odoo
.
Final steps
We also need to open port 8069 in our firewall:
firewall-cmd --zone=public --add-port=8069/tcp --permanent
firewall-cmd --reload
Finally, we’ll enable Odoo on boot and start the service:
systemctl enable odoo.service
systemctl start odoo
That’s it, Odoo installation is complete. To open Odoo, point your browser at:http://<ip_address>:8069
Ave que vuela, a la cazuela.