How to Install and Configure Odoo with mod_wsgi

odoo with mod wsgi

In this tutorial, we will show you how to install Odoo 10 on an Ubuntu 16.04 VPS with Apache2 and mod_wsgi which is an Apache module that implements a WSGI compliant interface for hosting Python based web applications such as Odoo on top of the Apache web server. There are multiple ways to install Odoo, but in this tutorial, we will install the latest Odoo 10 from the source using a python virtual environment. This guide should work on other Linux VPS systems as well but was tested and written for an Ubuntu 16.04 VPS.

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

Update the system and install necessary 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

Installing PostgreSQL with apt is a quick and easy process.

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

Create Odoo user

Create an odoo system user with the following command:

sudo adduser --system --group odoo --home /opt/odoo

Create PostgreSQL database user with the following command:

su - postgres -c "createuser --createdb --username postgres --no-createrole --no-superuser --no-password odoo"

Install Odoo

Switch to user odoo and clone the Odoo 10.0 branch from GitHub:

sudo su - odoo -s /bin/bash
git clone --depth 1 --branch 10.0 --single-branch /opt/odoo

Create python virtual environment and install all requirements:

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

When the installation is complete switch back your sudo user:


Create a configuration file by copying the default file:

sudo cp /opt/odoo/setup/ /opt/odoo/setup/

Open the configuration file

sudo nano /opt/odoo/setup/

change the addon path to:

conf['addons_path'] = 'addons'

and set the master admin password:

conf['admin_passwd'] = 'my_secret_password'

If you want to print PDF reports in Odoo, you need to install the Wkhtmltopdf package:

sudo apt -y install wkhtmltopdf

Install Apache and mod_wsgi

If you don’t have Apache installed on your system, install it with the following command:

sudo apt update
sudo apt install apache2

To install and enable the mod_wsgi, run the following commands:

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>

    ErrorLog ${APACHE_LOG_DIR}/odoo-error.log
    CustomLog ${APACHE_LOG_DIR}/odoo-access.log combined

    <Directory /opt/odoo/setup>
            Require all granted

    WSGIDaemonProcess odoo user=odoo group=odoo python-home=/opt/odoo/venv/ python-path=/opt/odoo
    WSGIProcessGroup odoo
    WSGIScriptAlias / /opt/odoo/setup/


Activate the virtual host by creating a symbolic link and restart Apache.

sudo a2ensite odoo
sudo systemctl restart apache2

That’s it. You have successfully installed 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.
For more information about how to manage your Odoo installation, please refer to the Odoo documentation.

Of course, you don’t have to do any of this if you use one of our Odoo VPS Hosting services, in which case you can simply ask our expert Linux admins to setup this for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post please share it with your friends on the social networks using the buttons below or simply leave a comment in the Comments Section. Thanks.

How to Install OpenNMS on a Debian VPS
How to install PivotX on a CentOS/Fedora VPS
Install GitBucket on Ubuntu 16.04
  • Chuck


    Author Reply

    You might consider including a brief description of odoo so the casual reader has at least a minimal understanding of why you might want to install it.

    • admin


      Author Reply

      Thanks for the tip, we included a short paragraph on what Odoo is.

Free Migration to RoseHosting. Award Winning Linux VPS Hosting with Fully Managed Support. Coupon RHBLOG50 for 50% offOrder Now