Odoo ERP Automation Manufacturing Odoo Development Custom Odoo Modules Business Automation

Odoo 18 Server Setup: Complete Step-by-Step Guide (Ubuntu)

Learn how to install and configure Odoo 18 on an Ubuntu server with PostgreSQL, systemd, and Nginx. A production-ready setup guide.

7 min read

Prerequisites

Before starting, make sure you have:

Requirement Minimum Recommended
OS Ubuntu 22.04 LTS Ubuntu 24.04 LTS
RAM 2 GB 4 GB+
CPU 2 vCPU 4 vCPU
Disk Space 20 GB 50 GB+
Python 3.10+ 3.12
PostgreSQL 14+ 16

⚠️ Note: You need root or sudo access to the server.


1. System Update

Start by updating your system packages to the latest versions.

sudo apt update && sudo apt upgrade -y
sudo apt install -y curl wget gnupg2 software-properties-common

Figure 1: Running system update on Ubuntu Server


2. Install Dependencies

Install all the required system dependencies for Odoo 18.

sudo apt install -y \
    git \
    python3-pip \
    python3-dev \
    python3-venv \
    python3-wheel \
    libxml2-dev \
    libxslt1-dev \
    libldap2-dev \
    libsasl2-dev \
    libssl-dev \
    libjpeg-dev \
    libpq-dev \
    libffi-dev \
    build-essential \
    node-less \
    npm \
    xfonts-75dpi \
    xfonts-base \
    fontconfig \
    libfreetype6 \
    libx11-6 \
    libxext6 \
    libxrender1

Install wkhtmltopdf (for PDF Reports)

Odoo uses wkhtmltopdf to generate PDF reports.

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.jammy_amd64.deb
sudo apt install -f -y

Verify installation:

wkhtmltopdf --version

Expected output:

wkhtmltopdf 0.12.6.1 (with patched qt)

3. Create Odoo User

For security, Odoo should run under a dedicated system user.

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

This creates:

  • A system user named odoo
  • Home directory at /opt/odoo
  • No login shell (for security)

4. Install PostgreSQL

Odoo requires PostgreSQL as its database backend.

# Add PostgreSQL APT repository
sudo sh -c 'echo "deb https://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget -qO- https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo tee /etc/apt/trusted.gpg.d/pgdg.asc

# Install PostgreSQL 16
sudo apt update
sudo apt install -y postgresql-16 postgresql-client-16

Configure PostgreSQL

# Start and enable PostgreSQL
sudo systemctl start postgresql
sudo systemctl enable postgresql

# Create Odoo database user
sudo -u postgres createuser -s odoo

Verify PostgreSQL is running:

sudo systemctl status postgresql
● postgresql.service - PostgreSQL RDBMS
     Loaded: loaded (/lib/systemd/system/postgresql.service; enabled)
     Active: active (running) since ...

5. Install Python & Virtual Environment

Odoo 18 requires Python 3.10 or newer.

# Check Python version
python3 --version

# Switch to the odoo user
sudo su - odoo

# Create a virtual environment
python3 -m venv /opt/odoo/venv

# Activate it
source /opt/odoo/venv/bin/activate

# Upgrade pip
pip install --upgrade pip setuptools wheel

6. Install Odoo 18

Option A: Clone from GitHub (Community Edition)

# As the odoo user
sudo su - odoo

# Clone Odoo 18 source code
git clone https://www.github.com/odoo/odoo --depth 1 \
    --branch 18.0 /opt/odoo/odoo18

# Activate virtual environment
source /opt/odoo/venv/bin/activate

# Install Python dependencies
pip install -r /opt/odoo/odoo18/requirements.txt

🕐 This step may take 5–15 minutes depending on your server speed.

Option B: Install via Deb Package

# Add Odoo repository
wget -O - https://nightly.odoo.com/odoo.key | sudo gpg --dearmor -o /usr/share/keyrings/odoo-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/odoo-archive-keyring.gpg] https://nightly.odoo.com/18.0/nightly/deb/ ./" | sudo tee /etc/apt/sources.list.d/odoo.list

sudo apt update
sudo apt install odoo -y

7. Configure Odoo

Create the Odoo configuration file.

sudo mkdir -p /etc/odoo
sudo nano /etc/odoo/odoo18.conf

Paste the following configuration:

[options]
; Odoo 18 Configuration File

; Database settings
db_host = False
db_port = False
db_user = odoo
db_password = False

; Server settings
http_port = 8069
logfile = /var/log/odoo/odoo18.log
log_level = info

; Addons path
addons_path = /opt/odoo/odoo18/addons,/opt/odoo/custom_addons

; Performance settings
workers = 4
max_cron_threads = 2
limit_memory_hard = 2684354560
limit_memory_soft = 2147483648
limit_request = 8192
limit_time_cpu = 600
limit_time_real = 1200

; Security
admin_passwd = your_strong_master_password_here
list_db = False

⚠️ Security: Change admin_passwd to a strong, unique password!

Create Log Directory

sudo mkdir -p /var/log/odoo
sudo chown odoo:odoo /var/log/odoo
sudo chmod 750 /var/log/odoo

Create Custom Addons Directory

sudo mkdir -p /opt/odoo/custom_addons
sudo chown -R odoo:odoo /opt/odoo/custom_addons

8. Create Systemd Service

Create a systemd service so Odoo starts automatically on boot.

sudo nano /etc/systemd/system/odoo18.service
[Unit]
Description=Odoo 18.0
Documentation=http://www.odoo.com
After=network.target postgresql.service

[Service]
Type=simple
SyslogIdentifier=odoo18
PermissionsStartOnly=true
User=odoo
Group=odoo

ExecStart=/opt/odoo/venv/bin/python3 /opt/odoo/odoo18/odoo-bin \
    -c /etc/odoo/odoo18.conf

StandardOutput=journal+console
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target

Enable and Start the Service

# Reload systemd daemon
sudo systemctl daemon-reload

# Enable Odoo to start on boot
sudo systemctl enable odoo18

# Start Odoo
sudo systemctl start odoo18

# Check status
sudo systemctl status odoo18

You should see output like:

● odoo18.service - Odoo 18.0
     Loaded: loaded (/etc/systemd/system/odoo18.service; enabled)
     Active: active (running) since Mon 2026-04-01 10:00:00 UTC; 5s ago

9. Configure Nginx Reverse Proxy

Use Nginx as a reverse proxy in front of Odoo for better performance and SSL support.

sudo apt install -y nginx

Create the Nginx configuration:

sudo nano /etc/nginx/sites-available/odoo18
#------------------------------------------------------------
# Odoo 18 Nginx Reverse Proxy Configuration
#------------------------------------------------------------

upstream odoo {
    server 127.0.0.1:8069;
}

upstream odoochat {
    server 127.0.0.1:8072;
}

# Redirect HTTP to HTTPS
server {
    listen 80;
    server_name your-domain.com www.your-domain.com;
    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2;
    server_name your-domain.com www.your-domain.com;

    # SSL certificates (configured by Certbot)
    ssl_certificate /etc/letsencrypt/live/your-domain.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/your-domain.com/privkey.pem;

    # Security headers
    add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
    add_header X-Content-Type-Options nosniff;
    add_header X-Frame-Options SAMEORIGIN;

    # Proxy settings
    proxy_read_timeout 720s;
    proxy_connect_timeout 720s;
    proxy_send_timeout 720s;

    # Websocket for live chat
    location /websocket {
        proxy_pass http://odoochat;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "Upgrade";
        proxy_set_header X-Forwarded-Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
    }

    # Main proxy
    location / {
        proxy_pass http://odoo;
        proxy_set_header X-Forwarded-Host $http_host;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_redirect off;
    }

    # Static files caching
    location ~* /web/static/ {
        proxy_cache_valid 200 90m;
        proxy_buffering on;
        expires 864000;
        proxy_pass http://odoo;
    }

    # Gzip compression
    gzip on;
    gzip_types text/css text/less text/plain text/xml application/xml
               application/json application/javascript;
    gzip_min_length 1000;
    client_max_body_size 200M;
}

Enable the site:

sudo ln -s /etc/nginx/sites-available/odoo18 /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx

10. SSL with Let's Encrypt

Secure your Odoo installation with a free SSL certificate.

# Install Certbot
sudo apt install -y certbot python3-certbot-nginx

# Obtain SSL certificate
sudo certbot --nginx -d your-domain.com -d www.your-domain.com

# Auto-renewal (already configured by Certbot)
sudo systemctl status certbot.timer

11. Access Odoo

Once everything is configured, open your browser and navigate to:

https://your-domain.com

Or if accessing locally:

http://YOUR_SERVER_IP:8069

First-Time Setup

You will see the Odoo Database Manager screen.

Fill in the following details:

Field Description
Master Password The admin_passwd from your config
Database Name e.g., my_company_db
Email Admin email address
Password Admin user password
Language Select your language
Country Select your country
Demo Data Check only for testing

Click Create Database and wait for Odoo to initialize.

🎉 After setup completes, you'll be redirected to your new Odoo 18 instance!


Useful Management Commands

# Start Odoo
sudo systemctl start odoo18

# Stop Odoo
sudo systemctl stop odoo18

# Restart Odoo
sudo systemctl restart odoo18

# View logs in real time
sudo journalctl -u odoo18 -f

# View Odoo log file
sudo tail -f /var/log/odoo/odoo18.log

# Update a specific module
sudo -u odoo /opt/odoo/venv/bin/python3 /opt/odoo/odoo18/odoo-bin \
    -c /etc/odoo/odoo18.conf \
    -d your_database \
    -u module_name \
    --stop-after-init

Troubleshooting

❌ Odoo fails to start

# Check detailed error logs
sudo journalctl -u odoo18 --no-pager -n 50

❌ PostgreSQL connection refused

# Verify PostgreSQL is running
sudo systemctl status postgresql

# Check the odoo user exists in PostgreSQL
sudo -u postgres psql -c "\du"

❌ Port 8069 not accessible

# Check if Odoo is listening
ss -tlnp | grep 8069

# Check firewall rules
sudo ufw status
sudo ufw allow 8069/tcp

❌ wkhtmltopdf errors in PDF reports

# Test wkhtmltopdf
wkhtmltopdf --version

# Reinstall if broken
sudo apt remove wkhtmltopdf -y
sudo dpkg -i wkhtmltox_0.12.6.1-3.jammy_amd64.deb

❌ Missing Python modules

source /opt/odoo/venv/bin/activate
pip install -r /opt/odoo/odoo18/requirements.txt

🔐 Security Hardening Checklist

  • Change the default admin_passwd in odoo18.conf
  • Set list_db = False to hide database list
  • Enable UFW firewall: sudo ufw enable
  • Allow only SSH, HTTP, HTTPS: sudo ufw allow 22,80,443/tcp
  • Block direct port 8069 access from outside
  • Set up regular PostgreSQL backups
  • Enable automatic security updates
  • Use strong passwords for all accounts

Found this helpful?

We write about what we build. If you need similar solutions for your business, let's talk.