Deploying a Scalable Odoo ERP Backend on an NVMe VPS for Pakistani Businesses
As digital transformation accelerates across Pakistan’s corporate landscape, businesses are actively migrating from legacy spreadsheets and disjointed software to unified Enterprise Resource Planning (ERP) systems. Open-source solutions like Odoo and ERPNext offer enterprise-grade modules—covering accounting, HR, inventory, and sales—without the exorbitant licensing fees of SAP or Oracle.
However, a robust ERP system requires an underlying infrastructure that guarantees low latency, high I/O throughput, and ironclad security. Deploying your ERP on a high-performance NVMe VPS ensures that database queries resolve instantly and concurrent user sessions do not bog down the system.
This expert guide will walk you through deploying a scalable Odoo 17 backend on an NVMe VPS, perfectly tailored for medium-to-large businesses in Pakistan.
Prerequisites
- An NVMe VPS running Ubuntu 22.04 LTS or 24.04 LTS (minimum 4GB RAM, 2 vCPUs, and 40GB NVMe storage).
- A domain or subdomain (e.g.,
erp.yourcompany.pk) pointing to your VPS IP. - Root or
sudoprivileges.
Step 1: System Preparation & Security
Before installing enterprise applications, secure your VPS and update all system packages.
sudo apt update && sudo apt upgrade -y
sudo apt install -y git python3-pip build-essential wget python3-dev python3-venv \
python3-wheel libfreetype6-dev libxml2-dev libzip-dev libldap2-dev libsasl2-dev \
python3-setuptools node-less libjpeg-dev zlib1g-dev libpq-dev libxslt1-dev \
libffi-dev libssl-dev
Create a dedicated system user for Odoo to isolate the service for security reasons:
sudo useradd -m -d /opt/odoo -U -r -s /bin/bash odoo
Step 2: Install and Configure PostgreSQL
Odoo relies on PostgreSQL as its database backend. Install it and create a database user corresponding to the Odoo system user.
sudo apt install -y postgresql
sudo su - postgres -c "createuser -s odoo"
Pro-Tip: For a VPS with 8GB+ RAM, optimize PostgreSQL by editing /etc/postgresql/14/main/postgresql.conf and adjusting shared_buffers to 25% of total RAM and work_mem to 16MB for better query performance.
Step 3: Install Wkhtmltopdf
Odoo requires wkhtmltopdf to generate PDF reports (invoices, payslips, purchase orders). It is crucial to install the correct version with patched qt.
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
sudo apt install -y ./wkhtmltox_0.12.6.1-2.jammy_amd64.deb
Step 4: Installing and Configuring Odoo
Switch to the Odoo user, clone the repository, and set up a Python virtual environment. This method ensures that Odoo’s dependencies don’t conflict with system-wide Python packages.
sudo su - odoo
git clone https://www.github.com/odoo/odoo --depth 1 --branch 17.0 /opt/odoo/odoo-server
cd /opt/odoo
python3 -m venv odoo-venv
source odoo-venv/bin/activate
pip3 install wheel
pip3 install -r odoo-server/requirements.txt
deactivate
exit
Next, create a configuration file for Odoo:
sudo nano /etc/odoo.conf
Add the following configuration:
[options]
; This is the password that allows database operations:
admin_passwd = your_strong_master_password
db_host = False
db_port = False
db_user = odoo
db_password = False
addons_path = /opt/odoo/odoo-server/addons
logfile = /var/log/odoo/odoo.log
xmlrpc_port = 8069
Set permissions and create a systemd service file to manage the Odoo process:
sudo mkdir /var/log/odoo
sudo chown odoo:root /var/log/odoo
sudo nano /etc/systemd/system/odoo.service
Paste the following into odoo.service:
[Unit]
Description=Odoo
Documentation=http://www.odoo.com
After=network.target postgresql.service
[Service]
# Ubuntu/Debian convention:
Type=simple
User=odoo
ExecStart=/opt/odoo/odoo-venv/bin/python3 /opt/odoo/odoo-server/odoo-bin -c /etc/odoo.conf
[Install]
WantedBy=multi-user.target
Reload the systemd daemon, start Odoo, and enable it on boot:
sudo systemctl daemon-reload
sudo systemctl start odoo
sudo systemctl enable odoo
Step 5: Nginx Reverse Proxy & SSL Setup
Exposing Odoo directly on port 8069 is not recommended. Use Nginx as a reverse proxy and secure the deployment with Let’s Encrypt SSL.
sudo apt install -y nginx certbot python3-certbot-nginx
Create an Nginx server block:
sudo nano /etc/nginx/sites-available/erp.yourcompany.pk
upstream odoo {
server 127.0.0.1:8069;
}
upstream odoochat {
server 127.0.0.1:8072;
}
server {
listen 80;
server_name erp.yourcompany.pk;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
# Add Headers for odoo proxy mode
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;
location / {
proxy_redirect off;
proxy_pass http://odoo;
}
location /longpolling {
proxy_pass http://odoochat;
}
location ~* /web/static/ {
proxy_cache_valid 200 90m;
proxy_buffering on;
expires 864000;
proxy_pass http://odoo;
}
}
Enable the site and obtain an SSL certificate:
sudo ln -s /etc/nginx/sites-available/erp.yourcompany.pk /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
sudo certbot --nginx -d erp.yourcompany.pk
Step 6: Scaling Up to Bare-Metal
As your Pakistani enterprise grows, you might expand from a few users to hundreds of employees querying the database concurrently, running complex manufacturing resource planning (MRP), or generating vast financial reports.
At this stage, an NVMe VPS might become a bottleneck due to shared underlying CPU cycles. Deploying massive ERP architectures or running complex multi-node PostgreSQL clusters requires the unmetered bandwidth, exclusive multi-core power, and complete hardware isolation of bare-metal Dedicated Servers. By migrating your Odoo production environment to premium Dedicated Servers in Pakistan, you guarantee absolute data sovereignty, sub-millisecond local latency, and the raw computational power required for true enterprise automation.
Conclusion
By deploying Odoo on an NVMe VPS, your business can leverage a fast, secure, and highly scalable ERP system without the massive overhead of traditional proprietary software. Start small on a VPS, optimize your database, and seamlessly transition to dedicated hardware as your operational needs expand.
