System Architecture and Component Relationships

Odoo 18 operates on a multi-tier architecture that separates presentation, application logic, and data storage layers. The web interface communicates with the Odoo application server, which processes business logic and manages database interactions. PostgreSQL serves as the primary data store, handling all transactional data, while the file system stores documents and attachments.

The installation stack begins with Ubuntu 22.04 as the operating system foundation. We install PostgreSQL 15 from the official repositories, providing database services with optimal performance characteristics. Python 3.10 serves as the runtime environment for Odoo’s application code, executed within a dedicated virtual environment that isolates package dependencies.

The component communication follows specific protocols. The Odoo server connects to PostgreSQL using psycopg2, the standard PostgreSQL adapter for Python. NGINX functions as a reverse proxy, handling incoming HTTP requests and forwarding them to the Odoo application server running on a local socket or TCP port.

The architecture supports horizontal scaling through additional application servers connected to a shared PostgreSQL database. Each component maintains distinct responsibilities, with clear interfaces between layers. This separation enables individual component upgrades, specialized optimization, and targeted troubleshooting when issues emerge.

Process Flow and Data Handling

User requests initiate a structured processing sequence. NGINX receives HTTP/HTTPS requests and proxies them to the Odoo application server via Unix socket or local port connection. The Odoo server processes the request through its middleware stack, executing business logic and generating database queries as needed.

PostgreSQL processes these queries, returning result sets to the Odoo application layer. The application server formats the data into HTML responses or JSON API payloads, which NGINX delivers to the client browser. This request-response cycle maintains stateless operation at the web server level, with session state managed within the Odoo application.

File storage follows a dual-path approach. Database records store structured data like customer information, products, and transactions. The file system retains binary attachments, documents, and generated reports, with Odoo maintaining reference pointers between database records and their associated files.

Component Dependencies and Requirements

The architecture imposes specific version requirements and compatibility constraints. Odoo 18 mandates Python 3.8 through 3.11, with Python 3.10 delivering optimal performance on Ubuntu 22.04. PostgreSQL 12 or newer provides database services, though PostgreSQL 15 offers significant performance improvements for concurrent operations.

System libraries like libxml2, libxslt, and libevent provide essential functionality for XML processing, document generation, and event-driven programming. Python packages including Pillow for image processing, reportlab for PDF generation, and NumPy for numerical computations extend Odoo’s core capabilities.

The package dependency tree requires careful management to prevent conflicts. The virtual environment isolates Odoo’s Python dependencies from system packages, ensuring consistent operation regardless of system updates. This isolation becomes critical when maintaining multiple Odoo instances or different versions on the same server.

System Preparation and Dependency Installation

Ubuntu 22.04 requires specific preparation before Odoo installation. Begin with a comprehensive system update to ensure all existing packages current. Execute apt update followed by apt upgrade to apply the latest security patches and bug fixes. Reboot the system if the kernel receives updates during this process.

Install the essential software packages that support Odoo’s operation. The package list includes development tools, database components, and system libraries necessary for Python package compilation. Use this command to install the foundational dependencies: apt install -y git curl wget build-essential libsasl2-dev libldap2-dev libssl-dev libxml2-dev libxslt1-dev libpq-dev python3-dev python3-pip python3-venv python3-wheel

PostgreSQL installation requires the official repository to ensure version compatibility. Add the PostgreSQL global development group repository with wget -q -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add - and echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" | sudo tee /etc/apt/sources.list.d/pgdg.list. Update the package cache and install PostgreSQL 15 using apt install -y postgresql-15 postgresql-client-15 postgresql-server-dev-15.

Create the system user that will run the Odoo service. This user should possess minimal privileges, following security best practices for service accounts. Execute useradd -m -d /opt/odoo -U -r -s /bin/bash odoo to create the user with a home directory at /opt/odoo. This directory will contain the Odoo source code, virtual environment, and configuration files.

PostgreSQL Database Configuration

Switch to the postgres system account to configure the database cluster. Execute su - postgres to assume the database administrator identity. Create the Odoo database user with the command createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo. Provide a strong password when prompted, storing it securely for later use.

Validate the database user creation with psql -c "SELECT usename FROM pg_user WHERE usename = 'odoo'". The command should return a single row containing the odoo username. Test the authentication by attempting connection as the odoo user: psql -h localhost -U odoo postgres. Exit the postgres account after completing these verification steps.

Configure PostgreSQL connection security to permit the Odoo service account to connect. Edit /etc/postgresql/15/main/pg_hba.conf and verify the local connection method includes “md5” authentication. The line should read “local all all md5” for socket connections and “host all all 127.0.0.1/32 md5” for TCP connections. Restart PostgreSQL with systemctl restart postgresql to apply changes.

Python Environment Setup

Create the Python virtual environment within the Odoo user’s home directory. Switch to the odoo service account using su - odoo. Execute python3 -m venv odoo-venv to create an isolated Python environment at /opt/odoo/odoo-venv. Activate this environment with source odoo-venv/bin/activate - your command prompt should reflect the activation.

Upgrade the core Python packaging tools within the virtual environment. Run pip install --upgrade pip setuptools wheel to ensure modern versions of these foundational packages. This step prevents compatibility issues when installing Odoo’s Python dependencies, particularly with binary packages that require compilation.

Install the additional system dependencies that support Python package compilation. Some Odoo dependencies require development headers for successful building. Install these packages while operating as the root user: apt install -y libjpeg-dev libfreetype6-dev zlib1g-dev libopenjp2-7 liblcms2-dev libharfbuzz-dev libfribidi-dev. Return to the odoo user account after completing these installations.

Odoo Source Code Installation and Configuration

Download the Odoo 18 source code from the official GitHub repository. Ensure you operate as the odoo service account with the virtual environment active. Clone the source code using git clone https://github.com/odoo/odoo.git odoo-18 --depth 1 --branch 18.0. The –depth 1 parameter creates a shallow clone with only the most recent commit history, conserving disk space.

Install the Python dependencies specified in Odoo’s requirements.txt file. Navigate to the odoo-18 directory and execute pip install -r requirements.txt. This process downloads and compiles numerous packages, including cryptography libraries, database adapters, and reporting components. Expect the installation to require five to ten minutes depending on system resources.

Verify the Odoo installation by attempting to start the application in direct mode. Execute python odoo-bin --help to confirm the core application loads without errors. The command should display Odoo’s help information, confirming the Python environment contains all necessary dependencies. Do not proceed if this test produces import errors or missing dependency warnings.

Odoo Configuration File Creation

Create the Odoo configuration file at /opt/odoo/odoo-18.conf. This file controls application behavior, database connections, and system resource allocation. Use a text editor to create the file with these essential parameters:

[options] admin_passwd = your_secure_master_password db_host = localhost db_port = 5432 db_user = odoo db_password = your_database_password addons_path = /opt/odoo/odoo-18/addons data_dir = /var/lib/odoo logfile = /var/log/odoo/odoo-18.log log_level = info proxy_mode = True without_demo = all

Set strict file permissions on the configuration file to protect database credentials. Execute chmod 640 /opt/odoo/odoo-18.conf and chown odoo:odoo /opt/odoo/odoo-18.conf. These permissions prevent unauthorized users from viewing the database password and master administration security key.

Create the log directory and data directory with proper ownership. Execute these commands as root: mkdir /var/log/odoo and chown odoo:odoo /var/log/odoo. Create the data directory with mkdir /var/lib/odoo and chown odoo:odoo /var/lib/odoo. These directories store application logs and generated files like session data and attachments.

Systemd Service Configuration

Create a systemd service file to manage Odoo as a system service. Create /etc/systemd/system/odoo-18.service with these contents:

[Unit] Description=Odoo 18 ERP After=postgresql.service

[Service] Type=simple User=odoo Group=odoo ExecStart=/opt/odoo/odoo-venv/bin/python3 /opt/odoo/odoo-18/odoo-bin -c /opt/odoo/odoo-18.conf KillMode=mixed Restart=on-failure RestartSec=5s

[Install] WantedBy=multi-user.target

Reload the systemd manager configuration to recognize the new service. Execute systemctl daemon-reload to load the service definition. Enable the Odoo service to start automatically at boot with systemctl enable odoo-18. Start the service immediately with systemctl start odoo-18 and verify its status using systemctl status odoo-18.

Check the Odoo log file to confirm successful startup. Execute tail -f /var/log/odoo/odoo-18.log and watch for these key messages: “Odoo version 18.0” and “Database odoo18 initialized”. The log should not contain Python tracebacks or database connection errors. Address any issues before proceeding to the web configuration.

NGINX Reverse Proxy Configuration

NGINX functions as a reverse proxy, handling SSL termination and static file serving. Install NGINX using apt install -y nginx. Create a new configuration file at /etc/nginx/sites-available/odoo-18 with these directives:

server { listen 80; server_name your-domain.com;

location / {
    proxy_pass http://127.0.0.1:8069;
    proxy_set_header Host $host;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    proxy_set_header X-Forwarded-Proto $scheme;
}

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

Enable the site configuration by creating a symbolic link to the sites-enabled directory. Execute ln -s /etc/nginx/sites-available/odoo-18 /etc/nginx/sites-enabled/odoo-18. Remove the default NGINX configuration with rm /etc/nginx/sites-enabled/default to prevent conflicts.

Test the NGINX configuration with nginx -t. The command should report “syntax is okay” and “test is successful”. Restart NGINX to apply the new configuration using systemctl restart nginx. Configure the firewall to permit HTTP traffic with ufw allow 80/tcp.

SSL Certificate Implementation

Secure the Odoo installation with SSL encryption using Let’s Encrypt certificates. Install Certbot and the NGINX plugin with apt install -y certbot python3-certbot-nginx. Obtain and install the SSL certificate by executing certbot --nginx -d your-domain.com. Follow the interactive prompts to complete the certificate installation.

Certbot automatically modifies the NGINX configuration to include SSL directives and redirect HTTP traffic to HTTPS. Verify the automatic renewal process works with certbot renew --dry-run. This test ensures certificate renewal will occur automatically before expiration.

Modify the Odoo configuration file to recognize the reverse proxy setup. Add these parameters to the [options] section in /opt/odoo/odoo-18.conf:

proxy_mode = True x_sendfile = True

Restart the Odoo service to apply these changes with systemctl restart odoo-18. Test the SSL configuration by accessing your domain with HTTPS in a web browser. The browser should display a secure connection without certificate warnings.

Database Management and Module Installation

Access the Odoo database management interface by navigating to http://your-domain.com/web/database/manager. Create a new database by specifying a name, selecting the appropriate language, and choosing demonstration data preferences. Use a descriptive database name that identifies the environment and purpose, such as “company_production” or “company_staging”.

Odoo creates the database schema, tables, and initial data during this process. The operation requires several minutes as Odoo installs core modules and creates the administrative account. Monitor the Odoo log file during this process to identify any potential issues: tail -f /var/log/odoo/odoo-18.log.

The database creation process establishes the fundamental structure for all Odoo applications. Core modules including base, mail, and web create the framework that supports business applications. Each additional module extends this foundation with specific functionality like accounting, inventory, or manufacturing capabilities.

Module Installation and Configuration

Install Odoo applications through the web interface or command-line tools. Access the Apps menu within Odoo and browse available applications. Use the search functionality to locate specific modules like “Accounting”, “Inventory”, or “Website Builder”. Click the Install button to add each application to your database.

Some modules require dependencies that Odoo installs automatically. The system displays dependency information during the installation process. Complex implementations may require specific installation sequences - always install financial modules before operational applications to ensure proper chart of accounts configuration.

Configure each module after installation through their respective settings menus. The Accounting module requires company information, fiscal year settings, and chart of accounts selection. The Inventory module needs warehouse definitions, operation types, and routing configurations. Complete these foundational settings before entering transactional data.

Database Backup and Recovery

Implement a robust backup strategy for Odoo databases. Use Odoo’s built-in backup functionality through the database management interface or employ PostgreSQL native tools. Schedule regular backups with pg_dump -Fc -U odoo database_name > /path/to/backup/backup_file.dump executed via cron job.

Test the backup restoration process to verify data recoverability. Create a test database and restore a backup file to validate the procedure. Use pg_restore -d test_database backup_file.dump to restore the backup. Compare record counts between the original and restored databases to ensure completeness.

Monitor database growth and performance metrics. Odoo databases expand rapidly with transaction history and document storage. Implement a retention policy that archives or purses historical data according to business requirements. Use PostgreSQL maintenance operations like VACUUM and REINDEX to maintain performance.

Security Hardening and Access Control

Implement comprehensive security measures to protect your Odoo installation. Begin with the master administrator password in the Odoo configuration file. This password controls access to the database management interface and should exceed 16 characters with mixed character classes. Store the password securely and restrict configuration file access.

Configure the Odoo access control parameters to limit system exposure. Set list_db = False in the configuration file to hide database listings from unauthenticated users. Implement dbfilter = ^your_database_name$ to restrict database access to specific naming patterns. These measures prevent unauthorized database enumeration attempts.

Establish strong password policies for user accounts. Odoo includes configurable password security requirements in the General Settings menu. Enable minimum length requirements, character complexity rules, and expiration periods according to your organizational security standards. Consider implementing two-factor authentication for administrative accounts.

Network Security Configuration

Configure the firewall to permit only essential network traffic. Allow SSH (port 22), HTTP (port 80), and HTTPS (port 443) while denying all other incoming connections. Use ufw enable followed by ufw allow 22,80,443/tcp to implement these rules. Consider restricting SSH access to specific source IP ranges for additional security.

Implement fail2ban to protect against brute force attacks. Install with apt install -y fail2ban and create a custom jail for Odoo authentication attempts. Create /etc/fail2ban/jail.d/odoo.conf with these parameters:

[odoo] enabled = true port = 8069,8072 filter = odoo logpath = /var/log/odoo/odoo-18.log maxretry = 5 bantime = 3600

Create the corresponding filter at /etc/fail2ban/filter.d/odoo.conf:

[Definition] failregex = ^.* WARNING odoo http: Login failed for db:.* login:.* from ignoreregex =

Restart fail2ban with systemctl restart fail2ban and monitor its operation with fail2ban-client status odoo. The service should detect failed login attempts and implement temporary IP address bans.

System Maintenance and Updates

Establish a regular maintenance schedule for system updates and security patches. Subscribe to Ubuntu security notifications and Odoo security advisories to stay informed about vulnerabilities. Test updates in a staging environment before applying them to production systems.

Monitor system logs and Odoo application logs for suspicious activity. Implement log rotation to prevent disk space exhaustion while retaining sufficient history for forensic analysis. Use logrotate to manage log files, creating /etc/logrotate.d/odoo with appropriate retention settings.

Perform regular security audits of user accounts and access permissions. Review Odoo user roles and access rights monthly to ensure compliance with the principle of least privilege. Remove inactive accounts and limit administrative access to essential personnel only.

Performance Optimization and Monitoring

Optimize PostgreSQL configuration for Odoo’s workload characteristics. Edit /etc/postgresql/15/main/postgresql.conf and adjust these key parameters:

shared_buffers = 25% of system RAM work_mem = 50MB maintenance_work_mem = 512MB effective_cache_size = 50% of system RAM checkpoint_completion_target = 0.9 random_page_cost = 1.1

Restart PostgreSQL after making these changes with systemctl restart postgresql. Monitor database performance using PostgreSQL’s built-in statistics collector and query analysis tools. Use EXPLAIN ANALYZE on slow queries to identify optimization opportunities.

Configure Odoo’s built-in caching mechanisms to reduce database load. Set osv_memory_count_limit = 2000000000 in the configuration file to increase the in-memory cache size. Enable workers = 4 to utilize multiple processor cores for concurrent request handling. Adjust the worker count based on available CPU cores and system memory.

Implement a dedicated file storage system for Odoo attachments and session data. Use high-performance storage with adequate IOPS capacity for the expected user load. Consider implementing a distributed file system for multi-server deployments or high-availability configurations.

System Monitoring and Alerting

Install and configure monitoring tools to track system health and performance. Use Prometheus with node_exporter for system metrics and PostgreSQL exporter for database performance data. Configure Grafana dashboards to visualize key performance indicators including response times, database connections, and system resource utilization.

Set up alerting for critical system conditions. Monitor disk space usage, memory consumption, and CPU load to prevent resource exhaustion. Configure database connection pool usage alerts to detect application issues before they impact users. Use Odoo’s built-in monitoring endpoint at /web/database/monitor for basic health checks.

Implement log aggregation and analysis to identify performance patterns and error conditions. Use the ELK stack (Elasticsearch, Logstash, Kibana) or Graylog to centralize log data from Odoo, PostgreSQL, and system components. Create alerts for specific error patterns that indicate system degradation or security issues.

Regular Maintenance Procedures

Schedule regular database maintenance during low-usage periods. Perform VACUUM ANALYZE operations weekly to update table statistics and reclaim storage space. Rebuild indexes quarterly to maintain query performance as data volumes increase. Monitor table bloat and transaction ID wraparound risks.

Establish a performance testing regimen for major configuration changes. Use tools like Apache JMeter to simulate user loads and measure response times under various conditions. Maintain a staging environment that mirrors production specifications for accurate performance validation.

Review and optimize custom code and reports regularly. Complex SQL queries and Python code can introduce performance bottlenecks as data volumes grow. Use Odoo’s built-in profiling tools to identify slow operations and optimize database access patterns in custom modules.