Skip to Content

Odoo Installation - Odoo 17/18 - Debian 12 Server - PostgreSQL 17 - NGINX

27 February 2025 by
Odoo Installation - Odoo 17/18 - Debian 12 Server - PostgreSQL 17 - NGINX
Geo Jose C
| No comments yet

This guide will walk you through installing Odoo on a Debian 12 server using PostgreSQL 17 and NGINX. We cover server preparation, package installations, configuring essential files, and setting up the Odoo service.

1. Prepare Your Server

Update your system, upgrade packages, and clean up unnecessary files:

sudo apt update -y && 
sudo apt upgrade -y -f &&
sudo apt autoremove -y -f &&
sudo apt install -y -f &&
sudo dpkg --configure -a

2. Install Required Packages

Install necessary packages including Python dependencies, development tools, and libraries:

sudo apt install -y -f \
python3 python3-dev python3-venv python3-pip python3-setuptools python3-wheel python3-pandas python3-cffi python3-certbot-nginx build-essential \
libzip-dev libxslt1-dev libxslt-dev libldap2-dev libsasl2-dev libjpeg-dev libpng-dev libpq-dev libfreetype6-dev libffi-dev \
fail2ban xfonts-75dpi xfonts-100dpi xfonts-base fontconfig cargo git wget certbot zip unzip htop ufw nginx tuned ncdu nodejs node-less npm

3. Set Up NPM

Install the RTL CSS package globally (useful if you plan to use right-to-left themes):

sudo npm install -g rtlcss && 
sudo npm fund -y

4. Install PostgreSQL 17

Add the PostgreSQL repository and install PostgreSQL 17:

sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' &&
sudo wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - &&
sudo apt update && 
sudo apt install -y -f postgresql-17

5. Install wkhtmltopdf

Odoo uses wkhtmltopdf to generate PDF reports. Download and install the appropriate package:

sudo wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.bookworm_amd64.deb &&
sudo wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.jammy_amd64.deb &&
sudo dpkg -i wkhtmltox_0.12.6.1-3.bookworm_amd64.deb || sudo dpkg -i wkhtmltox_0.12.6.1-3.jammy_amd64.deb &&
sudo rm -rf wkhtmltox_0.12.6.1-3.bookworm_amd64.deb wkhtmltox_0.12.6.1-3.jammy_amd64.deb &&
sudo wkhtmltopdf --version

6. Install Python Packages

Upgrade Python packaging tools and install required Python packages. (For Odoo 18, update the requirements URL accordingly.)

sudo pip3 install --upgrade --ignore-installed --no-cache --break-system-packages setuptools wheel &&
sudo pip3 install --upgrade --ignore-installed --no-cache --break-system-packages asana openpyxl pyzk gdown numpy_utils phonenumbers PyJWT google_auth num2words ofxparse dbfread ebaysdk firebase_admin pdfminer.six qrcode email_validator pyOpenSSL dropbox pyncclient boto3 nextcloud-api-wrapper paramiko astor &&
sudo pip3 install --upgrade --ignore-installed --no-cache --break-system-packages -r https://github.com/odoo/odoo/raw/17.0/requirements.txt &&
sudo pip3 install --upgrade --ignore-installed --no-cache --break-system-packages cryptography==38.0.4 blosc2==2.3.0 numpy==1.26.4 plotly==5.22.0

7. Configure PostgreSQL User for Odoo

Create a dedicated PostgreSQL user for Odoo and grant it database creation privileges:

sudo -u postgres psql -c "DROP USER IF EXISTS odoo;" &&
sudo -u postgres psql -c "CREATE USER odoo WITH PASSWORD 'password123$';" &&
sudo -u postgres psql -c "ALTER USER odoo WITH CREATEDB;"

Replace 'password123$' with a strong password for production environments.

8. Create Required Directories

Create directories for Odoo’s addons, configuration files, filestore, logs, and NGINX configuration:

sudo mkdir -p /opt/addons /opt/config /opt/filestore /opt/log /opt/nginx

9. Clone the Odoo and Themes Repositories

Clone the official Odoo source code from GitHub. For Odoo 18, change the branch from “17.0” to “18.0”:

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

Clone the official design themes:

sudo git clone https://github.com/odoo/design-themes.git --branch 17.0 /opt/themes

For Odoo 18, replace --branch 17.0 with --branch 18.0 in both commands.

10. Secure Your Site with Certbot

Obtain SSL certificates using Certbot. Replace *.example.com and the email with your domain and contact information:

sudo certbot run --non-interactive --agree-tos --nginx --email mail@josecgeo.com -d *.example.com

11. Configure the Odoo Configuration File

Create and configure the Odoo configuration file (commonly odoo.conf). For example, create the file at /opt/config/odoo.conf with the following sample content:

[options]
; Admin password for managing databases
admin_passwd = superadminpassword
; Database connection settings
db_host = False
db_port = False
db_user = odoo
db_password = password123$
; Addons paths – adjust paths if necessary
addons_path = /opt/odoo17/addons,/opt/addons,/opt/themes
; Log file location
logfile = /opt/log/odoo.log

Make sure to replace superadminpassword and password123$ with secure values.

12. Configure NGINX for Odoo

Create an NGINX server block to act as a reverse proxy for Odoo. For instance, create a file at /etc/nginx/sites-available/odoo with this content:

server {
    listen 80;
    server_name odoo.example.com;
    access_log /var/log/nginx/odoo.access.log;
    error_log /var/log/nginx/odoo.error.log;

    # Increase proxy buffers
    proxy_buffers 16 64k;
    proxy_buffer_size 128k;

    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;
    }
}

After creating the file, enable the configuration (e.g., by linking it to /etc/nginx/sites-enabled/) and reload NGINX. Change the highlighted part to your domain name.

13. Set Up Odoo as a Systemd Service

Create a systemd service file to manage the Odoo server. For example, create the file at /etc/systemd/system/odoo.service with the following content:

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

[Service]
Type=simple
User=odoo
Group=odoo
ExecStart=/usr/bin/python3 /opt/odoo17/odoo-bin -c /opt/config/odoo.conf
Restart=always

[Install]
WantedBy=multi-user.target

Reload the systemd daemon and start the Odoo service:

sudo systemctl daemon-reload
sudo systemctl enable odoo
sudo systemctl start odoo

Congratulations! You now have a fully configured Odoo installation on your Debian 12 server with PostgreSQL 17 and NGINX. Adjust the branch names and configuration values as needed for your environment.

Odoo Installation - Odoo 17/18 - Debian 12 Server - PostgreSQL 17 - NGINX
Geo Jose C 27 February 2025
Share this post
Sign in to leave a comment