Odoo 9 User Interface

Install Odoo 9 from source on Ubuntu 22.04 Server

Odoo 9 was released in October 1st 2015 and reached its end of life on October 5, 2018 (when Odoo 12 was released). It requires out-dated Python 2.7 which is not available on Ubuntu 22.04. However, there are some reasons for us to install Odoo 9 on Ubuntu 22.04:

  • You don’t have an earlier version of Ubuntu that supports Python 2.7 and other libraries that Odoo 9 requires.
  • Maintenance
  • Migration to another later Odoo realease
  • and others (please advise me yours by leaving comment)

Please note that if you are seeking for installing other Odoo versions, you could read other posts of mine for that:

Of, if you are an Odoo developer, you may interest in How to setup Odoo development environment on Ubuntu 22.04.

Executive Summary

In this post, I will guide you through 6 steps to install Odoo 9 on Ubuntu 22.04 server to achieve the following:

  1. Odoo 9’s source code locates at /opt/odoo/odoo9
  2. It runs under a unix account named odoo9 belong to the group named odoo
  3. It can connect to local PostgreSQL under the role named odoo9 that CAN create databases.
  4. Once you complete the installation, you can access the Odoo 9 instance using your web browser
  5. Odoo 9 will use PostgreSQL 9.6 or PostgreSQL 10 for data storage.

Step1 – Create Odoo running user account

For security, we should run Odoo under a separate Linux user that has the following specifications:

  • The user account will be named odoo9;
  • The user account will not be able to login for security purpose;
  • The user account should be a system account under which daemons and other automatic processes run;
  • A dedicated home directory for storing data and custom Odoo addons. It’s a good practice to make it under the /home/ directory;
  • The user account should belong to a group that has access to Odoo 9 source code (e.g. odoo);

Run the following command to create the group odoo:

sudo addgroup odoo

Run the following command to create the user account odoo9 and add it to the group odoo:

sudo adduser odoo9 --system \
--home=/home/odoo9 --disabled-login \
--disabled-password --ingroup odoo

Step 2 – Install Python 2.7

Although Python 2.7 was dropped since Ubuntu 20.04, we can still install it by following my tutorial on how to install Python 2.7 on Ubuntu 22.04.

After that, we will create a virtual environment for Odoo 9 so that we can isolate it from others to not break existing things. Please make sure you’ve installed virtualenv for Python 2.7.

Create Virtual Environment

Create parent folders for Odoo 9’s virtual environment

sudo mkdir -p /python-venv/2.7/odoo9

Set appropriate access rights for the group odoo and the account odoo9:

sudo chown -hR odoo9: /python-venv/2.7/odoo9

Switch the account to odoo9’s bash

sudo su - odoo9 -s /bin/bash

Create a virtual environment and name it odoo9

virtualenv /python-venv/2.7/odoo9

Now, exit odoo9 to get back to the previous user account.


Step 3 – Download Odoo 9 source code from GitHub

As said in Executive Summary section, we will store Odoo 9 source code in /opt/odoo/odoo9.

sudo mkdir /opt/odoo

Grant access for the user accounts in the group odoo to read Odoo source code:

sudo chown root:odoo /opt/odoo

To download the source code of Odoo 9 from GitHub, just run the command below to download the Odoo 9 source code over HTTP:

git clone -b 9.0 https://github.com/odoo/odoo.git /opt/odoo/odoo9

Or, you may clone the repository from GitHub over SSH for better performance and security using the following command:

git clone -b 9.0 git@github.com:odoo/odoo.git /opt/odoo/odoo9

Depending on your internet connection speed, the process may take a few minutes or more. Please be patient!

After the process is completed, you will find the Odoo 9 source code in the directory /opt/odoo/odoo9/.

Now, secure your source code to allow only the users of the group odoo to read it.

sudo chown -hR root:odoo /opt/odoo/odoo9

Step 4 – Install PostgreSQL for Odoo 9

I have not been tested Odoo 9 with the latest version of PostgreSQL which is PostgreSQL 14 that comes with Ubuntu 22.04 but I believe it would work. However, if you are installing Odoo 9 for your production server, I guess you might want to stick with PostgreSQL 9.6 or PostgreSQL 10 as Odoo 9 was designed for PostgreSQL 9.6 and added support for PostgreSQL 10 later.

So, in this post, I will guide you on how to install PostgreSQL 9.6 and PostgreSQL 10. You can read another post of mine if you want to install multiple PostgreSQL versions on Ubuntu 22.04.

Adding official PostgreSQL PPA

As Ubuntu 22.04 has no idea about the PostgreSQL versions other than 14, we need to add the official PPA from PostgreSQL author

# Create the file repository configuration: 
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' 
# Import the repository signing key: 
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg 
# Update the package lists: 
sudo apt-get update 

Install Postgres 9.6 and PostgreSQL 10

sudo apt install postgresql-9.6 # version 9.6 
sudo apt install postgresql-10 # version 10 

After the installation is completed, and I assume that you did not have any postgreSQL installed before, the listening ports of the two newly installed PostgreSQL clusters will be:

PostgreSQL 9.65432
PostgreSQL 105433
PostgreSQL Listening Ports

In case you want to re-arrange the ports assignment, please follow the tutorial on changing PostgreSQL ports.

Create Database Roles

In this section, we will create database SQL roles that having the same name as the unix user account odoo9 for each PostgreSQL versions so that Odoo 9 running under odoo9 account will be able to connect PostgreSQL using ident authentication method (without using password).

Role For PostgreSQL 9.6

As the installed PostgreSQL 9.6 cluster is running on port 5432, we could use the following command to create the role odoo9 for PostgreSQL 9.6

sudo -u postgres createuser odoo9 --interactive -p 3432

When asked during the interative session, please input as follow:

Create role odoo9 in PostgreSQL 9.6
Create role odoo9 in PostgreSQL 9.6

Role for PostgreSQL 10

This is similar to the one for PostgreSQL 9.6, but the port is 5433.

sudo -u postgres createuser odoo9 --interactive -p 3433

When asked during the interative session, please input as the same as the one for PosgreSQL 9.6

Step 5 – Install Odoo 9’s required packages and libraries


Run the following command to install the packages that are required for later Python library installation.

sudo apt install build-essential python-setuptools \
python2-dev libpq-dev libxml2-dev libxslt1-dev \
zlib1g-dev libsasl2-dev libldap2-dev libssl-dev \

Install Less Compiler

Odoo 9 requires less compiler to compile less to css. Here is how we install less.

Firstly, we will install nodejs:

sudo apt install nodejs

Secondly, we will install Nodejs package manager (aka npm):

sudo apt install npm

Then, upgrade npm to the latest version:

sudo npm install -g npm

Now, install less compiler using npm. Please note that the latest less may not work with Odoo 9. We just stick with the less 3.10.3 which works with all the Odoo versions that use less compiler (i.e. Odoo 9, Odoo 10, Odoo 11).

sudo npm install -g less@3.10.3
sudo npm install -g less-plugin-clean-css

Install wkhtmltopdf

Odoo generates PDF from HTML, that’s why we need the wkhtmltopdf.

Download wkhtmltopdf:

wget https://github.com/wkhtmltopdf/packaging/releases/download/

Install wkhtmltopdf:

sudo dpkg -i wkhtmltox_0.12.6.1-2.jammy_amd64.deb
# force install dependencies
sudo apt -f install

Install Python Libraries for Odoo 9

Firstly, we need to activate the Odoo 9 virtual environment that we’ve created above by executing the command:

# switch to odoo9's bash
sudo su - odoo9 -s /bin/bash
# activate the virtual environment
source /python-venv/2.7/odoo9/bin/activate

After activativation, you will find (odoo9) as the prefix of your command prompt. Then you can start install Odoo 9’s required packages and libraries using pip command as below:

pip install -r /opt/odoo/odoo9/requirements.txt

Please note that the version of the library psycopg2 specified in the above requirements.txt is 2.7.1 which is not compatible with the Ubuntu 22.04’s glib. We need to upgrade the psycopg2 to the version using the command below:

pip install psycopg2==

Runing Odoo 9 with PostgreSQL 9.6

Run the Odoo

Now, let’s try to run the following command to check if everything is fine:


Then, you should see something similar as below in the console:

Running Odoo9 with PostgreSQL 9.6

Now, you can start to open your web browser and input the address https://your_ip:8069 to see the result as below:

Odoo 9 Database Creation User Interface
Odoo 9 Database Creation User Interface

Now, you can start input database name and other information so that Odoo9 will initialize everything for you

  • Database Name: v9_psql9
  • Email: your_name@example.com
  • Password: your secured password
  • Language: select the one you prefer in the dropdown list of languages
  • Country: select the country in which your company is registered officially. Choosing the right one could bring ease to you later (e.g. localization modules will be installed accordingly)

Stop the Odoo

To stop the Odoo instance, just press Ctrl+C twice.

Runing Odoo 9 with PostgreSQL 10

Run Odoo 9

In the above section, we have been successful in running and initializing Odoo 9 with PostgreSQL 9.6. Here is how to run the same Odoo 9, but with PostgreSQL 10.

As our PostgreSQL installation procedure above, PostgreSQL 10 is up and running on port 5433 while Odoo 9 tries to connect on port 5432. Here is the command to run Odoo 9 connecting to the PostgreSQL 10 on port 5433:

/opt/odoo/odoo9/odoo.py --db_port=5433

We issued the same command with additional parameter –db_port to ask Odoo 9 to connect the database using the port 5433.

Stop Odoo 9

To stop the Odoo instance, just press Ctrl+C twice.


After some operations as above, we may need to exit the run environment for other tasks by issusing the following commands:

# Deactivate the virtual environment
# exit odoo9's bash session to get back the previous unix user

Step 6 – Run Odoo 9 as a service / daemon

In this section, I will guide you on how to create a startup service for your newly installed Odoo 9 so that your Odoo 9 will be running as a service and started every time the server is started.

Create Odoo configuration file

Configuration file is the file that stores configuration directives that let Odoo know how to run (e.g. addons path, database port, etc).

In this section, I will create a configuration file named odoo9.conf and store it in /home/odoo9 for Odoo 9 to use later. I will use nano editor to create the file:

sudo nano /home/odoo9/odoo9.conf

Now, copy and pasted the following in your nano editor UI:

addons_path = /opt/odoo/odoo9/openerp/addons,/opt/odoo/odoo9/addons
admin_passwd = admin
csv_internal_sep = ,
data_dir = /home/odoo9/.local/share/Odoo
db_host = False
db_maxconn = 64
db_name = False
db_password = False
db_port = False
db_template = template1
db_user = False
dbfilter = .*
debug_mode = False
demo = {}
email_from = False
geoip_database = /usr/share/GeoIP/GeoLite2-City.mmdb
import_partial =
limit_memory_hard = 2684354560
limit_memory_soft = 2147483648
limit_request = 8192
limit_time_cpu = 60
limit_time_real = 120
list_db = True
log_db = False
log_db_level = warning
log_handler = :INFO
log_level = info
logfile = None
logrotate = False
longpolling_port = 8072
max_cron_threads = 2
osv_memory_age_limit = 1.0
osv_memory_count_limit = False
pg_path = None
pidfile = None
proxy_mode = False
reportgz = False
server_wide_modules = web,web_kanban
smtp_password = False
smtp_port = 25
smtp_server = localhost
smtp_ssl = False
smtp_user = False
syslog = False
test_commit = False
test_enable = False
test_file = False
test_report_directory = False
translate_modules = ['all']
unaccent = False
without_demo = False
workers = 0
xmlrpc = True
xmlrpc_interface =
xmlrpc_port = 8069

Now, save the file and exit by hitting Ctrl+X then input y and hit Enter button.

To allow odoo9 to access the configration file:

sudo chown odoo9:root /home/odoo9/odoo9.conf

Create Unit Service file

sudo nano /lib/systemd/system/odoo9.service

Now, copy and pasted the following in your nano editor UI

After=network.target postgresql.service

ExecStartPre=/usr/bin/install -d -m755 -o odoo9 -g odoo /run/odoo9
ExecStart=/python-venv/2.7/odoo9/bin/python /opt/odoo/odoo9/odoo.py -c /home/odoo9/odoo9.conf --pid=/run/odoo9/odoo9.pid
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID


Now, save the file and exit by hitting Ctrl+X then input y and hit Enter button.

Run the following command to notify systemd that a new unit file exists:

sudo systemctl daemon-reload

Now, enable the service and ask it to run on boot:

sudo systemctl enable --now odoo9

Now, start your Odoo 9 using systemd:

sudo systemctl start odoo9

Now, let’s open your web browser and input the address https://your_ip:8069 to see the Odoo 9 Database Creation User Interface.

To stop it, just run:

sudo systemctl stop odoo9

Leave a Reply