🚀 Install Odoo 18 on Ubuntu 24.04

Complete guide with Nginx reverse proxy & free SSL certificate

May 16, 2025 20 min read Tutorial Intermediate

Odoo 18 brings significant improvements in performance, UI, and AI features. This guide will walk you through installing Odoo 18 on Ubuntu 24.04 LTS using a Python virtual environment, with Nginx as a reverse proxy and free SSL from Let's Encrypt.

📋 Prerequisites:
  • Ubuntu 24.04 server (minimum 2GB RAM, 20GB storage)
  • Domain name pointing to your server (for SSL)
  • Root or sudo access
  • Open ports: 80, 443, and 22 (SSH)

1. Update System & Install Dependencies

sudo apt update && sudo apt upgrade -y
sudo apt install -y git python3-pip python3-dev python3-venv \
    build-essential libssl-dev libffi-dev libxml2-dev libxslt1-dev \
    zlib1g-dev libjpeg-dev libldap2-dev libsasl2-dev libpq-dev \
    libfreetype6-dev liblcms2-dev libopenjp2-7-dev libtiff5-dev \
    libwebp-dev libharfbuzz-dev libfribidi-dev libxcb1-dev \
    wget curl node-less npm postgresql postgresql-server-dev-all

2. Install wkhtmltopdf (for PDF Reports)

sudo wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.jammy_amd64.deb
sudo apt install -y ./wkhtmltox_0.12.6.1-3.jammy_amd64.deb
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin
sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin
⚠️ Note: If you encounter dependency issues, run sudo apt --fix-broken install

3. Install Node.js for Asset Compilation

curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
sudo apt install -y nodejs
sudo npm install -g less less-plugin-clean-css rtlcss

4. Create Odoo System User

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

5. Setup PostgreSQL Database

sudo systemctl enable postgresql
sudo systemctl start postgresql
sudo su - postgres -c "createuser -R -S -D odoo18"
sudo su - postgres -c "createdb odoo18 --owner odoo18"

6. Clone Odoo 18 Source Code

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

7. Create Python Virtual Environment

cd /opt/odoo18
sudo python3 -m venv odoo-venv
sudo chown -R odoo18:odoo18 /opt/odoo18
sudo su - odoo18
source /opt/odoo18/odoo-venv/bin/activate
pip install --upgrade pip
pip install wheel
pip install -r /opt/odoo18/odoo/requirements.txt
deactivate
exit

8. Create Custom Addons Directory

sudo mkdir -p /opt/odoo18/custom-addons
sudo chown -R odoo18:odoo18 /opt/odoo18

9. Configure Odoo Settings File

sudo nano /etc/odoo18.conf

Add the following configuration (change the admin_passwd to a secure password!):

[options]
admin_passwd = ChangeThisStrongPassword123!
db_host = localhost
db_port = 5432
db_user = odoo18
db_password = False
addons_path = /opt/odoo18/odoo/addons,/opt/odoo18/custom-addons
logfile = /var/log/odoo18.log
logrotate = True
proxy_mode = True
💡 Security Tip: Use a strong, unique password for admin_passwd. This password allows database management operations.

10. Create Systemd Service

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

Add the following content:

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

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

[Install]
WantedBy=multi-user.target

11. Start Odoo Service

sudo systemctl daemon-reload
sudo systemctl enable --now odoo18
sudo systemctl status odoo18
✅ Verify Odoo is running: Open your browser and go to http://your-server-ip:8069. You should see the Odoo database creation screen.

12. Install & Configure Nginx

sudo apt install -y nginx
sudo nano /etc/nginx/sites-available/odoo18.conf

Add this configuration (replace 'yourdomain.com' with your actual domain):

# Odoo upstream servers
upstream odoo {
    server 127.0.0.1:8069;
}

upstream odoochat {
    server 127.0.0.1:8072;
}

# HTTP redirect to HTTPS
server {
    listen 80;
    listen [::]:80;
    server_name yourdomain.com www.yourdomain.com;
    return 301 https://$server_name$request_uri;
}

# HTTPS server
server {
    listen 443 ssl;
    listen [::]:443 ssl;
    http2 on;
    server_name yourdomain.com;

    # Proxy headers
    proxy_read_timeout 720s;
    proxy_connect_timeout 720s;
    proxy_send_timeout 720s;
    
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Host $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;

    # Log files
    access_log /var/log/nginx/odoo18_access.log;
    error_log /var/log/nginx/odoo18_error.log;

    # WebSocket for live chat
    location /websocket {
        proxy_pass http://odoochat;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
    }

    # Main proxy
    location / {
        proxy_redirect off;
        proxy_pass http://odoo;
    }

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

    # Gzip compression
    gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
    gzip on;
}
sudo ln -s /etc/nginx/sites-available/odoo18.conf /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx

13. Install Free SSL Certificate (Let's Encrypt)

sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d yourdomain.com -d www.yourdomain.com

Follow the prompts to complete SSL installation. Choose option 2 to redirect HTTP to HTTPS automatically.

🔒 SSL Auto-Renewal: Certbot automatically sets up renewal. Verify with sudo certbot renew --dry-run

14. Configure Firewall (Optional but Recommended)

sudo ufw allow OpenSSH
sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw deny 8069/tcp  # Block direct access to Odoo port
sudo ufw --force enable
sudo ufw status

15. Enable Multiprocessing for Production

For better performance, enable worker mode. Calculate workers based on your CPU cores:

# Check CPU cores
nproc

# Edit configuration
sudo nano /etc/odoo18.conf

Add these lines (adjust workers based on your server):

# Multiprocessing settings (for 4 CPU cores example)
limit_memory_hard = 2684354560
limit_memory_soft = 2147483648
limit_request = 8192
limit_time_cpu = 600
limit_time_real = 1200
max_cron_threads = 1
workers = 5  # (CPU_CORES * 2) + 1
sudo systemctl restart odoo18

16. Verify Installation

  1. Open your browser and visit https://yourdomain.com
  2. You should see the Odoo database creation screen
  3. Create your database and master password
  4. Start using Odoo 18!
🎉 Success! Odoo 18 is now installed on your Ubuntu 24.04 server with Nginx and free SSL.

Useful Odoo Management Commands

# Service management
sudo systemctl restart odoo18
sudo systemctl stop odoo18
sudo systemctl start odoo18
sudo systemctl status odoo18

# View logs
sudo journalctl -u odoo18 -f
sudo tail -f /var/log/odoo18.log

# Nginx management
sudo systemctl restart nginx
sudo nginx -t
sudo journalctl -u nginx -f

Troubleshooting Common Issues

Odoo won't start - port already in use

sudo netstat -tlnp | grep 8069
sudo systemctl stop odoo18
sudo systemctl start odoo18

Database connection error

sudo systemctl status postgresql
sudo -u postgres psql -c "\du"

SSL certificate not working

sudo certbot renew --dry-run
sudo systemctl restart nginx

Upgrading Odoo 18

sudo systemctl stop odoo18
sudo su - odoo18
cd /opt/odoo18/odoo
git checkout 18.0
git pull
source /opt/odoo18/odoo-venv/bin/activate
pip install -r requirements.txt
deactivate
exit
sudo systemctl start odoo18
📧 Need Professional Help?

Setting up Odoo can be complex. Our team can handle the entire installation process for you, including optimization and ongoing support.

Get Installation Assistance