← Back to blog Technical Guide

Installation Guide: Odoo 19 (Community & Enterprise) on Ubuntu 24.04

This guide covers installing Odoo 19 Community and Enterprise editions from source on an Ubuntu 24.04 VPS.

Prerequisites

  • OS: Ubuntu 24.04
  • Python: Version 3.10 or higher
  • Access: SSH with sudo privileges

1. System Preparation and Dependencies

First, make sure your system repositories are up to date and install the necessary dependencies for Python and the database.

  1. Download the sources: Download and extract the Odoo Community and Enterprise source folders to your server.

  2. Install the Python virtual environment:

    bash
    sudo apt install python3-venv
  3. Install PostgreSQL:

    bash
    sudo apt install postgresql postgresql-client
  4. Configure the PostgreSQL user:

    Create a new postgres user. Replace $USER with your actual system username.

    bash
    sudo -u postgres createuser -d -R -S $USER
    createdb $USER
  5. Install development libraries:

    bash
    sudo apt install python3-pip libldap2-dev libpq-dev libsasl2-dev

2. Environment Setup and Installation

  1. Create the virtual environment:

    Create a virtual environment (venv) in the same directory where the Odoo Community and Enterprise folders are located, then activate it.

    bash
    python3 -m venv venv
    source venv/bin/activate

    (Note: Make sure you are inside the active virtual environment for the following steps).

  2. Install Python prerequisites:

    Navigate to the community folder and run:

    bash
    pip install -r requirements.txt
    pip install phonenumbers
  3. Install wkhtmltopdf:

    Download and install the specific version required for report printing.

    bash
    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

    Note: The above command will fail. Run the next step to fix it:

    bash
    sudo apt install -f
  4. Verify the installation:

    Go back to the community path and verify that Odoo is accessible:

    bash
    python3 -m odoo --version

3. Initial Test Launch

Before fully configuring the production service, perform a test launch to set up the database.

  1. Start Odoo manually:

    Run the following command to point to the Enterprise addons path and initialize the test database.

    bash
    python3 -m odoo --addons-path=/home/ubuntu/odoo_enterprise/ -d odoo_db_test
  2. Access the Web interface:

    Open the port in your firewall and access it through your browser.

    bash
    sudo ufw allow 8069/tcp

    Go to: http://<server-ip>:8069 and verify that Odoo starts correctly and the database manager is displayed.

  3. Stop the server:

    Go back to your terminal and stop Odoo with ctrl+c.


4. Production Configuration

We will now create the permanent configuration file and prepare the system for production.

  1. Create and edit odoo.conf:

    Create the configuration file:

    bash
    vim /home/ubuntu/odoo.conf

    First, generate a hashed master password. With your venv activated, run:

    bash
    source /home/ubuntu/venv/bin/activate
    python3 -c "from passlib.context import CryptContext; print(CryptContext(['pbkdf2_sha512']).hash('YOUR_PASSWORD_HERE'))"

    Replace YOUR_PASSWORD_HERE with your actual master password. This will output something like:

    text
    $pbkdf2-sha512$25000$abc123...long_hash_string...

    Copy that entire hash and add it to the configuration file below:

    ini
    [options]
    admin_passwd = $pbkdf2-sha512$25000$abc123...the_full_hash...
    db_user = ubuntu
    db_password = False
    db_host = False
    db_port = False
    addons_path = /home/ubuntu/odoo_enterprise/odoo/addons,/home/ubuntu/odoo_community/odoo/addons
    workers = 17
    logfile = /home/ubuntu/odoo.log
    log_level = debug
    http_port = 8069
    longpolling_port = 8072
    proxy_mode = True

    Configuration notes:

    • admin_passwd: The hashed master password you generated above.
    • db_user: Replace ubuntu if the $USER created in step 1.4 is different.
    • addons_path: Adjust if your source folders are located elsewhere.
    • log_level: Can be changed to info once in production.
    • workers: Calculated using echo "workers = $(( $(nproc) * 2 + 1 ))". Adjust this number based on your CPU cores. Decrease if the instance has limited RAM.
    • proxy_mode: Set to True because we will be using Nginx.
  2. Prepare the log file:

    bash
    touch /home/ubuntu/odoo.log
  3. Prepare the startup script:

    Navigate to the community folder and download odoo-bin.

    bash
    cd /home/ubuntu/odoo_community
    wget https://raw.githubusercontent.com/odoo/odoo/refs/heads/19.0/odoo-bin
    chmod +x odoo-bin

5. Systemd Service Configuration

Create a system service to manage Odoo automatically.

  1. Create the service file:

    bash
    sudo vim /etc/systemd/system/odoo.service
  2. Paste the service configuration:

    ini
    [Unit]
    Description=Odoo 19 Service
    Documentation=https://www.odoo.com
    # Wait for network and postgres before starting
    Requires=postgresql.service
    After=network.target postgresql.service
    
    [Service]
    # ---------------------------------------------------------
    # Run as your user so it can access your home dir & venv
    # ---------------------------------------------------------
    User=ubuntu
    Group=ubuntu
    
    # ---------------------------------------------------------
    # PATHS
    # ---------------------------------------------------------
    # We run from the community folder so relative paths work if needed
    WorkingDirectory=/home/ubuntu/odoo_community
    
    # IMPORTANT: Point to your VENV python, then the module, then the config
    ExecStart=/home/ubuntu/venv/bin/python3 /home/ubuntu/odoo_community/odoo-bin -c /home/ubuntu/odoo.conf
    
    # ---------------------------------------------------------
    # RELIABILITY
    # ---------------------------------------------------------
    # Restart automatically if it crashes
    Restart=always
    RestartSec=5s
    
    # Increase open
    file limit (Critical for 17 workers!)
    LimitNOFILE=65535
    
    # standard output is handled by Odoo internal logging,
    # but this catches startup errors before Odoo takes over
    StandardOutput=journal+console
    StandardError=journal+console
    
    [Install]
    WantedBy=multi-user.target
  3. Start the service:

    bash
    sudo systemctl daemon-reload
    sudo systemctl start odoo

    Check the status to make sure it is running, then enable it.


6. Nginx Reverse Proxy Configuration

Configure Nginx to handle traffic, SSL, and buffering.

  1. Install Nginx:

    bash
    sudo apt install nginx -y
  2. Create the Odoo site configuration:

    bash
    sudo vim /etc/nginx/sites-available/odoo
  3. Paste the Nginx configuration:

    nginx
    # Upstream for the main web interface
    upstream odoo {
        server 127.0.0.1:8069;
    }
    
    # Upstream for LiveChat/Websockets
    upstream odoochat {
        server 127.0.0.1:8072;
    }
    
    server {
        listen 80;
        server_name erp.tadoo.io;
        # Increase upload size to 100MB
        client_max_body_size 100M;
    
        # Proxy Headers
        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;
    
        # Timeouts for long reports
        proxy_read_timeout 720s;
        proxy_connect_timeout 720s;
        proxy_send_timeout 720s;
    
        # Route Websocket traffic to port 8072
        location /websocket {
            proxy_pass http://odoochat;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
    
        # Route standard traffic to port 8069
        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;
        }
    }

    Note: Replace erp.tadoo.io with your own domain name.

  4. Enable the site:

    bash
    sudo ln -s /etc/nginx/sites-available/odoo /etc/nginx/sites-enabled/
    sudo rm /etc/nginx/sites-enabled/default
    sudo nginx -t
    sudo systemctl reload nginx

7. Security and Finalization

  1. Configure SSL (TLS):

    Install Certbot and configure SSL for the domain.

    bash
    sudo apt install certbot python3-certbot-nginx -y

    Then run Certbot to obtain and configure the SSL certificate:

    bash
    sudo certbot --nginx -d erp.tadoo.io

    Note: Replace erp.tadoo.io with your own domain name.

    You can now access your Odoo instance via https://your-domain.com.

  2. Create the production database:

    Go to /web/database/manager and create your production database, making sure to set a strong user password.

  3. Lock the database manager:

    To prevent database switching and hide the manager, edit the configuration file again:

    bash
    vim /home/ubuntu/odoo.conf

    Add these lines:

    ini
    dbfilter = ^tadoo$
    list_db = False

    Note: Replace tadoo with the name of your production database.

  4. Apply the changes:

    bash
    sudo systemctl restart odoo

Your Odoo 19 installation is now complete!