Skip to Content

Install Odoo 18 CE on Debian 12


Odoo is an open-source enterprise management solution that offers a wide range of applications for business management. In this article, we will show you how to install Odoo 18 on a Debian 12 server, from installing dependencies to setting up a reverse proxy to access Odoo via a secure HTTPS domain.

Prerequisites​

Before starting the installation, make sure you have a clean installation of Debian 12 with administrative access. This guide also assumes that you have SSH access to your server.

1. Update your system

The first step is to ensure that your system is up to date. Run the following commands to update all installed packages on your Debian 12 system.

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

This ensures that your system has the latest versions of software and security patches.

2. Configure the firewall with UFW

Security is paramount, which is why we will set up a simple firewall using UFW (Uncomplicated Firewall). Follow the steps below:

Installation of UFW

sudo apt install ufw

Allow SSH connections

sudo ufw allow OpenSSH sudo ufw enable

Allow HTTP and HTTPS connections

sudo ufw allow "WWW Full" sudo ufw reload

Firewall status check

sudo ufw status

This ensures that the firewall is active and that the necessary connections (SSH, HTTP, HTTPS) are allowed.

3. Installation of necessary dependencies

Odoo 18 requires Python 3.11, which is already included in Debian 12. We will now install all the necessary dependencies for Odoo, including libraries for graphics, compression, and connections to the PostgreSQL database.

sudo apt install build-essential wget git python3.11-dev python3.11-venv \ libfreetype-dev libxml2-dev libzip-dev libsasl2-dev \ node-less libjpeg-dev zlib1g-dev libpq-dev \ libxslt1-dev libldap2-dev libtiff5-dev libopenjp2-7-dev libcap-dev

These packages are necessary for Odoo to function optimally.

4. Create a system user for Odoo

It is recommended to create a dedicated user to run Odoo in order to avoid conflicts with other system processes. Run the following command to add a user:

sudo useradd -m -d /opt/odoo18 -Urs /bin/bash odoo18

This creates a user named odoo18 with a home directory located at /opt/odoo18.

5. Installation of PostgreSQL

Odoo works with PostgreSQL for database management. Debian 12 includes PostgreSQL in its official repositories, so installation is straightforward.

sudo apt install postgresql

Next, we need to create a PostgreSQL user for Odoo with the same name as the system user:

sudo su - postgres -c "createuser -s odoo18"

6. Installation of wkhtmltopdf

Odoo uses wkhtmltopdf to generate PDF reports from HTML pages. The version of wkhtmltopdf available for Debian 12 is not directly compatible, so we will install a patched version.

wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb sudo apt install ./libssl1.1_1.1.1f-1ubuntu2_amd64.deb wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.bullseye_amd64.deb sudo apt install ./wkhtmltox_0.12.6.1-2.bullseye_amd64.deb

If you encounter a problem with the installation, you can try running:

sudo apt install -f

7. Odoo Installation

We will now install Odoo in a virtual Python environment. Start by logging in as the user odoo18:

sudo su - odoo18

Clone the GitHub repository of Odoo 18:

git clone https://www.github.com/odoo/odoo --depth 1 --branch 18.0 odoo18

Then, create a Python virtual environment and activate it:

python3.11 -m venv odoo18-venv source odoo18-venv/bin/activate

Install the necessary Python dependencies for Odoo:

pip install wheel setuptools pip --upgrade pip install -r odoo18/requirements.txt

pip install phonenumbers

Once the installation is complete, you can create a directory for Odoo's custom modules:

mkdir /opt/odoo18/odoo18/custom-addons

Then log out of the odoo18 user to create the Odoo configuration file:

exit

8. Create the Odoo configuration file

Create a configuration file for Odoo in /etc/odoo18.conf:

sudo nano /etc/odoo18.conf

Add the following content to the file:

[options] admin_passwd = m0d1fyth15 db_host = False db_port = False db_user = odoo18 db_password = False addons_path = /opt/odoo18/odoo18/addons,/opt/odoo18/odoo18/custom-addons

Replace passwordchangeme with a more secure password.

9. Create a systemd service file for Odoo​

To manage Odoo as a service, we need to create a systemd unit file. Run the following command:

sudo systemctl edit odoo18 --force --full

Add the following content to configure Odoo as a service:

[Unit] Description=odoo18 Requires=postgresql.service After=network.target postgresql.service [Service] Type=simple SyslogIdentifier=odoo18 PermissionsStartOnly=true User=odoo18 Group=odoo18 ExecStart=/opt/odoo18/odoo18-venv/bin/python3 /opt/odoo18/odoo18/odoo-bin -c /etc/odoo18.conf StandardOutput=journal+console [Install] WantedBy=multi-user.target

Then reload the systemd service and enable Odoo:

sudo systemctl daemon-reload sudo systemctl enable --now odoo18

Check if Odoo works with:

sudo systemctl status odoo18

You can now access Odoo by going to http://your_server_ip:8069.

10. Install and configure a reverse proxy with Nginx

To access Odoo via a domain name, we need to configure a reverse proxy with Nginx. Start by installing Nginx:

sudo apt install nginx

Then, create an Nginx server block for Odoo:

sudo nano /etc/nginx/conf.d/odoo.conf

Add the following configuration:

server { listen 80; server_name yourdomain.com; location / { proxy_pass http://127.0.0.1:8069; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; } }

Restart Nginx to apply the changes:

sudo systemctl restart nginx

11. Secure with SSL via Certbot

Finally, to secure your site with HTTPS, install Certbot and obtain an SSL certificate:

sudo apt install certbot python3-certbot-nginx sudo certbot --nginx --agree-tos --redirect --hsts --staple-ocsp --email votre_email@example.com -d yourdomain.com

Certbot will automatically configure HTTPS for your domain.

Congratulations, you have now installed Odoo 18 on Debian 12, secured your site with SSL, and configured a Nginx reverse proxy to access Odoo via a domain name.


Rating
1 0

There are no comments for now.

to be the first to leave a comment.