How to Install Odoo 20 on Ubuntu 26.04

By 

•

Published on

•

9 min read

Lavender Odoo wordmark and Ubuntu 26.04 installation title on a dark plum background

When sales, inventory, and invoicing live in separate tools, even a simple order can mean entering the same information several times. Odoo brings these apps together in a single web interface, which you can host on your own server.

This guide walks through installing Odoo 20 Community from source on Ubuntu 26.04. We will set up PostgreSQL, run Odoo as a systemd service, and use Nginx and Let’s Encrypt to serve it over HTTPS.

Prerequisites

Use a fresh Ubuntu 26.04 server on amd64 or arm64 with a sudo user . For the worker configuration in this guide, start with two CPU cores and 4 GB of RAM.

To complete the HTTPS setup, point a domain name at the server’s public IP address and allow inbound traffic on ports 80 and 443. We will use odoo.example.com for the domain, odoo_prod for the database, and odoo for the service account.

Odoo 20 requires Python 3.12 or newer and PostgreSQL 16 or newer. Ubuntu 26.04 ships Python 3.14 and PostgreSQL 18. Odoo’s distribution package targets Ubuntu 24.04, so we will install Odoo 20 from source and get the Python dependencies from Ubuntu’s repositories.

Installing Dependencies

Update the package index and install Git and the tools we will use to download and verify the installation.

Terminal
sudo apt update
sudo apt install git curl ca-certificates openssl

The Odoo repository includes a script that lists its Debian and Ubuntu Python packages. We will use that list after cloning the source.

Creating a System User

Create a dedicated system user and group called odoo. The account owns its home directory under /opt/odoo and runs the application through systemd.

Terminal
sudo adduser --system --group --home /opt/odoo --shell /usr/sbin/nologin odoo

The nologin shell keeps the account from opening interactive sessions. You can still run an individual command as this user with sudo -u odoo.

Installing and Configuring PostgreSQL

Install and start PostgreSQL .

Terminal
sudo apt install postgresql
sudo systemctl enable --now postgresql

Create a PostgreSQL role with the same name as the Linux user. Allow it to create the initial database and give it standard role privileges.

Terminal
sudo -u postgres createuser --createdb --no-createrole --no-superuser odoo

Ubuntu’s default PostgreSQL configuration uses peer authentication for local Unix sockets. PostgreSQL identifies the caller as the Linux user odoo and grants access to the matching database role without a password. Verify the connection against the default postgres database.

Terminal
sudo -u odoo psql -d postgres -tAc 'SELECT current_user;'

The query should return odoo. We will create the application database later from the web interface.

Installing wkhtmltopdf for PDF Reports

Odoo uses wkhtmltopdf to render PDF invoices and other reports by default. The patched Qt build supports HTML headers and footers. Install the same upstream release used by the official Odoo 20 container image . The file carries a Jammy label because that is the Ubuntu release it was built for.

Download the package for your server’s architecture, install it with APT, and check the version.

Terminal
arch=$(dpkg --print-architecture)
package="wkhtmltox_0.12.6.1-3.jammy_${arch}.deb"
workdir=$(mktemp -d)
curl -fL "https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/$package" \
    -o "$workdir/$package"
chmod 755 "$workdir"
sudo apt install "$workdir/$package"
wkhtmltopdf --version

Look for wkhtmltopdf 0.12.6.1 (with patched qt). You can install the renderer later if you only need to get the web application running first.

Installing and Configuring Odoo 20

Clone the stable 20.0 branch as the service user.

Terminal
sudo -u odoo -H git clone --depth 1 --branch 20.0 \
    https://github.com/odoo/odoo.git /opt/odoo/odoo

Ask the upstream helper for the names of the packages it would install. Then pass the list to apt-get from Bash.

Terminal
read -r -a odoo_packages <<< "$(sudo -u odoo sh /opt/odoo/odoo/setup/debinstall.sh --list)"
sudo apt-get install "${odoo_packages[@]}" python3-lxml-html-clean python3-markdown2

Some entries in the list are alternatives, such as python3-lxml-html-clean|python3-lxml. If you pass the list to apt, it stops with Unable to locate package and installs nothing. The apt-get command reads each alternative as a pattern and installs the packages that match.

This keeps the Python libraries on Ubuntu’s update path, including the builds of gevent and greenlet for Python 3.14. The extra packages provide the HTML cleaner that lxml ships separately and Markdown previews for attachments in Odoo messages.

Verify that Odoo can import its dependencies and print its version.

Terminal
sudo -u odoo -H /usr/bin/python3 /opt/odoo/odoo/odoo-bin --version

The result should identify Odoo Server 20.0. Create a private data directory for sessions and the filestore, then prepare the configuration file.

Terminal
sudo install -d -o odoo -g odoo -m 0750 /var/lib/odoo
sudo touch /etc/odoo.conf
sudo chown root:odoo /etc/odoo.conf
sudo chmod 0640 /etc/odoo.conf
sudoedit /etc/odoo.conf

Generate a database manager master password with openssl rand -hex 32. Add the configuration below and replace REPLACE_WITH_MASTER_PASSWORD with the generated value.

/etc/odoo.confini
[options]
admin_passwd = REPLACE_WITH_MASTER_PASSWORD
db_user = odoo
addons_path = /opt/odoo/odoo/addons
data_dir = /var/lib/odoo
http_interface = 127.0.0.1
http_port = 8069

With no database host configured, Odoo connects over the local Unix socket. http_interface keeps the browser interface on loopback while we set up the database.

Warning
Keep /etc/odoo.conf out of version control and keep its permissions at 0640. The master password controls database management. You will choose a separate password for the Odoo administrator account.

Creating the Systemd Service

Create the service file with sudoedit /etc/systemd/system/odoo.service and add the following unit.

/etc/systemd/system/odoo.serviceini
[Unit]
Description=Odoo 20 Community
After=postgresql.service
Requires=postgresql.service

[Service]
Type=simple
User=odoo
Group=odoo
WorkingDirectory=/opt/odoo/odoo
ExecStart=/usr/bin/python3 /opt/odoo/odoo/odoo-bin --config /etc/odoo.conf
Restart=on-failure

[Install]
WantedBy=multi-user.target

Reload the systemd unit files, start Odoo, and enable it at boot.

Terminal
sudo systemctl daemon-reload
sudo systemctl enable --now odoo
sudo systemctl status odoo --no-pager

The status should show active (running). If it does not, inspect the first startup messages with sudo journalctl -u odoo -n 50 --no-pager.

Creating the First Odoo Database

From your workstation, open an SSH tunnel to the local Odoo port on your server. Replace your-user and your-server with your usual SSH login and host.

Terminal
ssh -N -L 127.0.0.1:8069:127.0.0.1:8069 your-user@your-server

Keep that session open and visit http://127.0.0.1:8069/web/database/manager in your browser. Enter the master password from /etc/odoo.conf, set the database name to odoo_prod, and choose an email address and password for the initial Odoo administrator. Leave demo data unchecked for a production installation, then select Create database. Wait for the Apps page to load.

Enabling Workers and Restricting Database Access

Odoo’s threaded mode works for the initial setup. For this deployment, we will use separate HTTP and cron workers. Odoo also starts an evented worker for WebSockets on port 8072 when multiprocessing is enabled.

Edit /etc/odoo.conf with sudoedit and add these lines under the existing [options] section. Use the actual database name if you chose a different one.

/etc/odoo.confini
db_name = odoo_prod
dbfilter = ^odoo_prod$
list_db = False
workers = 2
max_cron_threads = 1
gevent_port = 8072
proxy_mode = True

db_name and dbfilter select the application database, and list_db = False disables database listing and the database management interface. proxy_mode lets Odoo use the host and protocol headers supplied by Nginx. Keep both Odoo ports on loopback so clients reach them through the trusted proxy.

The database role already owns odoo_prod. Remove its ability to create more databases, then restart Odoo and check both listeners.

Terminal
sudo -u postgres psql -c 'ALTER ROLE odoo NOCREATEDB;'
sudo systemctl restart odoo
sudo ss -ltn '( sport = :8069 or sport = :8072 )'

Once Odoo has restarted, both addresses should begin with 127.0.0.1. If port 8072 is missing, check the journal for a worker startup error.

Configuring Nginx and HTTPS

Install Nginx , Certbot, and the Nginx plugin.

Terminal
sudo apt install nginx certbot python3-certbot-nginx

Create the site configuration with sudoedit /etc/nginx/sites-available/odoo. Replace odoo.example.com with your domain.

/etc/nginx/sites-available/odoonginx
map $http_upgrade $odoo_connection_upgrade {
    default upgrade;
    ''      close;
}

server {
    listen 80;
    listen [::]:80;
    server_name odoo.example.com;

    client_max_body_size 64m;
    proxy_read_timeout 300s;

    proxy_http_version 1.1;
    proxy_set_header Host $host;
    proxy_set_header X-Forwarded-Host $host;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header X-Forwarded-Proto $scheme;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $odoo_connection_upgrade;

    location /websocket {
        proxy_pass http://127.0.0.1:8072;
    }

    location / {
        proxy_pass http://127.0.0.1:8069;
    }
}

The main location forwards web requests to Odoo’s HTTP workers, and /websocket reaches its evented worker. The map sets the connection header for requests that negotiate a WebSocket upgrade.

Enable the site and reload Nginx after checking the configuration.

Terminal
sudo ln -s /etc/nginx/sites-available/odoo /etc/nginx/sites-enabled/odoo
sudo nginx -t
sudo systemctl reload nginx

If UFW is active, allow HTTP and HTTPS before requesting the certificate.

Terminal
sudo ufw allow 'Nginx Full'

Request a Let’s Encrypt certificate and an HTTP-to-HTTPS redirect. Use the same domain as in the Nginx configuration.

Terminal
sudo certbot --nginx --redirect -d odoo.example.com

Once Certbot succeeds, open https://odoo.example.com and sign in with the administrator account you created. You can close the SSH tunnel. Verify the renewal configuration with a dry run.

Terminal
sudo certbot renew --dry-run

Troubleshooting

Odoo cannot connect to PostgreSQL
Run sudo -u odoo psql -d odoo_prod -tAc 'SELECT current_user;' once the database exists. If the command fails, check that PostgreSQL is running, that the database exists, and that db_user matches the Linux user in the service file.

Nginx returns 502 or live updates stop working
Check sudo journalctl -u odoo -n 50 --no-pager and sudo nginx -t. A 502 on the main page points to port 8069. If the page loads but live updates fail, open https://odoo.example.com/websocket/health. It should return {"status": "pass"}. If it returns 502, check that the worker is listening on port 8072.

PDF reports are missing headers or footers
Run wkhtmltopdf --version and look for with patched qt. Restart Odoo after replacing the renderer, then regenerate the report.

PDF reports are missing styles after enabling HTTPS
The PDF renderer needs to fetch styles and images from Odoo. If it cannot reach the public URL from the server, enable developer mode in Odoo and set the report.url system parameter to http://127.0.0.1:8069. This gives the renderer a local URL for report assets.

Updating Odoo 20

Back up both the PostgreSQL database and the Odoo filestore before updating. Review Odoo’s bugfix update instructions and test updates on a copy before applying them to a live instance.

For an update on the same 20.0 branch, stop the service, pull the latest source, check for new dependencies, and start Odoo again.

Terminal
sudo systemctl stop odoo
sudo -u odoo -H git -C /opt/odoo/odoo pull --ff-only
sudo apt update
read -r -a odoo_packages <<< "$(sudo -u odoo sh /opt/odoo/odoo/setup/debinstall.sh --list)"
sudo apt-get install "${odoo_packages[@]}" python3-lxml-html-clean python3-markdown2
sudo systemctl start odoo

Check the journal after starting Odoo and open the application over HTTPS. Moving an existing database from a different Odoo major version is a separate database upgrade .

Conclusion

Before adding live business data, set up automatic Odoo backups and test a restore on a separate server (the odoo role on this one can no longer create databases). Restoring the database together with the matching filestore preserves your uploaded documents and other attachments.

Linuxize Weekly Newsletter

A quick weekly roundup of new tutorials, news, and tips.

About the authors

Dejan Panovski

Dejan Panovski

Dejan Panovski is the founder of Linuxize, an RHCSA-certified Linux system administrator and DevOps engineer based in Skopje, Macedonia. Author of 1000+ Linux tutorials with 20+ years of experience turning complex Linux tasks into clear, reliable guides.

View author page