Skip to main content
Technical Guide

How to Deploy Odoo: Complete Guide

Learn how to deploy Odoo on any VPS or cloud server from scratch. This comprehensive guide covers Ubuntu setup, PostgreSQL installation, Nginx configuration, SSL setup, and production optimization.

15-20 min read
Updated January 2025
Ubuntu 22.04 LTS

1Prerequisites

Before you begin deploying Odoo, ensure you have the following prerequisites ready. This guide assumes you have basic Linux command-line knowledge.

Server Requirements

  • Minimum 2 CPU cores (4+ recommended)
  • Minimum 4GB RAM (8GB+ recommended)
  • 40GB+ SSD storage
  • Ubuntu 22.04 LTS

Other Requirements

  • Domain name pointed to server IP
  • SSH access (root or sudo user)
  • Basic Linux command knowledge
  • Text editor (nano, vim, etc.)

Time Estimate

This manual deployment process typically takes 2-4 hours, including troubleshooting. If you prefer a faster approach, OEC.sh can deploy Odoo in under 5 minutes.

2Server Setup

First, SSH into your server and update the system packages. Then install all the required dependencies for Odoo.

Update System Packages

Update systembash
# Update package list and upgrade all packages
sudo apt update && sudo apt upgrade -y
# Install essential build tools
sudo apt install -y build-essential wget curl git

Install Python and Dependencies

Odoo is built with Python. Install Python 3 and all required development libraries:

Install dependenciesbash
# Install Python 3 and pip
sudo apt install -y python3-pip python3-dev python3-venv python3-wheel
# Install Odoo dependencies
sudo apt install -y libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev \
libtiff5-dev libjpeg8-dev libopenjp2-7-dev zlib1g-dev libfreetype6-dev \
liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev libxcb1-dev \
libpq-dev
# Install Node.js for asset compilation
sudo apt install -y nodejs npm
sudo npm install -g rtlcss

Install wkhtmltopdf

wkhtmltopdf is required for generating PDF reports in Odoo:

Install wkhtmltopdfbash
# Download wkhtmltopdf with patched Qt
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.jammy_amd64.deb
# Install the package
sudo apt install -y ./wkhtmltox_0.12.6.1-3.jammy_amd64.deb
# Verify installation
wkhtmltopdf --version

3PostgreSQL Installation

PostgreSQL is the only database officially supported by Odoo. Install and configure it for optimal performance.

Install PostgreSQLbash
# Install PostgreSQL
sudo apt install -y postgresql postgresql-contrib
# Start and enable PostgreSQL service
sudo systemctl start postgresql
sudo systemctl enable postgresql
# Create Odoo database user
sudo -u postgres createuser --createdb --no-superuser --no-createrole odoo
# Set password for the odoo user (optional but recommended)
sudo -u postgres psql -c "ALTER USER odoo WITH PASSWORD 'your_secure_password';"

Optimize PostgreSQL Configuration

Edit the PostgreSQL configuration for better performance with Odoo:

/etc/postgresql/14/main/postgresql.confini
# Edit /etc/postgresql/14/main/postgresql.conf
# Memory settings (adjust based on your RAM)
shared_buffers = 2GB # 25% of total RAM
effective_cache_size = 6GB # 75% of total RAM
work_mem = 64MB
maintenance_work_mem = 512MB
# Connection settings
max_connections = 200
# Write-Ahead Log
wal_buffers = 64MB
checkpoint_completion_target = 0.9
# Planner settings
random_page_cost = 1.1 # For SSD storage
effective_io_concurrency = 200 # For SSD storage
# Restart PostgreSQL to apply changes
sudo systemctl restart postgresql

4Odoo Installation

There are two methods to install Odoo: from source (recommended for customization) or from the official DEB package (simpler setup).

Method 1: Install from Source (Recommended)

Install Odoo from sourcebash
# Create odoo system user
sudo useradd -m -d /opt/odoo -U -r -s /bin/bash odoo
# Switch to odoo user
sudo su - odoo
# Clone Odoo repository (version 17.0)
git clone https://github.com/odoo/odoo.git --depth 1 --branch 17.0 /opt/odoo/odoo
# Create Python virtual environment
python3 -m venv /opt/odoo/venv
# Activate virtual environment
source /opt/odoo/venv/bin/activate
# Install Python dependencies
pip install wheel
pip install -r /opt/odoo/odoo/requirements.txt
# Exit odoo user
exit

Create Odoo Configuration File

/etc/odoo/odoo.confini
# Create /etc/odoo/odoo.conf
[options]
; Database settings
admin_passwd = your_admin_master_password
db_host = localhost
db_port = 5432
db_user = odoo
db_password = your_secure_password
; Paths
addons_path = /opt/odoo/odoo/addons,/opt/odoo/custom-addons
data_dir = /opt/odoo/.local/share/Odoo
; Server settings
http_port = 8069
longpolling_port = 8072
proxy_mode = True
; Logging
logfile = /var/log/odoo/odoo.log
log_level = info
; Security
list_db = False
# Create necessary directories
sudo mkdir -p /etc/odoo /var/log/odoo /opt/odoo/custom-addons
sudo chown -R odoo:odoo /var/log/odoo /opt/odoo/custom-addons
# Create the config file
sudo nano /etc/odoo/odoo.conf

Create Systemd Service

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

5Nginx Configuration

Nginx acts as a reverse proxy, handling SSL termination, load balancing, and serving static files efficiently.

# Install Nginx
sudo apt install -y nginx
# Start and enable Nginx
sudo systemctl start nginx
sudo systemctl enable nginx

Create Nginx Server Block

/etc/nginx/sites-available/odoonginx
1# Create /etc/nginx/sites-available/odoo
2
3upstream odoo {
4server 127.0.0.1:8069;
5}
6
7upstream odoo-chat {
8server 127.0.0.1:8072;
9}
10
11server {
12listen 80;
13server_name your-domain.com;
14
15 # Redirect to HTTPS (enable after SSL setup)
16 # return 301 https://$host$request_uri;
17
18 proxy_read_timeout 720s;
19 proxy_connect_timeout 720s;
20 proxy_send_timeout 720s;
21
22 # Proxy headers
23proxy_set_header X-Forwarded-Host $host;
24proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
25proxy_set_header X-Forwarded-Proto $scheme;
26proxy_set_header X-Real-IP $remote_addr;
27
28 # Log files
29access_log /var/log/nginx/odoo.access.log;
30error_log /var/log/nginx/odoo.error.log;
31
32 # Increase proxy buffer size
33 proxy_buffers 16 64k;
34 proxy_buffer_size 128k;
35
36 # Longpolling
37location /longpolling {
38proxy_pass http://odoo-chat;
39 }
40
41 # Handle all other requests
42location / {
43 proxy_redirect off;
44proxy_pass http://odoo;
45 }
46
47 # Cache static files
48location ~* /web/static/ {
49 proxy_cache_valid 200 90m;
50 proxy_buffering on;
51 expires 864000;
52proxy_pass http://odoo;
53 }
54
55 # Gzip compression
56 gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;
57 gzip on;
58}
# Enable the site
sudo ln -s /etc/nginx/sites-available/odoo /etc/nginx/sites-enabled/
# Remove default site (optional)
sudo rm /etc/nginx/sites-enabled/default
# Test Nginx configuration
sudo nginx -t
# Reload Nginx
sudo systemctl reload nginx

6SSL Setup with Let's Encrypt

Secure your Odoo installation with a free SSL certificate from Let's Encrypt using Certbot.

Install SSL certificatebash
# Install Certbot
sudo apt install -y certbot python3-certbot-nginx
# Obtain SSL certificate (replace with your domain)
sudo certbot --nginx -d your-domain.com
# Test auto-renewal
sudo certbot renew --dry-run

Certbot will automatically modify your Nginx configuration to use HTTPS. The certificate auto-renews every 90 days via a cron job.

Checkpoint

At this point, you should be able to access Odoo at https://your-domain.com. The database manager will appear for first-time setup.

7Production Optimization

Configure Odoo workers, memory limits, and logging for production workloads.

Worker Configuration Formula

Use this formula to calculate the optimal number of workers:

workers = (CPU cores * 2) + 1
  • 4 CPU cores = 9 workers
  • 8 CPU cores = 17 workers
  • Each worker uses ~150-300MB RAM
/etc/odoo/odoo.conf (production settings)ini
# Update /etc/odoo/odoo.conf with production settings
[options]
; Worker settings (for 4 CPU cores, 8GB RAM)
workers = 9
max_cron_threads = 2
; Memory limits (in bytes)
limit_memory_hard = 2684354560 ; 2.5GB
limit_memory_soft = 2147483648 ; 2GB
; Time limits (in seconds)
limit_time_cpu = 600
limit_time_real = 1200
; Request limits
limit_request = 8192
; Database
db_maxconn = 64
; Logging
log_level = warn
log_handler = :INFO
; Security (important for production)
list_db = False
# Restart Odoo to apply changes
sudo systemctl restart odoo
# Monitor Odoo processes
ps aux | grep odoo

Configure Logrotate

/etc/logrotate.d/odooini
# Create /etc/logrotate.d/odoo
/var/log/odoo/*.log {
daily
rotate 14
compress
delaycompress
missingok
notifempty
copytruncate
}

8Backup Configuration

Set up automated backups for your Odoo database and filestore. Regular backups are critical for disaster recovery.

Create Backup Script

/opt/odoo/backup.shbash
1#!/bin/bash
2# /opt/odoo/backup.sh
3
4# Configuration
5BACKUP_DIR="/opt/odoo/backups"
6DB_NAME="your_database_name"
7FILESTORE_DIR="/opt/odoo/.local/share/Odoo/filestore/$DB_NAME"
8DATE=$(date +%Y-%m-%d_%H-%M-%S)
9RETENTION_DAYS=30
10
11# Create backup directory
12mkdir -p $BACKUP_DIR
13
14# Backup database
15sudo -u postgres pg_dump $DB_NAME | gzip > $BACKUP_DIR/db_$DATE.sql.gz
16
17# Backup filestore
18tar -czf $BACKUP_DIR/filestore_$DATE.tar.gz -C $FILESTORE_DIR .
19
20# Create combined backup
21tar -czf $BACKUP_DIR/full_backup_$DATE.tar.gz \
22 $BACKUP_DIR/db_$DATE.sql.gz \
23 $BACKUP_DIR/filestore_$DATE.tar.gz
24
25# Clean up individual files
26rm $BACKUP_DIR/db_$DATE.sql.gz
27rm $BACKUP_DIR/filestore_$DATE.tar.gz
28
29# Remove old backups
30find $BACKUP_DIR -type f -name "full_backup_*.tar.gz" -mtime +$RETENTION_DAYS -delete
31
32echo "Backup completed: full_backup_$DATE.tar.gz"
# Make script executable
sudo chmod +x /opt/odoo/backup.sh
# Test the backup script
sudo /opt/odoo/backup.sh

Schedule Automated Backups

# Open crontab editor
sudo crontab -e
# Add daily backup at 2 AM
0 2 * * * /opt/odoo/backup.sh >> /var/log/odoo/backup.log 2>&1

Pro Tip

For production systems, also upload backups to external storage like AWS S3 or Cloudflare R2 for offsite redundancy.

9Cloud Provider-Specific Deployment Guides

The steps above work for any VPS or cloud server. For provider-specific optimizations, networking configurations, and best practices, check out our detailed guides:

10Or Skip All This with OEC.sh

Deploy in 5 Minutes Instead of 2-4 Hours

The manual deployment process above typically takes 2-4 hours including troubleshooting, and requires ongoing maintenance for security updates, backups, and monitoring.

With OEC.sh, you can deploy Odoo to any of 14+ cloud providers in under 5 minutes with:

  • One-click deployment with automatic SSL
  • Automated daily backups to 7+ storage providers
  • Built-in PostgreSQL optimization
  • Zero-downtime updates and rollbacks
  • 24/7 monitoring and alerting
  • Git integration with auto-deploy on push

11Frequently Asked Questions

Related Guides

Ready to Deploy Odoo?

Skip the manual setup. Deploy Odoo to any cloud in minutes with OEC.sh. Start free, scale as you grow.

5 min
Deployment Time
14+
Cloud Providers
$0
Free Plan