Setting Up an Odoo 18 Development Environment on Ubuntu 24.04

How to Setup an Odoo 18 Community Edition Development Environment on Ubuntu 24.04
November 16, 2024 by
Setting Up an Odoo 18 Development Environment on Ubuntu 24.04
Hamed Mohammadi
| No comments yet

This guide walks you through the steps required to set up a development environment for Odoo 18 Community Edition on Ubuntu 24.04. With this setup, you can run Odoo 18 locally for development and testing of custom modules.

Step 1: Install Essential Tools and Dependencies

Begin by installing essential tools and dependencies required for Odoo. Open a terminal and run the following commands:

sudo apt update
sudo apt install git python3-pip build-essential wget python3-dev python3-venv python3-wheel libfreetype-dev libxml2-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools node-less libjpeg-dev zlib1g-dev libpq-dev libxslt1-dev libldap2-dev libtiff-dev libjpeg8-dev libopenjp2-7-dev liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev libxcb1-dev

Step 2: Add Support for Right-to-Left Languages (Optional)

If you need support for right-to-left languages like Arabic, Persian, or Hebrew, install the rtlcss package:

  1. Install Node.js and npm:
    sudo apt install npm
    
  2. Install rtlcss globally using npm:
    sudo npm install -g rtlcss
    

Step 3: Install PostgreSQL

Odoo uses PostgreSQL as its database backend. To install and configure PostgreSQL:

  1. Install PostgreSQL:
    sudo apt install postgresql
    
  2. Create a PostgreSQL user for the current system user:
    sudo -u postgres createuser -d -R -S $USER
    createdb $USER
    

Note: Since the PostgreSQL user matches your Unix login, you can connect to the database without a password.

Step 4: Install wkhtmltopdf

Odoo relies on wkhtmltopdf for generating PDF reports. Version 0.12.6 is required for compatibility with headers and footers.

Since there's no wkhtmltopdf package for Ubuntu 24.04 (Noble), you can use the package for Ubuntu Jammy. Here's how:

  1. Download the package:
    wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.jammy_amd64.deb
    
  2. Install it using dpkg:
    sudo dpkg -i ~/downloads/wkhtmltox_0.12.6.1-3.jammy_amd64.deb
    

Step 5: Install and Configure Odoo 18

Now, let’s install Odoo from its source code and configure the development environment.

  1. Clone the Odoo 18 repository:

    git clone https://www.github.com/odoo/odoo --depth 1 --branch 18.0
    

    Using --depth 1 ensures a smaller download and fetches only the 18.0 branch.

  2. Navigate to the Odoo folder:

    cd odoo
    
  3. Create a Python virtual environment:

    python3 -m venv .venv
    
  4. Activate the virtual environment:

    source .venv/bin/activate
    
  5. Install Python dependencies:

    (.venv) pip3 install wheel
    (.venv) pip3 install -r odoo/requirements.txt
    

    If you encounter any compilation errors, ensure all prerequisites mentioned earlier are correctly installed.

  6. Run Odoo with the following command:

    (.venv) python3 odoo-bin --addons-path=addons -d mydb
    

Step 6: Create Custom Modules

To scaffold a new custom module, use the following command:

(.venv) python3 odoo-bin scaffold odoo_custom_addon /path/to/custom/addons/

Replace /path/to/custom/addons/ with the directory where you want to create your module.

Final Thoughts

You’ve now successfully set up a development environment for Odoo 18 Community Edition on Ubuntu 24.04. This environment is perfect for testing and developing custom Odoo modules. If you run into any issues, double-check the dependencies and revisit the steps for configuration.

in Odoo
Setting Up an Odoo 18 Development Environment on Ubuntu 24.04
Hamed Mohammadi November 16, 2024
Share this post
Tags
Archive

Please visit our blog at:

https://zehabsd.com/blog

A platform for Flash Stories:

https://readflashy.com

A platform for Persian Literature Lovers:

https://sarayesokhan.com

Sign in to leave a comment