Odoo 13 CE User Interface

Install and Deploy Odoo 14 on Ubuntu 22.04 Server

In this post, I will guide you through the 6 detailed steps to install Odoo 14 running with Python 3.8 and PostgreSQL 12 on a single Ubuntu 22.04 Server.

WARNING: Odoo 14 does NOT support Python 3.10. It’s safe to go with Python 3.7 and Python 3.8!

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

After completion of the installation, we expect to achieve the following:

  1. A single instance of Odoo 14 running with Python 3.8:
    • Running Unix User: odoo14
    • PostgreSQL version: 12
    • HTTP port: 8089, so that users can access it with a web browser with an address like http://your_ip:8089
  2. The Odoo 14 instance will run as a service with autostart.
  3. The instance will also be isolated in a dedicated environment
  4. It will also be set with a secured master password to protect their database. Users having master password will be able to create/delete/backup/restore databases

Step1 – Create Odoo Running Users and Group

For security, we should run Odoo instances under separate Linux user accounts that have the following specifications:

  1. Unix User and Group:
    • Account Name: odoo14
    • Account Group: odoo
    • Home Directory: /home/odoo14
  2. The account odoo14 will not be able to login for security purpose and should also be a system account under which daemons and other processes could run;

Create Unix group

Run the following command to create the group odoo:

sudo addgroup odoo

Create Unix User Account

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

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

Step 2 – Install PostgreSQL 12

I have not fully tested Odoo 14 with the PostgreSQL 14 that comes fresh with Ubuntu 22.04 but I believe it should work. However, as discussed in the section Executive Summary, we are going to install PostgreSQL 12. If you want to test with other versions of PostgreSQL, you can follow another post of mine 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 first:

# 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 12

sudo apt install postgresql-12

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 cluster will be 5432.

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

Create Database Role

In this section, we will create a database SQL role having the same name as the unix account’s so that Odoo 14 will be able to authenticate the PosgreSQL using ident method (without using password):

sudo -u postgres createuser odoo14 --interactive

Please note that if your PostgreSQL cluster listened on a port other than 5432, you will have to specify the port by using -p option. The command should be:

sudo -u postgres createuser odoo14 --interactive -p <your_port_number>

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

Create role odoo14 in PostgreSQL 12
Create role odoo14 in PostgreSQL 12

Step 3 – Download Odoo 14 source code from GitHub

In this section, we will download the Odoo 14 source code from GitHub and implement security policy for read access for the users in the group odoo.

To download the source code of Odoo 14 from GitHub, just run the command below to clone it using git over HTTP:

git clone -b 14.0 https://github.com/odoo/odoo.git /opt/odoo/odoo14

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

git clone -b 14.0 git@github.com:odoo/odoo.git /opt/odoo/odoo14

Depending on your internet connection speed, the process may take a few minutes or more. Please be patient or open another session to work for the next step of installing Python 3.8 in the meantime.

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

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

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

Step 4 – Install Python 3.8

Odoo 14 supports Python 3.7 and 3.8 officially. However, the Python version comes fresh with Ubuntu 22.04 is 3.10 so we need to install Python 3.7 and 3.8 manually ourselves. As for the scope of this post, we are going to install Python 3.8 only. If you want Python 3.7, the process is similar. Or your can follow the instructions on how to install multiple versions of Python if you want to have both. Let’s go for Python 3.8 now:

Add Deadsnakes PPA

sudo add-apt-repository ppa:deadsnakes/ppa

Install Python 3.8 and its Virtual Environment tool

As we need to create an isolated Python environment for Odoo 14 to run to avoid to break existing things, we need to install Python Virtual Environment Tool also. Here is the command to install both Python 3.8 and its virtual environment tool:

sudo apt install python3.8 python3.8-venv

Now, run the command below to verify if Python 3.8 is properly installed:

python3.8 -V

Then you should see output as below:

Verify if Python 3.8 is properly installed
Verify if Python 3.8 is properly installed

Step 5 – Install Odoo 14

Prerequisites

Install Ubuntu software and packages that are required to run Odoo 14 later:

sudo apt install python3.8-dev \
build-essential libsass-dev libjpeg-dev \
libjpeg8-dev libldap-dev libldap2-dev \
libpq-dev libsasl2-dev libxslt1-dev \
zlib1g-dev

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 -y

Install Odoo 14 with Python 3.8 and PostgreSQL 12

Create Odoo 14 Python 3.8 Virtual Environment

Create parent folders for Odoo 14 with Python 3.8 virtual environment:

sudo mkdir -p /python-venv/3.8/odoo14

Secure the virtual environment:

sudo chown -hR odoo14:odoo /python-venv/3.8/odoo14

Switch the current account to odoo14 with bash support:

sudo su - odoo14 -s /bin/bash

Create virtual environment:

python3.8 -m venv /python-venv/3.8/odoo14

Install required Python libraries for Odoo 14

Activate the virtual environment we’ve created in the above:

source /python-venv/3.8/odoo14/bin/activate

As usual, we need to upgrade pip to its latest version for the activated environment first:

pip install --upgrade pip

Now, start installing libraries required by Odoo 14 for the virtual environment. Please make sure you have finished cloning Odoo 14 source code.

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

Start Odoo 14

Now, we can start Odoo 14 in the virtual environment by running the following command that connects PostgreSQL on port 5432 and offers HTTP port 8089 for the client to access:

/opt/odoo/odoo14/odoo-bin --http-port=8089

If your PostgreSQL cluster listened on another port other than 5432, your command should be:

/opt/odoo/odoo14/odoo-bin --db_port=<your_db_port> --http-port=8089

You should see the output as below in the terminal:

Start Odoo 14 with Python 3.8 and PostgreSQL 12 from Command Line Interface
Start Odoo 14 with Python 3.8 and PostgreSQL 12 from Command Line Interface

Now, you can open your browser and input the address like http://your_id:8089 to see the Odoo 14 Database Creator/Selector User Interface as below:

Odoo 14 Database Creator/Selector User Interface
Odoo 14 Database Creator/Selector User Interface

Now, you can input database name, email, etc then hit the button Create database to initilize your first database for your Odoo 14 instance.

You can also input a secured master password at the first time and use it for the later instead of using the default suggestion which is hard to remember. Or, you can set it later in your Odoo configuration file.

Stop Odoo 14 and Exit

To stop the Odoo 14, just get back to the terminal and hit Ctrl+C twice.

Deactivate Virtual Environment

deactivate

Get back to the previous unix user account:

exit

Step 6 – Run Odoo 14 as service / daemon

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

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

sudo nano /home/odoo14/odoo14.conf

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

[options]
addons_path = /opt/odoo/odoo14/odoo/addons,/opt/odoo/odoo14/addons
admin_passwd = admin
csv_internal_sep = ,
data_dir = /home/odoo14/.local/share/Odoo
db_host = False
db_maxconn = 64
db_name = False
db_password = False
db_port = False
db_sslmode = prefer
db_template = template0
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 =
longpolling_port = 8090
max_cron_threads = 2
osv_memory_age_limit = False
osv_memory_count_limit = False
pg_path =
pidfile =
proxy_mode = False
reportgz = False
screencasts =
screenshots = /tmp/odoo_tests
server_wide_modules = base,web
smtp_password = False
smtp_port = 25
smtp_server = localhost
smtp_ssl = False
smtp_user = False
syslog = False
test_enable = False
test_file =
test_tags = None
transient_age_limit = 1.0
translate_modules = ['all']
unaccent = False
upgrade_path =
without_demo = False
workers = 0

Please note that the master password to secure your instance is controled by the directive admin_passwd in the configuration file. You should change it to a strong password. You can also start tuning the instance by modifying other directives. After everything is fine for you, you save the file and exit by hitting Ctrl+X then input y and hit Enter button.

To allow the account odoo14 to access the configration file while keep it secured againts others:

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

Create Unit Service file

I am using nano text editor again to create the file by running the command below:

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

Then copy and pasted the following in your nano text editor UI:

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

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

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

To save the file and exit, just press Ctrl+X then input y and hit Enter button.

Now, run the following command to notify systemd that a new service unit file exists:

sudo systemctl daemon-reload

To enable the service and set it to run on boot:

sudo systemctl enable --now odoo14

Now, start your Odoo 14 using systemd:

sudo systemctl start odoo14

Let’s open your web browser and input the address https://your_ip:8089 to see the Odoo 14 Database Creation User Interface.

To stop it, just run:

sudo systemctl stop odoo14

Leave a Reply