Knowledgebase

Question About Servers

How to Install Odoo 17 on Ubuntu 23.04 Print

  • 0

This article will guide you through the installation and configuration process of Odoo 17 in an Ubuntu 23.04 system.

Prerequisites

OS: Ubuntu 23.04 with Python >= 3.10

Resources: 2-core CPU & 2GB of RAM

Access: SSH connection to the server

Permissions: a user with 'sudo' privileges

Note: you can execute all of the commands below from the root user, but for security purposes, it is recommended that you use a separate user with sudo privileges.

Step 1: Log in to the Ubuntu server via SSH as the root user:

The first step in the installation is to connect to your server via ssh. You can log in to the server using ssh.

ssh username@IP_Address -p Port_number
e.g. ssh root@127.0.0.1 -p 22

Step 2: Update Packages

Then let’s update existing Ubuntu packages and upgrade them to newer versions. The following commands will help you.

sudo apt-get update
sudo apt-get upgrade -y

Step 3: Create an Odoo user.

Create a new user called odoo17 with home directory /opt/odoo17. This prevents the security risks posed by running Odoo under the root user. You can do it with this command. You can give any name to the user. However, be careful to create a PostgreSQL user with the same name.

sudo useradd -m -d /opt/odoo17 -U -r -s /bin/bash odoo17

Step 4: Install Dependencies

Since Odoo is built on Python, we need to install some dependencies to proceed with installing Odoo 17 on our Ubuntu 23.04 system. We can install them by running the commands below.

sudo apt install -y git python3-pip python-dev python3-dev libxml2-dev libxslt1-dev zlib1g-dev libsasl2-dev libldap2-dev build-essential libssl-dev libffi-dev libmysqlclient-dev libjpeg-dev libpq-dev libjpeg8-dev liblcms2-dev libblas-dev libatlas-base-dev

sudo apt install -y npm

sudo ln -s /usr/bin/nodejs /usr/bin/node

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

sudo apt-get install -y node-less

Step 5: Install and configure PostgreSQL

In this step, you need to set up the database server. Odoo uses PostgreSQL as the database back-end. Install the database server for Odoo By using the following command.

sudo apt install postgresql -y

Now you need to create a PostgreSQL user for the handling of the database server i.e. PostgreSQL.  In our case, we will create a PostgreSQL user with the same name as the previously created system user i.e odoo17

sudo su - postgres

createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo17
The user and the password are needed for the conf file. Postgres uses a distinct system user to perform tasks. To switch between users, run sudo su -postgres. Next, create a database user for Odoo 17.
psql
ALTER USER odoo17 WITH SUPERUSER;
If the user runs the aforementioned command, superuser access rights will be guaranteed. Next, log out of Postgres and PSQL.
\q
exit

Step 6: Install Wkhtmltopdf

For printing-related purposes, Odoo 17 requires a wkhtmltopdf version higher than 0.12.2. Wkhtmltopdf is an open-source command line tool to render HTML data into PDF format using Qt webkit. To install wkhtmltopdf on your Ubuntu 23.04 server, follow the steps below.

sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb

sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb

sudo apt install -f

Step 7: Install Odoo

In Ubuntu 23.04, we can install Odoo from the default Ubuntu repository, but this will install Odoo version 17. In this article, we will install Odoo 17 under a python virtual environment. We created a system user earlier in this article; let’s switch to system user ‘odoo17’ and then install Odoo under that username.

sudo su - odoo17

The command above should bring you to /opt/odoo17 and log you in as user ‘odoo17’. Now, download Odoo from Github.

git clone https://www.github.com/odoo/odoo --depth 1 --branch 17.0 odoo17

Execute the following command to create a new python virtual environment.

python3 -m venv odoo17-venv

The virtual environment is now installed; it is time to activate it by running this command.

source odoo17-venv/bin/activate

Once executed, your shell prompt would look like this:

(odoo17-venv) odoo17@ubuntu23:~$

Next, let’s install Odoo

(odoo17-venv) odoo17@ubuntu23:~$ pip3 install wheel
(odoo17-venv) odoo17@ubuntu23:~$ pip3 install -r odoo17/requirements.txt

Once Odoo installation is completed, we can create a new directory to store our custom Odoo add-ons.

(odoo17-venv) odoo17@ubuntu23:~$ deactivate

Step 8: Create a directory for the 3rd party addons:

We’ll create a new directory a separate directory for the 3rd party addons.

mkdir /opt/odoo17/odoo17/custom-addons

This directory should later be added to the addons_path parameter that defines a list of directories where Odoo searches for modules. After this step, we will switch back to the sudo user using this command.

exit

Step 9: Create a configuration file for the Odoo Installation

The command below allows you to create and edit a *.conf file.

sudo nano /etc/odoo17.conf

Add the following configuration information to the file. 

Note: Remember to change the admin_passwd to something more secure.

[options]
admin_passwd = admin_passwd
db_host = False
db_port = False
db_user = odoo17
db_password = False
addons_path = /opt/odoo17/odoo17/addons,/opt/odoo17/odoo17/custom-addons
xmlrpc_port = 8069

Step 10: Create Odoo Systemd Unit file

In this step, we will create a systemd unit file. It is required to start/stop/restart Odoo.

sudo nano /etc/systemd/system/odoo17.service

Paste the following content into the systemd unit file above.

[Unit]
Description=Odoo17
Requires=postgresql.service
After=network.target postgresql.service

[Service]
Type=simple
SyslogIdentifier=odoo17
PermissionsStartOnly=true
User=odoo17
Group=odoo17
ExecStart=/opt/odoo17/odoo17-venv/bin/python3 /opt/odoo17/odoo17/odoo-bin -c /etc/odoo17.conf
StandardOutput=journal+console

[Install]
WantedBy=multi-user.target

With the next command, we notify systemd that the new file exists and reload the daemon.

sudo systemctl daemon-reload

Next, we start the Odoo service and enable it to run on system boot.

sudo systemctl enable --now odoo17

Now we check if the service is running.

sudo systemctl status odoo17

You should get the following output.

● odoo17.service - Odoo17
     Loaded: loaded (/etc/systemd/system/odoo17.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2024-11-04 07:42:33 UTC; 28s ago
...

This next command will allow you to check on the messages logged by the odoo17 service.

sudo journalctl -u odoo17

Step 11: Testing the Odoo Installation

On your browser, type: http://<your_domain_or_IP_address>:8069

If the installation was successful, you'll see the start page for Odoo 17. 

Congratulations! You have successfully installed Odoo 17 on Ubuntu 23.04


Was this answer helpful?

« Back

Enterprise-Grade Hardware

  • Samsung
  • Juniper
  • Western Digital
  • Supermicro
  • LSI
  • Intel
  • R1Soft Backups
  • cPanel
  • MySQL
  • Parallels
  • HP Partner