Category: Odoo

  • How to Install the Latest Version of Odoo on Ubuntu

    How to Install the Latest Version of Odoo (18) on Ubuntu

    Odoo is a powerful, open-source suite of business applications covering everything from CRM and eCommerce to inventory and accounting. As of September 10, 2025, the latest major version is Odoo 18, which introduces enhancements like improved progressive web apps for mobile use, better performance, and new features in areas such as barcode scanning and point-of-sale systems. Installing Odoo on Ubuntu is straightforward, but it requires careful setup of dependencies like PostgreSQL and Python. This comprehensive guide covers two primary methods: using official deb packages (recommended for production environments due to ease of maintenance) and source installation (ideal for development or custom modifications). We’ll focus on Ubuntu 22.04 LTS (Jammy) or later, as it’s fully supported for Odoo 18.

    Important Notes Before Starting:

    • This guide assumes you have root or sudo access on a fresh Ubuntu installation.
    • Odoo Community Edition is free and open-source; Odoo Enterprise requires a subscription and additional steps for add-ons.
    • Always back up your system before installation.
    • For security, run Odoo behind a reverse proxy (e.g., Nginx) in production, but that’s beyond this guide’s scope.
    • wkhtmltopdf version 0.12.6 is required for PDF generation with headers/footers; install it manually if needed (see prerequisites).

    Prerequisites

    Regardless of the installation method, ensure these are in place:

    1. Update Your System:
       sudo apt update && sudo apt upgrade -y
    1. Install PostgreSQL (Database Server):
      Odoo uses PostgreSQL (version 12 or later) as its backend. Install it and create a database user.
       sudo apt install postgresql postgresql-client -y

    Create a PostgreSQL user matching your system username (to avoid password prompts):

       sudo -u postgres createuser -d -R -S $USER
       createdb $USER

    Secure PostgreSQL by setting a password for the postgres superuser (optional but recommended):

       sudo -u postgres psql -c "ALTER USER postgres PASSWORD 'your_strong_password';"
    1. Install wkhtmltopdf (for PDF Reports):
      Download and install version 0.12.6 from the official site (wkhtmltopdf.org/downloads.html). For Ubuntu:
       wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.jammy_amd64.deb
       sudo dpkg -i wkhtmltox_0.12.6.1-3.jammy_amd64.deb
       sudo apt install -f  # Fix any dependencies

    Verify: wkhtmltopdf --version should show 0.12.6.

    1. Python Requirements:
      Odoo 18 requires Python 3.10 or later. Ubuntu 22.04 comes with Python 3.10; verify with python3 --version. Install pip if needed:
       sudo apt install python3-pip -y
    1. Additional Packages for Specific Features:
    • For XLS exports on older Ubuntu (if applicable): sudo pip3 install xlwt
    • For textual number rendering (e.g., Mexican EDI): sudo pip3 install num2words
    • For right-to-left languages (Arabic/Hebrew): Install Node.js and sudo npm install -g rtlcss

    Method 1: Installation Using Official Deb Packages (Recommended for Production)

    This method installs Odoo as a system service, handles dependencies automatically, and is easier to update via apt. It’s supported on Ubuntu 22.04 LTS and above.

    Step 1: Add the Odoo Repository

    Download and add the Odoo signing key, then add the repository for the Community Edition:

    wget -q -O - https://nightly.odoo.com/odoo.key | sudo gpg --dearmor -o /usr/share/keyrings/odoo-archive-keyring.gpg
    echo 'deb [signed-by=/usr/share/keyrings/odoo-archive-keyring.gpg] https://nightly.odoo.com/18.0/nightly/deb/ ./' | sudo tee /etc/apt/sources.list.d/odoo.list
    sudo apt update

    Note: For Enterprise Edition, download the .deb file from the Odoo website (odoo.com/page/download) instead of using the repository, as there’s no nightly repo for Enterprise.

    Step 2: Install Odoo

    Install the Odoo package:

    sudo apt install odoo -y

    This installs Odoo as a systemd service, creates the necessary PostgreSQL user (odoo), and starts the server automatically.

    If using a downloaded .deb file (e.g., for Enterprise):

    sudo dpkg -i odoo_18.0-latest_all.deb  # May fail due to dependencies
    sudo apt install -f  # Install missing dependencies
    sudo dpkg -i odoo_18.0-latest_all.deb

    Step 3: Configure Odoo

    The configuration file is at /etc/odoo/odoo.conf. Edit it with sudo (e.g., sudo nano /etc/odoo/odoo.conf):

    • Set the admin password: admin_passwd = your_strong_master_password
    • Database settings: Ensure db_host = False (local PostgreSQL) and db_user = odoo
    • Add-ons path for Enterprise: If using Enterprise, point to the enterprise add-ons directory.
    • Example snippet:
      [options]
      admin_passwd = SuperSecretPassword
      db_host = False
      db_port = False
      db_user = odoo
      db_password = False
      addons_path = /usr/lib/python3/dist-packages/odoo/addons

    Restart the service: sudo systemctl restart odoo

    Note: The default port is 8069. For production, limit access and configure SSL.

    Step 4: Post-Installation

    • Enable and start the service: sudo systemctl enable odoo && sudo systemctl start odoo
    • Check status: sudo systemctl status odoo
    • Access Odoo at http://your_server_ip:8069. Create a new database; the master password is from the config.

    To upgrade: sudo apt upgrade odoo

    Method 2: Source Installation (For Development or Custom Setups)

    This method clones the Git repositories and runs Odoo directly, offering more flexibility for developers.

    Step 1: Install Git and Clone Repositories

    sudo apt install git -y
    git clone https://www.github.com/odoo/odoo --depth 1 --branch 18.0 /opt/odoo

    For Enterprise (requires subscription access):

    git clone https://www.github.com/odoo/enterprise /opt/odoo/enterprise

    Note: Use --depth 1 for a shallow clone to save space. The Enterprise repo only contains add-ons; the core is in Community.

    Step 2: Install Dependencies

    Navigate to the Odoo directory and install system dependencies:

    cd /opt/odoo
    sudo ./setup/debinstall.sh

    This script reads debian/control and installs required packages like python3-dev, libsass-dev, etc.

    Install Python dependencies via pip (in a virtual environment for isolation—recommended):

    sudo apt install python3-venv -y
    python3 -m venv odoo-venv
    source odoo-venv/bin/activate
    pip install -r requirements.txt
    deactivate  # When done

    Note: If errors occur (e.g., missing wheels), ensure python3-dev and build-essential are installed: sudo apt install python3-dev build-essential -y.

    Step 3: Set Up PostgreSQL User

    As in prerequisites, create a user for the Odoo system user:

    sudo adduser --system --home=/opt/odoo --group odoo
    sudo -u postgres createuser -d -R -S odoo

    Step 4: Configure and Run Odoo

    Create a config file /etc/odoo/odoo.conf (same as in Method 1, but adjust paths):

    [options]
    admin_passwd = SuperSecretPassword
    addons_path = /opt/odoo/addons,/opt/odoo/enterprise  # For Enterprise
    logfile = /var/log/odoo/odoo.log

    To run:

    cd /opt/odoo
    ./odoo-bin -c /etc/odoo/odoo.conf --stop-after-init  # Optional: Initialize
    ./odoo-bin -c /etc/odoo/odoo.conf -d your_database_name

    For Enterprise, ensure addons_path includes /opt/odoo/enterprise first.

    To run as a service, create a systemd unit file at /etc/systemd/system/odoo.service:

    [Unit]
    Description=Odoo
    After=network.target postgresql.service
    
    [Service]
    Type=simple
    SyslogIdentifier=odoo
    PermissionsStartOnly=true
    User=odoo
    Group=odoo
    ExecStart=/opt/odoo/odoo-venv/bin/python3 /opt/odoo/odoo-bin -c /etc/odoo/odoo.conf
    StandardOutput=journal+console
    
    [Install]
    WantedBy=multi-user.target

    Then: sudo systemctl daemon-reload && sudo systemctl enable odoo && sudo systemctl start odoo

    Step 5: Post-Installation

    Access at http://localhost:8069. Log in as admin/admin initially, then change the password. Update source code with git pull origin 18.0.

    Configuration Tips

    • Database Management: Use the web interface to create/backup databases. For CLI: createdb -O odoo yourdb.
    • Custom Add-ons: Place in a directory and add to addons_path in config.
    • Performance: Increase workers in config: workers = 2 (for multi-core).
    • Security: Change default ports, use HTTPS, and restrict PostgreSQL access in /etc/postgresql/*/main/pg_hba.conf.
    • Email Setup: Configure outgoing mail in Odoo settings for notifications.

    Running and Accessing Odoo

    • Start the server (via service or directly).
    • Open http://your_ip:8069 in a browser.
    • Create a database: Enter details, use master password from config.
    • Default login: admin (email) / admin (password)—change immediately!

    Monitor logs: sudo journalctl -u odoo or tail /var/log/odoo/odoo.log.

    Troubleshooting Common Issues

    • Port 8069 in Use: Kill conflicting processes or change xmlrpc_port in config.
    • PostgreSQL Connection Errors: Verify user creation and firewall (ufw allow 5432 if remote).
    • Dependency Errors: Run sudo apt install -f or check Python version.
    • wkhtmltopdf Issues: Ensure exact version 0.12.6; test with wkhtmltopdf --version.
    • Import Errors: For pip issues, use --no-cache-dir or upgrade pip: pip install --upgrade pip.
    • Service Won’t Start: Check sudo systemctl status odoo for clues; ensure paths in config are correct.
    • Enterprise Add-ons Not Loading: Verify git clone access and addons_path order.

    If problems persist, check Odoo’s official forums or logs for specific errors.

    Conclusion

    Installing Odoo 18 on Ubuntu provides a robust foundation for managing your business operations. The deb package method is ideal for quick, stable setups, while source installation suits developers needing customization. After installation, explore Odoo’s modular apps to tailor it to your needs. For upgrades or advanced topics like clustering, refer to the official documentation. Always test in a non-production environment first. Happy Odooing!