Install Odoo V9.0 with Nodejs on Ubuntu 14.04

I have tried out V9.0. and this round , it is not SO easy to install , so in this article , from what i learn and i will share here hopefully can help you all to try out Odoo V9.0 !
You can download a .deb or .rpm file of odoo 9 from and install it in the ubuntu or any other debian distribution. This How to guide will allow you to install odoo v9.0.

1. Update The System

First get newest versions possible as per version requirements of dependencies of packages existing on the machine using.
$sudo apt-get update
$sudo apt-get dist-upgrade

2. Create User

Create Odoo System User that will own and run the odoo application.
$sudo adduser --system --home=/opt/odoo --group odoo

Here we have specified /opt/odoo as home, so when ever you change user to odoo it will by default land to /opt/odoo.
we gonna put all the odoo code under /opt/odoo. you can change the path of your choice, and do the configuration accordingly.

After creating user you can try the login with the created user by below command.
$sudo su - odoo -s /bin/bash

3. Install and Configure Postgres Database

$sudo apt-get install postgresql

This command will install postgres 9.1 by default in ubuntu 14.04 or any debian distribution. if you want to use any specific version of postgres(i.e 9.3, 9.4) you need to update the source list. for example to install postgres-9.4 you can follow below steps.
Create the file /etc/apt/sources.list.d/pgdg.list, and add a line for the repository using vim or nano editor
$deb trusty-pgdg main
Import the repository signing key, and update the package lists
$wget --quiet -O - | sudo apt-key add -
and update the packages using
$sudo apt-get update
after that you can search/install the available/supported postgres version
$sudo apt-get install postgresql-9.4
After installing postgres 9.4, change to the postgres user so we have the necessary privileges to configure the database
$sudo su - postgres
Now create a new database user with access to create and drop database.
$createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo

4. Install the necessary libraries

$sudo apt-get install python-pip python-dev libevent-dev gcc libxml2-dev libxslt-dev node-less libldap2-dev libssl-dev

Odoo 9 depends on node-less
You may probably missing a dependency for lessc, here are the instructions to get lessc working correctly, 

After installing this system libraries we can install python libraries using pip. Create or use the  requirement.txt file  distributed in Odoo server.

Here is information for how to change the directory to /tmp, and get the official requirement.txt from Odoo V9.0 github repository to install it in your system. it will reduce steps to install the python dependency to install odoo 9 in your server.
$cd /tmp & $rm requirements.txt & $wget $sudo pip install -r requirements.txt
After all the dependencies installed ,Odoo 9.0 should be ready to install .
for Qweb templating we need to install wkhtmltopdf. download deb file of  wkhtmltopdf 32 bit orwkhtmltopdf 64 bit.
Assumed  we have downloaded wkhtmltopdf into /tmp directory. You can go to the directory and run the following command to install.
for 64 bit:
$sudo dpkg -i /tmp/wkhtmltox-
for 32 bit:
$sudo dpkg -i /tmp/wkhtmltox-

5. Install the Odoo server

Install Git:
$sudo apt-get install git
Switch to the Odoo user  :
$sudo su - odoo -s /bin/bash
$git clone --depth 1 --branch 9.0 --single-branch .

6. Other Information

6.1. Error of uploading images for Odoo V9.0 in ubuntu 14.04
Root Cause: Pillow (JPEG decoder) bug on ubuntu > 14.04

Resolution: update jpeg library, then reinstall pillow.

# install libjpeg-dev with apt
sudo apt-get install libjpeg-dev

# reinstall pillow
pip install -I pillow

# restart Odoo, or else no effect until it is restarted.
6.2. Configuring the Odoo application
The default configuration file for the server is under /opt/odoo/debian/openerp-server.conf. we’ll copy that file to where we need it and change it’s ownership and permissions:
$sudo cp /opt/odoo/debian/openerp-server.conf /etc/odoo-server.conf
$sudo chown odoo: /etc/odoo-server.conf
$sudo chmod 640 /etc/odoo-server.conf
Above commands make the file owned and writable only by the odoo user and group and only readable by odoo and root.
To allow odoo to use default addons you need to change the addons_path line in config file from addons_path = /usr/lib/python2.7/dist-packages/openerp/addons in the config file to addons_path = /opt/odoo/addons. (Please refer to the documents on how to write your own config file )
you can also change other line as per your server deployment needs.
6.3. Installing the Init script
This script will be used to start-up and shut down the odoo server automatically and also run the application as the defined user. we will user script /opt/odoo/debian/init by doing few small modifications. Here’s a sample of the startup script  for Odoo 9.

# Provides:
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start odoo daemon at boot time
# Description:       Enable service provided by daemon.
# X-Interactive:     true
## more info:\
. /lib/lsb/init-functions

test -x $DAEMON || exit 0
set -e

function _start() {
    start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid $USER:$USER --background --make-pidfile --exec $DAEMON -- --config $CONFIG --logfile $LOGFILE
function _stop() {
    start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo --retry 3
    rm -f $PIDFILE
function _status() {
    start-stop-daemon --status --quiet --pidfile $PIDFILE
    return $?
case "$1" in
                echo -n "Starting $DESC: "
                echo "ok"
                echo -n "Stopping $DESC: "
                echo "ok"
                echo -n "Restarting $DESC: "
                sleep 1
                echo "ok"
                echo -n "Status of $DESC: "
                _status && echo "running" || echo "stopped"
                echo "Usage: $N {start|stop|restart|force-reload|status}" >&2
                exit 1
exit 0

Now you need to either copy it or paste the contents of this script to a file in /etc/init.d/ and call it odoo-server. and you need to make it executable and owned by root:
$sudo chmod 755 /etc/init.d/odoo-server
$sudo chown root: /etc/init.d/odoo-server
we also need to make log file /var/log/odoo/odoo-server.log and give proper access rights using the following commands ,

create odoo directory under /var/log/
$sudo mkdir /var/log/odoo
go to the directory
$cd /var/log/odoo
create file
$touch odoo-server.log
give the permission to writable by the odoo user
$sudo chmod 755 /var/log/odoo/odoo-server.log
$sudo chown odoo:root -R /var/log/odoo/
6.4. Testing the new odoo server
To start the Odoo server type:
$sudo /etc/init.d/odoo-server start
You should now be able to view the log file and see that the server has started.
$sudo tail -f /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 which by default use port 8069. try below in your browser
for the first time you will see database manager to create your first database.
Now it’s time to make sure the server stops properly too:
$sudo /etc/init.d/odoo-server stop
Check the log file again to make sure odoo has stopped properly.
$sudo tail -f /var/log/odoo/odoo-server.log
6.5. Automate startup for Odoo server 
If everything working well above then we will  make an entry of odoo-sever in update-rc.d which will automatically start & stops the odoo server along with ubuntu,
$sudo update-rc.d odoo-server defaults
you can try rebooting your server to check whether the odoo service is working fine or not.
Hope you enjoy odoo v9.0 . Should you find any problems of this instruction , please write your comments and we will try to solve it and update the documents to benefit the rest of the users.