Odoo 8 on Debian 7

Step by step "How to"

MATMOZ d.o.o., Matjaž Mozetič

Odoo 8 on Debian 7

Step by step "How to"

Basic setup

apt-get install bash-completion nano mc zip unzip arj git mercurial bzr locate

update-alternatives --config editor

SSH key setup

ssh-keygen -t rsa -C "sysadmin@email"
eval "$(ssh-agent -s)"
ssh-add ~/.ssh/id_rsa

and add id_rsa.pub contents to github account.

ODOO setup

Odoo user (and owner)

adduser --system --quiet --shell=/bin/bash --home=/opt/openerp --gecos 'OpenERP' --group openerp

Postgresql install and postgresql user setup

apt-get install postgresql
su - postgres -c "createuser -s openerp" 2> /dev/null || true

Odoo dependencies

apt-get install python-imaging python-passlib python-dateutil python-feedparser python-gdata python-ldap python-libxslt1 python-lxml python-mako python-openid python-psycopg2 python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi python-docutils python-psutil wget python-unittest2 python-mock python-jinja2 python-dev libpq-dev poppler-utils python-pdftools antiword ca-certificates python-six binutils cpp cpp-4.7 gcc-4.7 libgmp10 libgomp1 libitm1 libmpc2 libmpfr4 libquadmath0 python-crypto python-egenix-mxtools python-httplib2 python-keyring python-launchpadlib python-lazr.restfulclient python-lazr.uri python-oauth python-wadllib python-xdg python-zope.interface python-beautifulsoup python-decorator python-requests python-pypdf python-bs4 python-unidecode

Odoo from GitHub

su - openerp
git clone -b 8.0 git@github.com:OCA/OCB.git

Config and Log

mkdir /opt/openerp/config_odoo
mkdir /opt/openerp/odoo/custom
touch /opt/openerp/config_odoo/odoo-server.log
nano /opt/openerp/config_odoo/odoo-server.conf

with contents something like:

## Server startup config - Common options
# Admin password for creating, restoring and backing up databases
admin_passwd = lapasswordsuperadmin
# specify additional addons paths (separated by commas)
addons_path = /opt/openerp/odoo/addons,/opt/openerp/odoo/custom
## XML-RPC / HTTP - XML-RPC Configuration
# disable the XML-RPC protocol
xmlrpc = True
# Specify the TCP IP address for the XML-RPC protocol. The empty string binds to all interfaces.
xmlrpc_interface =
# specify the TCP port for the XML-RPC protocol
xmlrpc_port = 8069
# Enable correct behavior when behind a reverse proxy
proxy_mode = True
## XML-RPC / HTTPS - XML-RPC Secure Configuration
# disable the XML-RPC Secure protocol
xmlrpcs = True
# Specify the TCP IP address for the XML-RPC Secure protocol. The empty string binds to all interfaces.
xmlrpcs_interface = 
# specify the TCP port for the XML-RPC Secure protocol
xmlrpcs_port = 8071
# specify the certificate file for the SSL connection
secure_cert_file = server.cert
# specify the private key file for the SSL connection
secure_pkey_file = server.pkey
## NET-RPC - NET-RPC Configuration
# enable the NETRPC protocol
netrpc = False
# specify the TCP IP address for the NETRPC protocol
netrpc_interface =
# specify the TCP port for the NETRPC protocol
netrpc_port = 8070
## WEB - Web interface Configuration
# Filter listed database REGEXP
dbfilter = .*
## Static HTTP - Static HTTP service
# enable static HTTP service for serving plain HTML files
static_http_enable = False 
# specify the directory containing your static HTML files (e.g '/var/www/')
static_http_document_root = None
# specify the URL root prefix where you want web browsers to access your static HTML files (e.g '/')
static_http_url_prefix = None
## Testing Group - Testing Configuration
# Launch a YML test file.
test_file = False
# If set, will save sample of all reports in this directory.
test_report_directory = False
# Enable YAML and unit tests.
test_disable = False
# Commit database changes performed by YAML or XML tests.
test_commit = False
## Logging Group - Logging Configuration
# file where the server log will be stored (default = None)
logfile = /var/log/openerp/openerp-server.log
# do not rotate the logfile
logrotate = True
# Send the log to the syslog server
syslog = False
# setup a handler at LEVEL for a given PREFIX. An empty PREFIX indicates the root logger. This option can be repeated. Example: "openerp.orm:DEBUG" or "werkzeug:CRITICAL" (default: ":INFO")
log_handler = ["[':INFO']"]
# specify the level of the logging. Accepted values: info, debug_rpc, warn, test, critical, debug_sql, error, debug, debug_rpc_answer, notset
#log_level = debug
log_level = info

Init file:

nano /etc/init.d/odoo

with content:

# Provides:             openerp-server
# Required-Start:       $remote_fs $syslog
# Required-Stop:        $remote_fs $syslog
# Should-Start:         $network
# Should-Stop:          $network
# Default-Start:        2 3 4 5
# Default-Stop:         0 1 6
# Short-Description:    Enterprise Resource Management software
# Description:          Open ERP is a complete ERP and CRM software.

test -x ${DAEMON} || exit 0

set -e

case "${1}" in
				echo -n "Starting ${DESC}: "

				start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \
						--chuid ${USER} --background --make-pidfile \
						--exec ${DAEMON} -- --config=${CONFIG} \
							--logfile=${LOGFILE} --db-filter=^%d$

				echo "${NAME}."

				echo -n "Stopping ${DESC}: "

				start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid \

				echo "${NAME}."

				echo -n "Restarting ${DESC}: "

				start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid \

				sleep 1

				start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \
						--chuid ${USER} --background --make-pidfile \
						--exec ${DAEMON} -- --config=${CONFIG} \

				echo "${NAME}."



				echo "${NAME}."

				echo -n "Stopping ${DESC}: "

				start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid \

				echo "${NAME}."

				echo -n "Restarting ${DESC}: "

				start-stop-daemon --stop --quiet --pidfile /var/run/${NAME}.pid \

				sleep 1

				start-stop-daemon --start --quiet --pidfile /var/run/${NAME}.pid \
						--chuid ${USER} --background --make-pidfile \
						--exec ${DAEMON} -- --config=${CONFIG} \

				echo "${NAME}."

				echo "Usage: ${NAME} {start|stop|restart|force-reload}" >&2
				exit 1

exit 0

and make it executable and enabled:

chmod +x /etc/init.d/odoo
service odoo start
update-rc.d odoo defaults


chown -R openerp:openerp /opt/openerp

NGINX reverse proxy

apt-get install nginx
mkdir /etc/nginx/openerpssl
cd /etc/nginx/openerpssl

Certificate generation

openssl genrsa -des3 -out openerp.pkey 1024
openssl rsa -in openerp.pkey -out openerp.key
openssl req -new -key openerp.key -out openerp.csr
openssl x509 -req -days 365 -in openerp.csr -signkey openerp.key -out openerp.crt
chown root:www-data openerp.crt openerp.key
chmod 640 openerp.crt openerp.key
mkdir /etc/ssl/openerpssl
chown www-data:root /etc/ssl/openerpssl
chmod 710 /etc/ssl/openerpssl
mv openerp.crt openerp.key /etc/ssl/openerpssl/

Nginx config

nano /etc/nginx/sites-available/openerp-net

with contents:

upstream openerpweb {
	server weight=1 fail_timeout=300s;

server {
	listen 80;
	server_name ilvostro.dominio.com;

	# Strict Transport Security
	add_header Strict-Transport-Security max-age=2592000;

	rewrite ^/.*$ https://$host$request_uri? permanent;

server {
	# server port and name
	listen        443 default;
	server_name   ilvostro.dominio.com;
	# if ($allowed_country = no) {
	#	return 444;
	# }

	# ssl log files
	access_log    /var/log/nginx/ssl-access.log;
	error_log    /var/log/nginx/ssl-error.log;

	# ssl certificate files
	ssl on;
	ssl_certificate /etc/ssl/openerpssl/openerp.crt;
	ssl_certificate_key /etc/ssl/openerpssl/openerp.key;

	# add ssl specific settings
	keepalive_timeout    60;

	# limit ciphers
	ssl_ciphers            HIGH:!ADH:!MD5;
	ssl_protocols            SSLv3 TLSv1;
	ssl_prefer_server_ciphers    on;

	# increase proxy buffer to handle some OpenERP Web client requests
	proxy_buffers 32 128k;
	proxy_buffer_size 256k;

	client_max_body_size 0;

	location / {
		proxy_pass    http://openerpweb;
		# force timeouts if one of backend dies
		proxy_next_upstream error timeout invalid_header http_500 http_502 http_503;

		# set headers
#        proxy_set_header Host $host;
		proxy_set_header Host $http_host;
		proxy_set_header X-Real-IP $remote_addr;

	proxy_set_header X-Forwarded-Host $http_host;

		proxy_set_header X-Forward-For $proxy_add_x_forwarded_for;

		# Let OpenERP Web client known that we're using HTTPS, otherwise
		# it will generate url using http:// and not https://
		proxy_set_header X-Forwarded-Proto https;

		# by default, do not forward anything
		proxy_redirect off;

	# cache some static data in memory for 60mins.
	# under heavy load this will preserve the OpenERP Web client a little bit.
	location ~* ^/(openerp|openobject)/static/ {
		proxy_cache_valid 200 60m;
		proxy_buffering    on;
		expires 864000;
		proxy_pass http://openerpweb;


link to the enabled sites:

ln -s /etc/nginx/sites-available/openerp-net /etc/nginx/sites-enabled/openerp-net


service nginx restart

Aeroo reports


LibreOffice Service

apt-get install libreoffice python-genshi python-cairo python-lxml python-setuptools libreoffice-script-provider-python python-uno python-openoffice python-cups
nano /etc/init.d/libreoffice

with contents:

# Provides:          scriptname 
# Required-Start:    $remote_fs $syslog 
# Required-Stop:     $remote_fs $syslog 
# Default-Start:     2 3 4 5 
# Default-Stop:      0 1 6 
# Short-Description: Start daemon at boot time 
# Description:       Enable service provided by daemon. 

set -e 

case "$1" in 
if [ -f $PIDFILE ]; then 
echo "LibreOffice headless server has already started." 
sleep 5 
echo "Starting LibreOffice headless server" 
$SOFFICE_PATH --headless --nologo --nofirststartwizard --accept="socket,host=,port=8100;urp" & > /dev/null 2>&1 
touch $PIDFILE 
if [ -f $PIDFILE ]; then 
echo "Stopping LibreOffice headless server." 
killall -9 soffice && killall -9 soffice.bin 
rm -f $PIDFILE 
echo "LibreOffice headless server is not running." 
echo "Usage: $0 {start|stop}" 
exit 1 
exit 0

Sort out permissions and configuration:

chmod 0755 /etc/init.d/libreoffice
update-rc.d libreoffice defaults
service libreoffice start

Aeroolib and Aeroo (alpha stage, not working yet)

cd /opt/openerp/odoo/custom
git clone git@github.com:aeroo/aeroolib.git

as root:

cd /opt/openerp/odoo/custom/aeroolib
python setup.py install

as user:

cd /opt/openerp/odoo/custom
git clone git@github.com:aeroo/aeroo_reports.git

and add the new addon path to the odoo-server.conf

Odoo external-dependencies (wkhtmltopdf 0.12.2 for reports)

mkdir /opt/openerp/externaldeps
cd /opt/openerp/externaldeps
wget http://sourceforge.net/projects/wkhtmltopdf/files/
dpkg -i wkhtmltox-

Then in /etc/init.d/openerp-server add /usr/local/bin to the front of path environment variable, e.g.
Then restart openerp and all is well.

Other possible dependecies

Some website related modules need less and nodejs, so:

wget -qO- https://deb.nodesource.com/setup | bash -
apt-get install -y nodejs
and after nodejs is installed:

npm install -g less less-plugin-clean-css

In later debian (>jessie) and ubuntu (>14.04) you may need to add a symlink as npm packages call node but debian calls the binary nodejs

$ apt-get install -y npm
$ ln -s /usr/bin/nodejs /usr/bin/node