1. Home
  2. Linux
  3. General
  4. How to Install and Configure Odoo with mod_wsgi

How to Install and Configure Odoo with mod_wsgi

In this tutorial we will teach you how to install Odoo 10 on an Ubuntu 16.04 VPS with Apache2 and mod_wsgi. Odoo 10 is an Apache module which implements a WSGI compliant interface for hosting python based web applications like Odoo on top of the Apache web server.
There are a couple of ways to install Odoo, however, in this tutorial we are going to install the latest Odoo 10 from the source with a python virtual environment. This tutorial will work on different Linux VPS systems, however, it was tested and made for Ubuntu 16.04 VPS.

what is Odoo?

Odoo (previously OpenERP) is a suite of business applications for Sales, CRM, Websites, Human Resources, Project management, Warehouse management, and more. You can extend Odoo with thousands of modules.

Update the system and install the required packages.

sudo apt update 
apt -y upgrade
sudo apt-get install git python-pip python-dev \
    python-virtualenv libevent-dev gcc libjpeg-dev libxml2-dev \
    libssl-dev libsasl2-dev node-less libldap2-dev libxslt-dev

Install PostgreSQL

You may install PostgreSQL using apt, it is quite easy to accomplish.

sudo apt install postgresql-9.5 postgresql-server-dev-9.5
sudo systemctl enable postgresql.service
sudo systemctl start postgresql.service

Create an Odoo user
Create an odoo system user by running the command below.

sudo adduser --system --group odoo --home /opt/odoo
Create PostgreSQL database user using the command below.
su - postgres -c "createuser --createdb --username postgres --no-createrole --no-superuser --no-password odoo"

Install Odoo
Change to the odoo user and copy the Odoo 10.0 branch from GitHub.

sudo su - odoo -s /bin/bash
git clone https://www.github.com/odoo/odoo --depth 1 --branch 10.0 --single-branch /opt/odoo

Create a python virtual environment and install every requirement with the command below.

cd /opt/odoo
virtualenv ./venv
source ./venv/bin/activate
pip install -r requirements.txt

Once the installation is finished, go back to your sudo user.


Make a configuration file by copying the default ‘odoo-wsgi.example.py’ file.

sudo cp /opt/odoo/setup/odoo-wsgi.example.py /opt/odoo/setup/odoo-wsgi.py

Open the configuration file.

sudo nano /opt/odoo/setup/odoo-wsgi.py

Change the addon path to the one below.

conf['addons_path'] = 'addons'

Next, set the master admin password.

conf['admin_passwd'] = 'my_secret_password'

If you would like to print PDF reports in Odoo, you have to install the ‘Wkhtmltopdf’ package.

sudo apt -y install wkhtmltopdf

If you do not have Apache installed on the system, you will need to install it with the command below.

sudo apt update
sudo apt install apache2

To install and enable the ‘mod_wsgi’, execute the commands below.

sudo apt install libapache2-mod-wsgi
sudo a2enmod wsgi

Create an Apache Virtual Host Directive for your domain.

sudo nano /etc/apache2/sites-available/odoo.conf
<VirtualHost *:80>
    ServerName my-odoo-domain.com
    ServerAlias  www.my-odoo-domain.com
    ErrorLog ${APACHE_LOG_DIR}/odoo-error.log
    CustomLog ${APACHE_LOG_DIR}/odoo-access.log combined
    <Directory /opt/odoo/setup>
        <Files odoo-wsgi.py>
            Require all granted
    WSGIDaemonProcess odoo user=odoo group=odoo python-home=/opt/odoo/venv/ python-path=/opt/odoo
    WSGIProcessGroup odoo
    WSGIScriptAlias / /opt/odoo/setup/odoo-wsgi.py

Enable the virtual host by creating a symbolic link and restarting Apache.

sudo a2ensite odoo
sudo systemctl restart apache2

This should be all you have to do to install Odoo with Apache2 and mod_wsgi on your Ubuntu 16.04 VPS. Now open your browser, type the address of your website, and create a database and admin user.
Also, here we have a few hand-picked guides that you  must read next:

  1. How to Restore a full website cPanel Backup to VPS
  2. Speed up WordPress with Redis Caching


Updated on December 24, 2018

Was this article helpful?

Related Articles

Leave a Comment

[apsl-login-lite login_text='Please login with a social account']