Overview

This chapter starts immediately after your Oracle Cloud VM is created and reachable via SSH, running Ubuntu 24.04 LTS. By the end of this chapter, your server will have a clean package baseline, PostgreSQL installed and running, and a dedicated directory structure for Odoo.

Prerequisites
  • Oracle Cloud VM running Ubuntu 24.04 LTS
  • SSH access to the VM
  • A user account with sudo privileges

Install Required Packages

Start by updating the package index and upgrading all installed packages to ensure a clean, secure baseline.

bash
sudo apt update
sudo apt upgrade -y
Tip

Run sudo reboot if the kernel or critical system libraries were upgraded. Reconnect via SSH after the reboot completes.

Install all build dependencies that Odoo's Python packages require during compilation.

bash
sudo apt install -y \
    git python3 python3-venv python3-pip \
    build-essential gcc g++ \
    libxml2-dev libxslt1-dev \
    libldap2-dev libsasl2-dev \
    libpq-dev libjpeg-dev zlib1g-dev \
    node-less npm
Why these packages?

Packages like libxml2-dev, libldap2-dev and libpq-dev are C-level headers required to compile Python wheels for lxml, python-ldap and psycopg2. Without them, pip install will fail during the Odoo setup step.

Install PostgreSQL

Install PostgreSQL from the official Ubuntu repositories.

bash
sudo apt install -y postgresql

Verify that the service started correctly.

bash
sudo systemctl status postgresql --no-pager

Create the Odoo Database User

Create a dedicated PostgreSQL role named odoo. This role has permission to create databases (required so Odoo can create and manage its own database), but is not a superuser.

bash
sudo -u postgres createuser -d -R -S odoo
Flag reference
FlagMeaning
-dAllow the role to create databases
-RPrevent the role from creating other roles
-SNot a superuser
Security: local socket authentication

This guide intentionally uses local peer authentication via Unix sockets. Odoo connects to PostgreSQL through a socket, not over TCP/IP, so no password needs to be stored in odoo.conf. Never expose PostgreSQL directly to the Internet.

Recommended Directory Layout

Create a clean, self-contained directory at /opt/odoo that will hold all Odoo-related files. Keeping everything under a single directory makes backups, upgrades, and permission management straightforward.

bash
sudo mkdir -p /opt/odoo/{community,enterprise,custom,logs,venv}
sudo chown -R odoo:odoo /opt/odoo
tree
/opt/odoo/
├── community/   ← Odoo Community source (git clone)
├── enterprise/  ← Odoo Enterprise source (git clone)
├── custom/      ← Your custom addons
├── logs/        ← Odoo log files
└── venv/        ← Python virtual environment
Best practice

Keeping custom modules outside the Community and Enterprise repositories makes upgrades much easier. You can pull the latest Community/Enterprise code without touching your customizations.

Verification

Before proceeding to the next chapter, confirm the following.

CheckCommandExpected Result
Ubuntu updateduname -rCurrent kernel version
Dependencies installedpython3 --versionPython 3.x.x
PostgreSQL runningsudo systemctl is-active postgresqlactive
Odoo DB user createdsudo -u postgres psql -c "\du odoo"Role listed
Directory createdls /opt/odoocommunity, enterprise, custom, logs, venv
  • Ubuntu updated and optionally rebooted
  • System dependencies installed without errors
  • PostgreSQL is running
  • odoo PostgreSQL role exists
  • /opt/odoo directory structure created
Next step

The next chapter covers cloning the Community and Enterprise repositories, creating the Python virtual environment, and installing all Python dependencies.

Back to top