Odoo 11 User Interface

Install Odoo 11 from source code on Ubuntu 22.04 Server

In this post, I will guide you through the 6 steps to install the out-dated Odoo 11 which was released in October 5th 2017 and reached its end of life on October 1st, 2020 (when Odoo 14 was released).

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 11 on Ubuntu 22.04 server to achieve the following:

  1. Odoo 11’s source code will be located at /opt/odoo/odoo11
  2. It runs under a unix account named odoo11 belong to the group named odoo
  3. It can connect to local PostgreSQL under the role named odoo11 that CAN create databases.
  4. Once you complete the installation, you can access the Odoo 11 instance using your web browser
  5. Odoo 11 will use 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 odoo11 and will not be able to login for security purpose; It should also 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 11 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 odoo11 and add it to the group odoo:

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

Step 2 – Install PostgreSQL for Odoo 11

I have not fully tested Odoo 11 with the latest version of PostgreSQL which is PostgreSQL 14 that comes fresh with Ubuntu 22.04 but I believe it would work. However, if you are installing Odoo 11 for your production server, I guess you might want to stick with PostgreSQL 10.

You can read another post of mine if you want to install multiple PostgreSQL versions on Ubuntu 22.04 in case you want another version of PostgreSQL.

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 

As usual, we should update the system before installing anything:

sudo apt dist-upgrade

Install PostgreSQL 10

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 port of the newly installed PostgreSQL 10 will be 5432

In case you have multiple versions of PostgreSQL running and you want to re-arrange the ports assignment, please follow the tutorial on changing PostgreSQL ports.

Create Database Role

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

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

sudo -u postgres createuser odoo11 --interactive -p 5432

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

Create role odoo11 in PostgreSQL 10
Create role odoo11 in PostgreSQL 10

Step 3 – Download Odoo 11 source code from GitHub

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

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 11 from GitHub, just run the command below to download the Odoo 11 source code over HTTP:

git clone -b 11.0 https://github.com/odoo/odoo.git /opt/odoo/odoo11

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

git clone -b 11.0 git@github.com:odoo/odoo.git /opt/odoo/odoo11

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 11 source code in the directory /opt/odoo/odoo11/.

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

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

Step 4 – Install Python 3.6 on Ubuntu 22.04

In my experience, Odoo has generally supported Python versions of and between Ubuntu LTS releases throughout its lifetime (i.e. Python 3.6 and and Python 3.7 and Python 3.8). However, the Python version comes fresh with Ubuntu 22.04, the targeting operating system of this post, is 3.10. Although someones said it should work but I recommend you to stick with either Python 3.6 or 3.7 or 3.8.

If you are building a fresh Odoo 11 server, I believe 3.8 should be the best choice. However, at the time of this writing (October 2022, Odoo 11 is long past its end of life), the reason you are installing Odoo 11 could be that you are migrating an existing Odoo 11 instance to a new server on which you decide to choose Ubuntu 22.04 as your operating system. So you’ll probably want to use an older version of Python to ensure compatibility with your current code base (including your custom code). So I’ll help you get there by guiding you to install Odoo 11 with Python 3.6. In case you are not in a position to have to use that outdated Python version, you may follow the same process, or check out my post on how to install multiple version of Python.

Python 3.6 Prerequisites

As usual, we need to update the system first:

sudo apt update; sudo apt dist-upgrade

To compile and install Python 3.6, we need to install several required packages and libraries by executing the following command:

sudo apt install make build-essential libreadline-dev \
wget curl llvm libssl-dev zlib1g-dev libbz2-dev  \
libsqlite3-dev libncurses5-dev libncursesw5-dev \
xz-utils tk-dev libffi-dev liblzma-dev libgdbm-dev \
libnss3-dev libedit-dev libc6-dev

Download Python 3.6 source code

wget https://www.python.org/ftp/python/3.6.15/Python-3.6.15.tgz

Extract and Compile Python 3.6

tar -xzf Python-3.6.15.tgz
cd Python-3.6.15
./configure --enable-optimizations --with-lto --with-pydebug
make -j 4  # adjust 4 for number of your CPU cores

Install Python 3.6

sudo make altinstall

Now, issue the command below to verify if Python 3.6 is properly installed:

python3.6 -V

You should see output as below

Verify if Python 3.6 is properly installed
Verify if Python 3.6 is properly installed

Install PIP (Python Package Installer)

sudo apt install python3-pip

Create Virtual Environment

Create parent folders for Odoo 11’s virtual environment

sudo mkdir -p /python-venv/3.6/odoo11

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

sudo chown -hR odoo11: /python-venv/3.6/odoo11

Switch the account to odoo11’s bash:

sudo su - odoo11 -s /bin/bash

Create a virtual environment and name it odoo11:

python3.6 -m venv /python-venv/3.6/odoo11

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

exit

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

Prerequisites

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

sudo apt install libjpeg-dev libjpeg-turbo8-dev \
libjpeg8-dev libldap-dev libldap2-dev libpq-dev \
libsasl2-dev libxslt1-dev

Install Less Compiler

Odoo 11 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, let’s install less compiler using npm. Please note that the latest less will not work with Odoo 11. 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/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb

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 11

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

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

After activativation, you will find (odoo11) as the prefix of your command prompt. Now, upgrade pip (Python Package Installer) to its latest version as usual:

pip install --upgrade pip

Then you can start install Odoo 11’s required packages and libraries using pip command as below:

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

Run Odoo 11

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

/opt/odoo/odoo11/odoo-bin

Or, if you want to run Odoo 11 on a port other than 8069 (the default port of Odoo), for example 8089:

/opt/odoo/odoo11/odoo-bin --xmlrpc-port=8089

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

Running Odoo11 from command line interface
Running Odoo11 from command line interface

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

Odoo 11 Database Creation User Interface
Odoo 11 Database Creation User Interface

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

  • Database Name: v11_psql10
  • 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 11

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

Exit

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
deactivate
# exit odoo11's bash session to get back the previous unix user
exit

Step 6 – Run Odoo 11 as a service / daemon

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

Create Odoo 11 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 odoo11.conf and store it in /home/odoo11 for Odoo 11 to use later. I will use nano editor to create the file:

sudo nano /home/odoo11/odoo11.conf

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

[options]
addons_path = /opt/odoo/odoo11/odoo/addons,/opt/odoo/odoo11/addons
admin_passwd = admin
csv_internal_sep = ,
data_dir = /home/odoo11/.local/share/Odoo
db_host = False
db_maxconn = 64
db_name = False
db_password = False
db_port = False
db_sslmode = prefer
db_template = template1
db_user = False
dbfilter =
demo = {}
email_from = False
geoip_database = /usr/share/GeoIP/GeoLite2-City.mmdb
http_enable = True
http_interface =
http_port = 8089
import_partial =
limit_memory_hard = 2684354560
limit_memory_soft = 2147483648
limit_request = 8192
limit_time_cpu = 60
limit_time_real = 120
limit_time_real_cron = -1
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
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

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

To allow odoo11 to access the configration file:

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

Create Unit Service file

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

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

[Unit]
Description=Odoo11
After=network.target postgresql.service

[Service]
Type=simple
PermissionsStartOnly=true
User=odoo11
Group=odoo
SyslogIdentifier=odoo11
PIDFile=/run/odoo11/odoo11.pid
ExecStartPre=/usr/bin/install -d -m755 -o odoo11 -g odoo /run/odoo11
ExecStart=/python-venv/3.6/odoo11/bin/python /opt/odoo/odoo11/odoo-bin -c /home/odoo11/odoo11.conf --pid=/run/odoo11/odoo11.pid
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID

[Install]
Alias=odoo11.service
WantedBy=multi-user.target

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 odoo11

Now, start your Odoo 11 using systemd:

sudo systemctl start odoo11

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

To stop it, just run:

sudo systemctl stop odoo11

Leave a Reply