Reading list Switch to dark mode

    Installing Odoo on Ubuntu

    Updated 17 January 2017

    Odoo: Odoo is a web-based opensource ERP software  which allows you to manage your business with ease. Odoo offers various business management applications such as Sales management, Project management, Human Resource Management, Point of Sales and the list goes on. But before you can access such useful apps you will have to get it installed on a web server or a system. Installing Odoo on Ubuntu can be sometimes complex for a newbie. This blog will guide you in installing Odoo on Ubuntu starting from Odoo 7 to the latest release of Odoo 10 on Ubuntu 14.04 and above.

    Step 1: Getting your system ready for the installation

    Make sure your server has all the latest versions & patches. Update the repositories by following command:
    sudo apt-get update

    Step 2: Creating an Odoo user

    The next step is to create a system user which will own the application Odoo. It is not mandatory to create a new user, you can use your current system user as well. Although it is the recommended step to create a new user for Odoo. We can create a new user “odoo” and provide a home directory for it via command below.
    sudo adduser --system --home=/opt/odoo --group odoo

    Step 3: Installing and Setting up PostgreSQL

    Install PostgreSQl with:

    sudo apt-get install postgresql

    Once the PostgreSQL is installed, next we setup a new PostgreSQL user for our application. This user will be used for making all the database interaction form the Odoo.

    sudo su - postgres

    Searching for an experienced
    Odoo Company ?
    Find out More

    createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo

    after running this command you will be asked for a password and then a confirmation of that

    Enter password for new role: *****

    Enter it again:*****

    Then finally exist the PostgreSQL by typing the command:

    exit

    Step 4: Installing Python and other dependent libraries

    First installing the Python dependencies for Odoo:

    sudo apt-get install 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 python-setuptools python-babel python-reportlab-accel python-zsi python-openssl python-egenix-mxdatetime python-unittest2 python-mock python-docutils lptools make python-psutil python-paramiko poppler-utils python-pdftools antiword

    Next is to install Less CSS via nodejs. we will start with installing npm:

    apt-get install -y npm

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

    sudo ln -s /usr/bin/nodejs /usr/bin/node

    sudo npm install -g less

    sudo apt-get install node-less

    Once all the packages are installed we are ready to proceed with installing Odoo server

    Step 5 : Installing Odoo server from Odoo source hosted on Github

    Make sure you have GIT installed on your system and if not then install with the simple command:

    sudo apt-get install git

    After installing the the GIT we will clone the Odoo Source in the home directory of the odoo user we created earlier.

    sudo su - odoo -s /bin/bash

    While cloning the branch from github you can specify the branch you want to clone. For instance we are cloning Odoo 10 branch from the repository

    git clone https://www.github.com/odoo/odoo --depth 1 --branch 10.0 --single-branch .

    You can use the same command to install any previous versions as well just by changing the –branch 10.0 parameter to the odoo version you wish to install.

    This may take some time depending upon your internet connectivity. Once the branch is cloned exit the odoo user by typing command

    exit

    Step 6: Installing Wkhtmltopdf

    Odoo uses wkhtmltopdf to convert the html reports into pdf format. But all the versions of wkhtmltopdf does not support odoo. Here is the process to install the supported version for a system with 64 bit architecture. First download the package for installation:

    wget http://download.gna.org/wkhtmltopdf/0.12/0.12.1/wkhtmltox-0.12.1_linux-trusty-amd64.deb

    Once the package is downloaded install it and copy the files accordingly:

    dpkg -i wkhtmltox-0.12.1_linux-trusty-amd64.deb

    sudo cp /usr/local/bin/wkhtmltopdf /usr/bin
    sudo cp /usr/local/bin/wkhtmltoimage /usr/bin

    Step 7: Odoo Server configuration

    We have installed all the dependencies now and we are all set to configure the Odoo Server, For this we will first create the directory for storing logs of Odoo server and assigning proper ownership to the directory:

    sudo mkdir /var/log/odoo

    sudo chown odoo:root /var/log/odoo

    Next is to create the configuration file for odoo server. Odoo application will use these configuration to run so fill in the configuration as per your requirements. We will first create a configuration file and specify the configurations:

    sudo nano /etc/odoo-server.conf

    A sample configuration file looks like this:

    [options]
    ; This is the password that allows database operations:
    ; admin_passwd = admin
    db_host = False
    db_port = False
    db_user = odoo
    logfile = /var/log/odoo/odoo-server.log
    addons_path = /opt/odoo/addons,/opt/odoo/odoo/addons

    Once the configration file is create we will set the ownership rights

    sudo chown odoo: /etc/odoo-server.conf
    sudo chmod 640 /etc/odoo-server.conf

    Once the configuration is created last step is to create a boot script which we will use to start or stop the odoo server.

    sudo nano /etc/init.d/odoo-server

    A script to start or stop Odoo is already available at path “/opt/odoo/debian/init” but since we have installed the odoo at path /opt/odoo we need to make some minor changes in this script file for the parameter “DAEMON”

    Here is how the file will look like after the modification.

    #!/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
    ### END INIT INFO
    
    PATH=/bin:/sbin:/usr/bin
    DAEMON=/opt/odoo/odoo-bin
    NAME=odoo-server
    DESC=odoo-server
    USER=odoo
    CONFIGFILE="/etc/odoo-server.conf"
    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

    Now we need to change the ownership and make this script executable

    sudo chmod 755 /etc/init.d/odoo-server
    sudo chown root: /etc/init.d/odoo-server

    We are all done now. we can start the odoo server and test if it works. To start the odoo server type in the command:

    sudo /etc/init.d/odoo-server start

    Odoo is now accessible at http://localhost:8069. Port 8069 is the default port for Odoo, it will depend upon configurations you have made.

    Cheers! You have now successfully installed the Odoo now enjoy cool business apps as per your need to make your business operation smoother…..

    . . .

    Leave a Comment

    Your email address will not be published. Required fields are marked*


    2 comments

  • Brandon Ashcraft
    • Mohit Chandra
  • Back to Top

    Message Sent!

    If you have more details or questions, you can reply to the received confirmation email.

    Back to Home

    Table of Content