Odoo 10 User Interface

Install Odoo 10 from source on Ubuntu 22.04 Server

Odoo 10 was released in October 5th 2016 and reached its end of life on October 5, 2019 (when Odoo 13 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 10 on Ubuntu 22.04:

  • You don’t have an earlier version of Ubuntu that supports Python 2.7 and other libraries that Odoo 10 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 10 on Ubuntu 22.04 server to achieve the following:

  1. Odoo 10’s source code locates at /opt/odoo/odoo10
  2. It runs under a unix account named odoo10 belong to the group named odoo
  3. It can connect to local PostgreSQL under the role named odoo10 that CAN create databases.
  4. Once you complete the installation, you can access the Odoo 10 instance using your web browser
  5. Odoo 10 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 odoo10;
  • 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 10 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 odoo10 and add it to the group odoo:

sudo adduser odoo10 --system \
--home=/home/odoo10 --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 10 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 10’s virtual environment

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

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

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

Switch the account to odoo10’s bash:

sudo su - odoo10 -s /bin/bash

Create a virtual environment and name it odoo10:

virtualenv /python-venv/2.7/odoo10

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

exit

Step 3 – Download Odoo 10 source code from GitHub

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

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

git clone -b 10.0 https://github.com/odoo/odoo.git /opt/odoo/odoo10

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

git clone -b 10.0 git@github.com:odoo/odoo.git /opt/odoo/odoo10

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

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

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

Step 4 – Install PostgreSQL for Odoo 10

I have not been tested Odoo 10 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 10 for your production server, I guess you might want to stick with PostgreSQL 10 as Odoo 10 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 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 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 odoo10 for each PostgreSQL versions so that Odoo 10 running under odoo10 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 odoo10 for PostgreSQL 10:

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

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

Create role odoo10 in PostgreSQL 10
Create role odoo10 in PostgreSQL 10

Step 5 – Install Odoo 10’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 build-essential python-setuptools 
python2-dev libpq-dev libxml2-dev libxslt1-dev 
zlib1g-dev libsasl2-dev libldap2-dev libssl-dev 
libjpeg-dev

Install Less Compiler

Odoo 10 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 10. 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 10

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

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

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

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

Run Odoo 10

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

/opt/odoo/odoo10/odoo-bin

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

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

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

Running Odoo10 from command line interface
Running Odoo10 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 10 Database Creation User Interface
Odoo 10 Database Creation User Interface

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

  • Database Name: v10_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 10

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

Step 6 – Run Odoo 10 as a service / daemon

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

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

sudo nano /home/odoo10/odoo10.conf

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

[options]
addons_path = /opt/odoo/odoo10/odoo/addons,/opt/odoo/odoo10/addons
admin_passwd = admin
csv_internal_sep = ,
data_dir = /home/odoo10/.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 = .*
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
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,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 = 8089

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

To allow odoo10 to access the configration file:

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

Create Unit Service file

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

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

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

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

[Install]
Alias=odoo10.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 odoo10

Now, start your Odoo 10 using systemd:

sudo systemctl start odoo10

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

To stop it, just run:

sudo systemctl stop odoo10

Leave a Reply