How to Install Odoo on a VPS Using Ubuntu: A Complete Guide

Odoo is one of the most ambitious open-source projects on the planet. What started as a modest ERP has expanded into a 30-app business suite that covers CRM, e-commerce, accounting, inventory, payroll, and manufacturing. Deploying it on your own VPS puts you in full control: your data, your upgrade schedule, and none of the per-seat pricing that makes the cloud version expensive at scale.

This guide walks you through installing Odoo 17 Community Edition on Ubuntu 22.04 LTS. By the end, PostgreSQL will run as the database, Odoo will live inside a Python virtual environment managed by systemd, and Nginx will sit in front as the reverse proxy. Bring a domain name and you’re ready for production.

Prerequisites

Before diving in, confirm your VPS meets these requirements:

Requirement Minimum Recommended
CPU 2 cores 4+ cores
RAM 2 GB 4 GB+
Storage 20 GB 50 GB+
Operating System Ubuntu 22.04 LTS Ubuntu 22.04 LTS
Server Access sudo or root sudo or root

You’ll also need a registered domain name (optional for local testing, but essential for production) and ports 80, 443, and 8069 open on your VPS firewall.

Step 1: Update the System

Always start clean. Refresh your package list and apply any pending updates before touching anything else:

sudo apt update && sudo apt upgrade -y

If the kernel updated, reboot and reconnect before moving forward.

Step 2: Install PostgreSQL and Create the Database User

Odoo speaks only PostgreSQL. MySQL and MariaDB aren’t options here. Install it from the Ubuntu repositories and enable it at startup:

sudo apt install -y postgresql postgresql-contrib
sudo systemctl start postgresql
sudo systemctl enable postgresql

Now create a dedicated PostgreSQL user for Odoo. The -s flag grants superuser rights, which Odoo requires to create and drop its own databases through the web interface:

sudo -u postgres createuser -s odoo17

Verify the database service is healthy before continuing:

sudo systemctl status postgresql

Step 3: Install System Dependencies

Odoo relies on a wide range of system libraries at runtime. Install them all in one pass:

sudo apt install -y git python3-pip python3-dev python3-venv /
  build-essential wget libxslt-dev libzip-dev libldap2-dev /
  libsasl2-dev python3-setuptools libjpeg-dev gdebi libpq-dev /
  libssl-dev libffi-dev

This pulls in Python build tools, LDAP authentication libraries, image processing support, and the PostgreSQL client library.

Step 4: Install wkhtmltopdf

Odoo uses wkhtmltopdf to render PDF documents like invoices, purchase orders, and shipping labels. The version in Ubuntu’s package repos is outdated and breaks Odoo’s report engine entirely. Download the correct release directly from the project’s GitHub page:

wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.jammy_amd64.deb
sudo gdebi wkhtmltox_0.12.6.1-3.jammy_amd64.deb

Confirm the install succeeded:

wkhtmltopdf --version

The output should read wkhtmltopdf 0.12.6.1. Anything older and your PDF reports will either look broken or refuse to generate.

Step 5: Create the Odoo System User

Don’t run Odoo as root. Create a dedicated system user with a home directory at /opt/odoo17:

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

Step 6: Clone Odoo 17 from GitHub

Download the Odoo 17 source code from the official repository. The --depth 1 flag skips the full git history and keeps the download considerably leaner:

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

This takes a few minutes depending on your connection. Odoo is a large codebase, so let it finish without interruption.

Step 7: Set Up the Python Virtual Environment

Odoo’s Python dependencies need their own isolated environment to avoid conflicts with system packages. Switch to the odoo17 user and build the virtual environment from there:

sudo su - odoo17 -s /bin/bash
python3 -m venv /opt/odoo17/odoo-venv
source /opt/odoo17/odoo-venv/bin/activate
pip install wheel
pip install -r /opt/odoo17/odoo/requirements.txt
deactivate
exit

The pip install -r requirements.txt step takes several minutes. It pulls in ORM tools, report generators, payment connectors, and dozens of other packages. Let it run to completion before moving on.

While you’re thinking about directory structure, create a folder for third-party and custom modules now:

sudo mkdir /opt/odoo17/odoo-custom-addons
sudo chown odoo17:odoo17 /opt/odoo17/odoo-custom-addons

Step 8: Configure Odoo

Create the main Odoo configuration file at /etc/odoo17.conf:

sudo nano /etc/odoo17.conf

Paste in the following settings:

[options]
admin_passwd = change_this_master_password
db_host = False
db_port = False
db_user = odoo17
db_password = False
addons_path = /opt/odoo17/odoo/addons,/opt/odoo17/odoo-custom-addons
xmlrpc_port = 8069
logfile = /var/log/odoo17/odoo.log
proxy_mode = True

Replace change_this_master_password with something strong. This password protects the database manager interface, so treat it with the same gravity as a root password.

Save the file, then create the log directory and hand it off to the odoo17 user:

sudo mkdir /var/log/odoo17
sudo chown odoo17:odoo17 /var/log/odoo17

Step 9: Create the Systemd Service

A systemd service keeps Odoo running across reboots and automatically restarts it if something goes wrong. Create the service file:

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

Paste in this unit configuration:

[Unit]
Description=Odoo17
Documentation=https://www.odoo.com
After=postgresql.service

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

[Install]
WantedBy=multi-user.target

Reload systemd and bring the service up:

sudo systemctl daemon-reload
sudo systemctl start odoo17
sudo systemctl enable odoo17

Check the service status:

sudo systemctl status odoo17

Look for active (running) in the output. If it’s absent, pull up the logs and diagnose from there:

sudo tail -f /var/log/odoo17/odoo.log

At this point, Odoo runs on port 8069. Visit http://your-server-ip:8069 to confirm it’s responding before you set up Nginx.

Step 10: Configure Nginx as a Reverse Proxy

Nginx routes incoming traffic on ports 80 and 443 back to Odoo’s internal port 8069. It also handles WebSocket connections, which Odoo’s live chat and long-polling features depend on. Install it first:

sudo apt install -y nginx

Create a new server block for Odoo:

sudo nano /etc/nginx/sites-available/odoo17

Paste in the configuration below. Replace your-domain.com with your actual domain name throughout:

upstream odoo {
    server 127.0.0.1:8069;
}

upstream odoochat {
    server 127.0.0.1:8072;
}

map $http_upgrade $connection_upgrade {
    default upgrade;
    '' close;
}

server {
    listen 80;
    server_name your-domain.com www.your-domain.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/odoo17.access.log;
    error_log /var/log/nginx/odoo17.error.log;

    location /websocket {
        proxy_pass http://odoochat;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
        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;
    }

    gzip on;
    gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
}

Enable the site and verify the configuration syntax:

sudo ln -s /etc/nginx/sites-available/odoo17 /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx

If nginx -t returns “syntax is ok,” you’re clear to move on.

Step 11: Secure with SSL

Never run a business application over plain HTTP. Certbot issues a free Let’s Encrypt certificate and wires it directly into your Nginx configuration:

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

Follow the interactive prompts. Certbot rewrites your Nginx config to redirect HTTP traffic to HTTPS and schedules automatic certificate renewal in the background. No manual renewal required.

Step 12: Complete the First-Run Setup

Navigate to https://your-domain.com in your browser. The Odoo database creation wizard appears. Work through each field:

  1. Master Password – the admin_passwd value from your config file
  2. Database Name – something descriptive like odoo_prod
  3. Email and Password – your admin login credentials
  4. Language and Country – match your locale
  5. Demo Data – leave this unchecked for any production installation

Click Create Database and give Odoo a minute or two to initialize. Once it finishes, you’ll land on the main application dashboard.

Troubleshooting

Odoo Won’t Start

Check the logs immediately:

sudo tail -50 /var/log/odoo17/odoo.log

Missing Python packages are the most common culprit. Confirm you ran pip install -r requirements.txt inside the virtual environment and not against the system Python.

PostgreSQL Connection Fails

Verify the database user exists:

sudo -u postgres psql -c "/du"

If odoo17 isn’t in the list, run the createuser command from Step 2 again.

Blank Page After Database Setup

Restart the service and clear your browser cache:

sudo systemctl restart odoo17

If the page stays blank, check the Nginx error log for more detail:

sudo tail -f /var/log/nginx/odoo17.error.log

PDF Reports Not Generating

Run wkhtmltopdf --version to confirm it’s installed and accessible. If the command fails, repeat Step 4. Also verify the odoo17 system user has execute permissions on the binary.

WebSocket Errors in Live Chat

Confirm the odoochat upstream in your Nginx config points to port 8072. Also check that proxy_mode = True is present in /etc/odoo17.conf. Restart both services after any config change:

sudo systemctl restart odoo17
sudo systemctl restart nginx

What to Build Next

A running Odoo instance is just the starting line. Here’s where to take it from here:

  • Install additional apps: Head to Settings > Apps to browse the full module library. CRM, eCommerce, Inventory, Payroll, and Manufacturing are all a single click away.
  • Enable multi-company support: Manage multiple legal entities from one Odoo instance, complete with consolidated reporting, intercompany transactions, and shared employee records.
  • Configure outgoing email: Wire up your SMTP credentials under Settings > Technical > Outgoing Mail Servers so Odoo can send invoices, quotes, and notifications on its own.
  • Schedule database backups: Use pg_dump on a cron job to back up your PostgreSQL database daily. Store copies off-site in an S3-compatible bucket for disaster recovery.
  • Explore community modules: The Odoo App Store at apps.odoo.com hosts thousands of third-party modules covering niche industry workflows that the core product doesn’t include out of the box.

Self-hosting Odoo gives you a genuinely capable business platform without per-user costs eating into your margins every month. The setup takes time and close attention to detail but it’s a one-time investment. Once Odoo is running, it handles the entire business cycle from a single interface. Keep the system updated, run regular database backups, and review the official release notes before bumping to a new version. Your data stays yours and your VPS does the heavy lifting.

The post How to Install Odoo on a VPS Using Ubuntu: A Complete Guide appeared first on GreenGeeks.

版权声明:
作者:主机优惠
链接:https://www.techfm.club/p/236838.html
来源:TechFM
文章版权归作者所有,未经允许请勿转载。

THE END
分享
二维码
< <上一篇
下一篇>>