News & Publications
Insights and thought leadership in Open ERP

Automated Install of Odoo 8.0

#!/bin/bash

——————————————————————————

# Script for Installation: ODOO Saas4/Trunk server on Ubuntu 14.04 LTS

# Author: Andre Schenkels, ICTSTUDIO 2014

# Modified: Ron McBean, Ursa Information Systems 2014

——————————————————————————

# This script will install ODOO Server on a clean Ubuntu 14.04 Server

——————————————————————————

# USAGE:

# sudo odoo-install

# EXAMPLE:

# sudo ./odoo-install

——————————————————————————-

User Configurable Parameters

OpenERP parameters

# Specify the Odoo user name (Default = “odoo”).

OE_USER=”odoo8″

# Specify the Odoo user password (Default = “odoo”).

OE_USERPWD=”odoo8″

# Specify the Odoo user’s group (Default = “odoo”).

OE_GROUP=”odoo”

# Specify the parent directory for all users (Default = “/home”).

USER_PARENT=”/home”

# Specify the parent directory for all Odoo installations (Default = “/opt”).

OE_PARENT=”opt”

# Specify the parent directory for all Odoo log files (Default = “/var/log”).

OE_LOG=”/var/log”

# Specify Odoo log reporting level to info (Default = “info”).

LOG_LEVEL=”info”

# Specify the version for checkout “8.0″ for version 8.0, “7.0 (version 7),

Options for later versions

** These options are for later versions of this script: saas-4, saas-5 (opendays version) and “master” for trunk **

OE_VERSION=”8.0″

# Specify superadmin password (Default = “admin”).

OE_SUPERADMIN=”admin”

PostgreSQL parameters

# Specify the url pointing to the location of the database (Default = “localhost”).

DB_HOST=”localhost”

# Specify the port used by the database (Default =”5432″).

DB_PORT=”5432″

# Specify the database user name assigned to Odoo user (Default = $OE_USER).

DB_USER=”$OE_USER”

# Specify the database password assigned to the Odoo user named above (Default = $OE_USERPWD).

DB_PWD=”$OE_USERPWD”

In most cases, no edits should be made below this point

OE_HOME=”/$OE_PARENT/$OE_USER”

OE_CONFIG=”$OE_USER-server”

OE_LOG_EXT=”$OE_LOG/$OE_USER/$OE_CONFIG.log”

USER_HOME=”$USER_PARENT/$OE_USER”

case “$OE_VERSION” in

8.0)

OE_SUB=”debian”

;;

7.0)

OE_SUB=”install”

;;

*)

echo -e “\nUnknown or invalid version selection, script execution halted!!”

exit 1

esac

echo -e “\nThe version selection is $OE_VERSION, the $OE_CONFIG config file is located in the $OE_SUB directory.”

Update Server

echo -e “\n—- Update Server —-”

apt-get update

apt-get dist-upgrade -y

apt-get install python-software-properties -y

Install PostgreSQL Server

echo -e “\n—- Install PostgreSQL Server —-”

apt-get install postgresql-9.3 -y

echo -e “\n—- PostgreSQL $PG_VERSION Settings —-”

sed -i s/”#listen_addresses = ‘localhost’”/”listen_addresses = ‘*’”/g /etc/postgresql/9.3/main/postgresql.conf

echo -e “\n—- Creating the ODOO PostgreSQL User —-”

PG_CMD=”psql –command=\”CREATE ROLE $DB_USER CREATEDB LOGIN ENCRYPTED PASSWORD ‘$DB_PWD’;\””

su – postgres -c “$PG_CMD” 2> /dev/null || true

Create Odoo system group and user

echo -e “\n—- Create ODOO system group and user —-”

addgroup –system –quiet $OE_GROUP

adduser –system –quiet –shell=/bin/bash –home=$USER_HOME –gecos ‘ODOO’ –ingroup $OE_GROUP $OE_USER

Install Dependencies

echo -e “\n—- Install tool packages —-”

apt-get install wget git -y

echo -e “\n—- Install python packages —-”

apt-get install python-dateutil python-docutils python-feedparser python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid python-psycopg2 python-psutil python-pybabel python-pychart python-pydot python-pyparsing python-reportlab python-simplejson python-tz python-unittest2 python-vatnumber python-vobject python-webdav python-werkzeug python-xlwt python-yaml python-zsi poppler-utils python-pip python-docutils python-psutil python-mock python-unittest2 python-jinja2 python-pypdf python-decorator python-requests python-passlib -y

echo -e “\n—- Install font-config packages if not already installed —-”

apt-get install fontconfig

echo -e “\n—- Install wkhtmltopdf —-”

cd $USER_HOME

wget http://downloads.sourceforge.net/project/wkhtmltopdf/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb

# the following requires fontconfig and other related packages to be installed or else errors will result

dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb #modified version

echo -e “\n—- Install GData python libraries —-”

wget http://gdata-python-client.googlecode.com/files/gdata-2.0.17.tar.gz

tar zxvf gdata-2.0.17.tar.gz

chown -R $OE_USER:odoo gdata-2.0.17

cd gdata-2.0.17/

python setup.py install

cd ..

echo -e “\n—- Install and configure GIT —-”

apt-get install git

echo -e “\n—- Create Log directory —-”

mkdir “$OE_LOG/$OE_USER”

chown -R $OE_USER:root “$OE_LOG/$OE_USER”

Install ODOO

echo -e “\n==== Installing ODOO Server ====”

cd $USER_HOME

git clone –branch $OE_VERSION –single-branch “https://www.github.com/odoo/odoo”

chown -R $OE_USER:odoo *

echo -e “\n==== Copy ODOO Server to final location ====”

mkdir $OE_HOME

chown -R $OE_USER:odoo $OE_HOME

cp -R ./odoo/. $OE_HOME

echo -e “\n—- Create custom module directory —-”

mkdir “$OE_HOME/custom-addons”

echo -e “\n—- Setting permissions on final location folder —-”

chown -R $OE_USER:odoo $OE_HOME/*

echo -e “\n—- Create server config file in etc folder —-”

mkdir “/etc/$OE_USER”

cp $OE_HOME/$OE_SUB/openerp-server.conf /etc/$OE_USER/$OE_CONFIG.conf

chown $OE_USER:odoo /etc/$OE_USER/$OE_CONFIG.conf

chmod 640 /etc/$OE_USER/$OE_CONFIG.conf

echo -e “\n—- Change server config file —-”

if [ “$OE_VERSION” = “7.0” ]

then

su root -c “echo ‘addons_path = addon_path_7u0_values’ >> /etc/$OE_USER/$OE_CONFIG.conf”

fi

sed -i s/”; admin_passwd.*”/”admin_passwd = $OE_SUPERADMIN”/g /etc/$OE_USER/$OE_CONFIG.conf

sed -i s/”db_host = .*”/”db_host = $DB_HOST”/g /etc/$OE_USER/$OE_CONFIG.conf

sed -i s/”db_port = .*”/”db_port = $DB_PORT”/g /etc/$OE_USER/$OE_CONFIG.conf

sed -i s/”db_user = .*”/”db_user = $DB_USER”/g /etc/$OE_USER/$OE_CONFIG.conf

sed -i s/”db_password = .*”/”db_password = $DB_PWD”/g /etc/$OE_USER/$OE_CONFIG.conf

sed -i s/”addons_path = .*”/”addons_path = \/$OE_PARENT\/$OE_USER\/addons,\/$OE_PARENT\/$OE_USER\/custom-addons”/g /etc/$OE_USER/$OE_CONFIG.conf

su root -c “echo ‘log_level = $LOG_LEVEL’ >> /etc/$OE_USER/$OE_CONFIG.conf”

su root -c “echo ‘logfile = /var/log/$OE_USER/$OE_CONFIG.log’ >> /etc/$OE_USER/$OE_CONFIG.conf”

echo -e “\n—- Create startup file —-”

su root -c “echo ‘#!/bin/sh’ >> $OE_HOME/start.sh”

su root -c “echo ‘sudo -u $OE_USER $OE_HOME/openerp-server –config=/etc/$OE_USER/$OE_CONFIG.conf’ >> $OE_HOME/start.sh”

chmod 755 $OE_HOME/start.sh

Adding ODOO as a daemon (initscript)

echo -e “\n—- Create init file —-”

echo ‘#!/bin/sh’ >> ~/$OE_CONFIG

echo ‘### BEGIN INIT INFO’ >> ~/$OE_CONFIG

echo ‘# Provides: $OE_CONFIG’ >> ~/$OE_CONFIG

echo ‘# Required-Start: $remote_fs $syslog’ >> ~/$OE_CONFIG

echo ‘# Required-Stop: $remote_fs $syslog’ >> ~/$OE_CONFIG

echo ‘# Should-Start: $network’ >> ~/$OE_CONFIG

echo ‘# Should-Stop: $network’ >> ~/$OE_CONFIG

echo ‘# Default-Start: 2 3 4 5′ >> ~/$OE_CONFIG

echo ‘# Default-Stop: 0 1 6′ >> ~/$OE_CONFIG

echo ‘# Short-Description: Enterprise Business Applications’ >> ~/$OE_CONFIG

echo ‘# Description: ODOO Business Applications’ >> ~/$OE_CONFIG

echo ‘### END INIT INFO’ >> ~/$OE_CONFIG

echo ‘PATH=/usr/local/bin:/bin:/sbin:/usr/bin’ >> ~/$OE_CONFIG

echo “DAEMON=$OE_HOME/openerp-server” >> ~/$OE_CONFIG

echo “NAME=$OE_CONFIG” >> ~/$OE_CONFIG

echo “DESC=$OE_CONFIG” >> ~/$OE_CONFIG

echo ” >> ~/$OE_CONFIG

echo ‘# Specify the user name (Default: odoo).’ >> ~/$OE_CONFIG

echo “USER=$OE_USER” >> ~/$OE_CONFIG

echo ” >> ~/$OE_CONFIG

echo ‘# Specify an alternate config file (Default: /etc/openerp-server.conf).’ >> ~/$OE_CONFIG

echo “CONFIGFILE=\”/etc/$OE_USER/$OE_CONFIG.conf\”” >> ~/$OE_CONFIG

echo ” >> ~/$OE_CONFIG

echo ‘# pidfile’ >> ~/$OE_CONFIG

echo ‘PIDFILE=/var/run/$NAME.pid’ >> ~/$OE_CONFIG

echo ” >> ~/$OE_CONFIG

echo ‘# Additional options that are passed to the Daemon.’ >> ~/$OE_CONFIG

echo ‘DAEMON_OPTS=”-c $CONFIGFILE”‘ >> ~/$OE_CONFIG

echo ‘[ -x $DAEMON ] || exit 0′ >> ~/$OE_CONFIG

echo ‘[ -f $CONFIGFILE ] || exit 0′ >> ~/$OE_CONFIG

echo ‘checkpid() {‘ >> ~/$OE_CONFIG

echo ‘[ -f $PIDFILE ] || return 1′ >> ~/$OE_CONFIG

echo ‘pid=`cat $PIDFILE`’ >> ~/$OE_CONFIG

echo ‘[ -d /proc/$pid ] && return 0′ >> ~/$OE_CONFIG

echo ‘return 1′ >> ~/$OE_CONFIG

echo ‘}’ >> ~/$OE_CONFIG

echo ” >> ~/$OE_CONFIG

echo ‘case “${1}” in’ >> ~/$OE_CONFIG

echo ‘start)’ >> ~/$OE_CONFIG

echo ‘echo -n “Starting ${DESC}: “‘ >> ~/$OE_CONFIG

echo ‘start-stop-daemon –start –quiet –pidfile ${PIDFILE} \’ >> ~/$OE_CONFIG

echo ‘–chuid ${USER} –background –make-pidfile \’ >> ~/$OE_CONFIG

echo ‘–exec ${DAEMON} — ${DAEMON_OPTS}’ >> ~/$OE_CONFIG

echo ‘echo “${NAME}.”‘ >> ~/$OE_CONFIG

echo ‘;;’ >> ~/$OE_CONFIG

echo ” >> ~/$OE_CONFIG

echo ‘stop)’ >> ~/$OE_CONFIG

echo ‘echo -n “Stopping ${DESC}: “‘ >> ~/$OE_CONFIG

echo ‘start-stop-daemon –stop –quiet –pidfile ${PIDFILE} \’ >> ~/$OE_CONFIG

echo ‘–oknodo’ >> ~/$OE_CONFIG

echo ‘echo “${NAME}.”‘ >> ~/$OE_CONFIG

echo ‘;;’ >> ~/$OE_CONFIG

echo ” >> ~/$OE_CONFIG

echo ‘restart|force-reload)’ >> ~/$OE_CONFIG

echo ‘echo -n “Restarting ${DESC}: “‘ >> ~/$OE_CONFIG

echo ‘start-stop-daemon –stop –quiet –pidfile ${PIDFILE} \’ >> ~/$OE_CONFIG

echo ‘–oknodo’ >> ~/$OE_CONFIG

echo ‘sleep 1′ >> ~/$OE_CONFIG

echo ‘start-stop-daemon –start –quiet –pidfile ${PIDFILE} \’ >> ~/$OE_CONFIG

echo ‘–chuid ${USER} –background –make-pidfile \’ >> ~/$OE_CONFIG

echo ‘–exec ${DAEMON} — ${DAEMON_OPTS}’ >> ~/$OE_CONFIG

echo ‘echo “${NAME}.”‘ >> ~/$OE_CONFIG

echo ‘;;’ >> ~/$OE_CONFIG

echo ” >> ~/$OE_CONFIG

echo ‘*)’ >> ~/$OE_CONFIG

echo ‘N=/etc/init.d/$OE_USER/${NAME}’ >> ~/$OE_CONFIG

echo ‘echo “Usage: ${NAME} {start|stop|restart|force-reload}” >&2′ >> ~/$OE_CONFIG

echo ‘exit 1′ >> ~/$OE_CONFIG

echo ‘;;’ >> ~/$OE_CONFIG

echo ” >> ~/$OE_CONFIG

echo ‘esac’ >> ~/$OE_CONFIG

echo ‘exit 0′ >> ~/$OE_CONFIG

echo -e “\n— Create security init file and move to init.d folder —-”

mv ~/$OE_CONFIG /etc/init.d/$OE_CONFIG

chmod 755 /etc/init.d/$OE_CONFIG

chown root: /etc/init.d/$OE_CONFIG

echo -e “\n—- Start ODOO on Startup —-”

update-rc.d $OE_CONFIG defaults

echo “Done! The ODOO server can be started with /etc/init.d/$OE_CONFIG”

Leave a Comment

Name*
Email*
Comments
Please Enter the Captcha Here

Get to Know Us

Take the next step to connect with us and discover the power of Open ERP. Please select your preferred way to engage.

Call Now
Financial Accounting with Odoo.
We literally wrote a book about it.

Enhance your Odoo experience with our exclusive open source modules and resources.

The Whole is Greater Than the Sum of its Parts

Individually or together, these premier suites of business applications offer open source ERP solutions tailored to your company’s unique business needs.

As a top Odoo integrator in the US, we will help your team discover why Odoo is among the most trusted Open Source ERP applications, with end-to-end ERP accounting integrations simplified by the pros.

ERP customers can enjoy all the robust capabilities of real-time data sets to inform their ERP solutions, operations and leadership teams. If you are looking for Hadoop done right, you’re in the right place.

There are websites and then there are e-commerce sites. E-commerce at the next level starts with a robust CMS solution. Find out why Open Source integrators look first to Magento for the heavy lifting.

Schedule a Call
Readiness Assessment
Attend a Webinar
Contact Us