Step-by-Step : Install Odoo 9 on Ubuntu 14.04

Here is our experience how to install Odoo 9 on Ubuntu 14.04 (Desktop or Server), step-by-step.

Step 1: Before begin the installation
Make sure your Ubuntu has all the latest versions & patches by doing an update:
sudo apt-get update
sudo apt-get dist-upgrade

Step 2: For the purpose of remote management, we need ssh.
sudo apt-get install openssh-server

Step 3: Configure firewall ports.
sudo ufw allow ssh
sudo ufw allow 8069/tcp
sudo ufw enable

Step 4. Create the Odoo user.
sudo adduser odoo
otherwise you can create a system user which is not supposed to be a person type user with a login as common users.
sudo adduser --system --home=/opt/odoo --group odoo
Then we need a log directory.
sudo mkdir /var/log/odoo
sudo chown odoo:root /var/log/odoo

Step 5: Install Postgresql and server dependencies.
sudo apt-get install subversion git bzr bzrtools python-pip postgresql postgresql-server-dev-9.3 python-all-dev python-dev python-setuptools libxml2-dev libxslt1-dev libevent-dev libsasl2-dev libldap2-dev pkg-config libtiff5-dev libjpeg8-dev libjpeg-dev zlib1g-dev libfreetype6-dev liblcms2-dev liblcms2-utils libwebp-dev tcl8.6-dev tk8.6-dev python-tk libyaml-dev fontconfig python-cups python-dateutil python-decorator python-docutils python-feedparser python-gdata python-geoip python-gevent python-imaging python-jinja2 python-ldap python-libxslt1 python-lxml python-mako python-mock python-openid python-passlib python-psutil python-psycopg2 python-pybabel python-pychart python-pydot python-pyparsing python-pypdf python-reportlab python-requests python-simplejson python-tz python-unicodecsv python-unittest2 python-vatnumber python-vobject python-werkzeug python-xlwt python-yaml npm

Step 6: Download Odoo server files.
Change to the odoo directory, for example:
cd /home/odoo/
Or if you want to put your odoo files on the other directory:
cd /opt/odoo/
Then clone the Odoo files from git server:
sudo git clone https://www.github.com/odoo/odoo --depth 1 --branch 9.0 --single-branch ./odoo
sudo chown -R odoo: /home/odoo/odoo/

Step 7: Create Postgresql User.
sudo su - postgres
Now create a new database user. This is so Odoo has access rights to connect to PostgreSQL and to create and drop databases. Remember what your choice of password is here; you will need it later on:
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo
Enter password for new role: ********
Enter it again: ********

Finally exit from the postgres user account:
exit

Step 8: Install specific dependencies
sudo pip install -r /home/odoo/odoo/doc/requirements.txt
sudo pip install -r /home/odoo/odoo/requirements.txt

We need install Less CSS via nodejs and npm.
wget -qO- https://deb.nodesource.com/setup | sudo bash -
sudo apt-get install nodejs
sudo npm install -g less less-plugin-clean-css

Since Odoo 9 only compatible with wkhtmltopdf version 0.12.1, wee need to update it.
cd /tmp/
For 64 bit:
wget https://downloads.wkhtmltopdf.org/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb
For 32 bit:
wget https://downloads.wkhtmltopdf.org/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-i386.deb
For others, you can download from here.

Then install package wkhtmlpdf:
sudo dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb

Step 9: Configure Odoo Server
sudo cp /home/odoo/odoo/debian/openerp-server.conf /etc/odoo-server.conf
sudo chown odoo: /etc/odoo-server.conf
sudo chmod 640 /etc/odoo-server.conf

Next we need to modify the configuration file (/etc/odoo-server.conf).
sudo nano /etc/odoo-server.conf
The finished file should look similar to this depending on your deploying needs:
[options]
admin_passwd = admin
db_host = False
db_port = False
db_user = odoo
addons_path = /home/odoo/odoo/addons
logfile = /var/log/odoo/odoo-server.log
xmlrpc_port = 8069

Step 10: Create Odoo boot script
sudo nano /etc/init.d/odoo-server
Copy-paste this script.
#!/bin/sh

### BEGIN INIT INFO
# Provides: odoo-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: Complete Business Application software
# Description: Odoo is a complete suite of business tools.
### END INIT INFO

PATH=/bin:/sbin:/usr/bin
DAEMON=/home/odoo/odoo/openerp-server
NAME=odoo-server
DESC=odoo-server

# Specify the user name (Default: odoo).
USER=odoo

# Specify an alternate config file (Default: /etc/odoo-server.conf).
CONFIGFILE=”/etc/odoo-server.conf”

# pidfile
PIDFILE=/var/run/$NAME.pid

# Additional options that are passed to the Daemon.
DAEMON_OPTS=”-c $CONFIGFILE”

[ -x $DAEMON ] || exit 0
[ -f $CONFIGFILE ] || exit 0

checkpid() {
[ -f $PIDFILE ] || return 1
pid=`cat $PIDFILE`
[ -d /proc/$pid ] && return 0
return 1
}

case “${1}” in
start)
echo -n “Starting ${DESC}: ”

start-stop-daemon –start –quiet –pidfile ${PIDFILE} \
–chuid ${USER} –background –make-pidfile \
–exec ${DAEMON} — ${DAEMON_OPTS}

echo “${NAME}.”
;;

stop)
echo -n “Stopping ${DESC}: ”

start-stop-daemon –stop –quiet –pidfile ${PIDFILE} \
–oknodo

echo “${NAME}.”
;;

restart|force-reload)
echo -n “Restarting ${DESC}: ”

start-stop-daemon –stop –quiet –pidfile ${PIDFILE} \
–oknodo

sleep 1

start-stop-daemon –start –quiet –pidfile ${PIDFILE} \
–chuid ${USER} –background –make-pidfile \
–exec ${DAEMON} — ${DAEMON_OPTS}

echo “${NAME}.”
;;

*)
N=/etc/init.d/${NAME}
echo “Usage: ${NAME} {start|stop|restart|force-reload}” >&2
exit 1
;;
esac

exit 0

Then we need to change the ownership and permissions.
sudo chmod 755 /etc/init.d/odoo-server
sudo chown root: /etc/init.d/odoo-server
sudo update-rc.d odoo-server defaults

Step 11: Test your Odoo server
To start the Odoo server type:
sudo /etc/init.d/odoo-server start
You should now be able to view the logfile and see that the server has started.
less /var/log/odoo/odoo-server.log

If the log file looks OK, now point your web browser at the domain or IP address of your Odoo server (or localhost if you are on the same machine) and use port 8069. The url will look something like this:
http://IP_or_domain.com:8069

Advertisements

Tags: , , , , , ,

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s


%d bloggers like this: