Deployment Guide

    Deploy Odoo ERP

    Odoo is a comprehensive open-source ERP and business management platform. This guide covers deploying Odoo 17 on RamNode's reliable VPS hosting with PostgreSQL, Nginx reverse proxy, and SSL encryption.

    Ubuntu 24.04 LTS
    PostgreSQL
    ⏱️ 45-60 minutes
    1

    Introduction

    Odoo is a powerful open-source suite of business applications that includes CRM, e-commerce, accounting, inventory management, project management, and much more. With over 30 main applications and thousands of community modules, Odoo provides a comprehensive solution for businesses of all sizes.

    Self-hosting Odoo on a RamNode VPS gives you complete control over your data, customization options, and eliminates recurring SaaS subscription costs. This guide walks you through deploying Odoo 17 (the latest stable version) on an Ubuntu 24.04 LTS server.

    2

    Prerequisites

    Before beginning the installation, ensure you have the following:

    RequirementSpecification
    VPS PlanMinimum 2GB RAM, 2 vCPU (4GB+ recommended for production)
    Operating SystemUbuntu 24.04 LTS (fresh installation)
    Domain NameA registered domain with DNS access
    Root AccessSSH access with root or sudo privileges
    Disk SpaceAt least 20GB free space

    Tip: For optimal performance, we recommend the RamNode Premium KVM plan with 4GB RAM or higher for production deployments with multiple users.

    3

    Initial Server Setup

    Update the System

    Start by connecting to your VPS via SSH and updating all system packages:

    Update system
    sudo apt update && sudo apt upgrade -y

    Create a Dedicated Odoo User

    Create a system user dedicated to running Odoo. This improves security by isolating the application:

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

    Install Required Dependencies

    Install dependencies
    sudo apt install -y python3-pip python3-dev python3-venv \
        libxml2-dev libxslt1-dev zlib1g-dev libsasl2-dev \
        libldap2-dev build-essential libssl-dev libffi-dev \
        libmysqlclient-dev libjpeg-dev libpq-dev libjpeg8-dev \
        liblcms2-dev libblas-dev libatlas-base-dev git \
        nodejs npm wkhtmltopdf

    Note: The wkhtmltopdf package is essential for generating PDF reports in Odoo.

    4

    PostgreSQL Database Setup

    Odoo uses PostgreSQL as its database backend. Install PostgreSQL and create a dedicated database user:

    Install PostgreSQL
    sudo apt install -y postgresql postgresql-contrib

    Create Odoo Database User

    Create database user
    sudo -u postgres createuser -s odoo

    Note: The -s flag grants superuser privileges, which Odoo needs to create and manage its databases.

    5

    Installing Odoo

    Clone the Odoo Repository

    Switch to the odoo user and clone the official Odoo 17 repository:

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

    Set Up Python Virtual Environment

    Create virtual environment
    cd /opt/odoo
    python3 -m venv odoo-venv
    source odoo-venv/bin/activate
    pip install wheel
    pip install -r odoo17/requirements.txt
    deactivate

    Create Custom Addons Directory

    Create addons directory
    mkdir /opt/odoo/odoo17-custom-addons
    exit
    6

    Configuring Odoo

    Create the main Odoo configuration file:

    Create config file
    sudo nano /etc/odoo.conf
    /etc/odoo.conf
    [options]
    admin_passwd = your_secure_password
    db_host = False
    db_port = False
    db_user = odoo
    db_password = False
    addons_path = /opt/odoo/odoo17/addons,/opt/odoo/odoo17-custom-addons
    logfile = /var/log/odoo/odoo.log
    log_level = info
    xmlrpc_port = 8069
    proxy_mode = True
    limit_memory_hard = 2684354560
    limit_memory_soft = 2147483648
    limit_time_cpu = 600
    limit_time_real = 1200
    max_cron_threads = 1
    workers = 2

    Important: Replace 'your_secure_password' with a strong admin password.

    Set Permissions

    Set permissions
    sudo mkdir /var/log/odoo
    sudo chown odoo:odoo /var/log/odoo
    sudo chown odoo:odoo /etc/odoo.conf
    7

    Creating the Systemd Service

    Create service file
    sudo nano /etc/systemd/system/odoo.service
    odoo.service
    [Unit]
    Description=Odoo 17
    Documentation=https://www.odoo.com
    After=network.target postgresql.service
    
    [Service]
    Type=simple
    SyslogIdentifier=odoo
    PermissionsStartOnly=true
    User=odoo
    Group=odoo
    ExecStart=/opt/odoo/odoo-venv/bin/python3 /opt/odoo/odoo17/odoo-bin -c /etc/odoo.conf
    StandardOutput=journal+console
    Restart=on-failure
    RestartSec=5
    
    [Install]
    WantedBy=multi-user.target
    Enable and start service
    sudo systemctl daemon-reload
    sudo systemctl enable odoo
    sudo systemctl start odoo
    sudo systemctl status odoo
    8

    Nginx Reverse Proxy Setup

    Install Nginx
    sudo apt install -y nginx

    Create Server Block

    Create Nginx config
    sudo nano /etc/nginx/sites-available/odoo
    /etc/nginx/sites-available/odoo
    upstream odoo {
        server 127.0.0.1:8069;
    }
    
    upstream odoochat {
        server 127.0.0.1:8072;
    }
    
    server {
        listen 80;
        server_name yourdomain.com;
    
        proxy_read_timeout 720s;
        proxy_connect_timeout 720s;
        proxy_send_timeout 720s;
    
        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;
    
        access_log /var/log/nginx/odoo.access.log;
        error_log /var/log/nginx/odoo.error.log;
    
        location /longpolling {
            proxy_pass http://odoochat;
        }
    
        location / {
            proxy_redirect off;
            proxy_pass http://odoo;
        }
    
        location ~* /web/static/ {
            proxy_cache_valid 200 90m;
            proxy_buffering on;
            expires 864000;
            proxy_pass http://odoo;
        }
    
        gzip on;
        gzip_types text/css text/plain application/json application/javascript;
        gzip_min_length 1000;
    }
    Enable site
    sudo ln -s /etc/nginx/sites-available/odoo /etc/nginx/sites-enabled/
    sudo nginx -t
    sudo systemctl restart nginx
    9

    SSL Certificate with Let's Encrypt

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

    Certbot will automatically configure Nginx for SSL and set up automatic certificate renewal. Follow the prompts to complete the setup.

    10

    Firewall Configuration

    Configure UFW
    sudo ufw allow ssh
    sudo ufw allow 'Nginx Full'
    sudo ufw enable

    This allows SSH access and HTTP/HTTPS traffic while blocking direct access to the Odoo port (8069).

    11

    Performance Optimization

    PostgreSQL Tuning

    Edit PostgreSQL config
    sudo nano /etc/postgresql/16/main/postgresql.conf

    Adjust these parameters based on your VPS resources:

    postgresql.conf
    shared_buffers = 512MB
    effective_cache_size = 1536MB
    maintenance_work_mem = 128MB
    work_mem = 16MB
    max_connections = 100
    Restart PostgreSQL
    sudo systemctl restart postgresql

    Odoo Worker Configuration

    The number of workers in your Odoo configuration should be based on your available CPU cores. A general formula is: workers = (CPU cores × 2) + 1. For a 2 vCPU server, 2-4 workers is appropriate. Each worker consumes approximately 150MB of RAM.

    12

    Backup & Maintenance

    Automated Database Backups

    Create backup script
    sudo nano /opt/odoo/backup.sh
    backup.sh
    #!/bin/bash
    BACKUP_DIR="/opt/odoo/backups"
    DATE=$(date +%Y%m%d_%H%M%S)
    mkdir -p $BACKUP_DIR
    
    # Backup all Odoo databases
    for db in $(sudo -u postgres psql -t -c "SELECT datname FROM pg_database WHERE datname NOT IN ('postgres', 'template0', 'template1')"); do
        sudo -u postgres pg_dump $db | gzip > "$BACKUP_DIR/${db}_${DATE}.sql.gz"
    done
    
    # Backup filestore
    tar -czf "$BACKUP_DIR/filestore_${DATE}.tar.gz" /opt/odoo/.local/share/Odoo/filestore
    
    # Keep only last 7 days of backups
    find $BACKUP_DIR -type f -mtime +7 -delete
    Schedule backup
    sudo chmod +x /opt/odoo/backup.sh
    sudo crontab -e

    Add daily backup at 2 AM:

    Cron entry
    0 2 * * * /opt/odoo/backup.sh

    Log Rotation

    Create logrotate config
    sudo nano /etc/logrotate.d/odoo
    /etc/logrotate.d/odoo
    /var/log/odoo/*.log {
        daily
        rotate 14
        compress
        delaycompress
        notifempty
        create 640 odoo odoo
        postrotate
            systemctl reload odoo > /dev/null 2>&1 || true
        endscript
    }

    Troubleshooting

    Check the Odoo logs for detailed error information:

    View logs
    sudo tail -f /var/log/odoo/odoo.log

    🎉 Congratulations!

    You now have a fully functional Odoo 17 installation running on your RamNode VPS. This setup provides a secure, production-ready environment with SSL encryption, automated backups, and optimized performance settings.

    Access Odoo by navigating to your domain. Use the admin password from your configuration to access the database manager and create your first database. For additional customization, explore the Odoo Apps store for modules that extend functionality.