Skip to Content

Setup Odoo Development Environment

Step 1: Update the Server


Before proceeding with the installation of Odoo 18, verify that your Ubuntu 24.04 server is current. This will ensure you have the latest security fixes and software improvements.

1. Update the package list:

sudo apt-get update

2. Upgrade installed packages:

sudo apt-get upgrade

This operation might take several minutes, depending on how many updates are needed. After it is done, your server will be fully updated and set for the next procedures.

Step 2: Install Packages and Libraries

To make sure Odoo 18 runs effectively, you must install several important packages and libraries. Please follow these guidelines:

1. Install Python 3 Pip

Pip is the package installer for Python, required to manage Python libraries:

sudo apt-get install -y python3-pip

2. Install Development Libraries and Dependencies

These libraries are necessary for building and running Odoo and its dependencies:

sudo apt-get install -y python3-dev libxml2-dev libxslt1-dev zlib1g-dev libsasl2-dev libldap2-dev build-essential libssl-dev libffi-dev libmysqlclient-dev libjpeg-dev libpq-dev libjpeg8-dev liblcms2-dev libblas-dev libatlas-base-dev


3. Install Node.js and NPM

Node.js is required for front-end tasks:

sudo apt-get install -y npm

Create a symlink for Node.js to ensure compatibility with some applications:

sudo ln -s /usr/bin/nodejs /usr/bin/node

4. Install Less and Clean CSS Plugin

Less is a CSS pre-processor, and clean CSS helps minify CSS files:

sudo npm install -g less less-plugin-clean-css
sudo apt-get install -y node-less

Step 3: Set Up the Database Server

Odoo 18 operates with PostgreSQL as its database management system.

Use the following guidelines to install and configure PostgreSQL:

1. Install PostgreSQL:

sudo apt-get install -y postgresql

2. Switch to the PostgreSQL user:

sudo su - postgres

3. Create a new database user for Odoo:

createuser --createdb --username postgres --no-createrole --superuser --pwprompt odoo18

odoo18: This is the name of the PostgreSQL user.

Next, grant superuser privileges to the specified user.

psql
ALTER USER odoo18 WITH SUPERUSER;

Finally, exit both psql and the Postgres user.

\q
exit

Step 4: Get Odoo Community Edition from GitHub

To install Odoo 18, clone the official repository from GitHub:

1. Install Git:

sudo apt-get install -y git

2. Clone the Odoo repository:

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

Step 5: Open the Odoo Project in PyCharm

Launch PyCharm Community Edition and navigate to the ‘Odoo18’ directory. Once the project is open, you might see a dialogue box similar to the one shown below. This is for creating a virtual environment; however, we'll set up the virtual environment via the terminal, so go ahead and cancel it.

To open the terminal, either click on the icon displayed below or use the shortcut Alt+F12.

Next, run the following commands to create a virtual environment using Python 3.12.

curl -sS https://bootstrap.pypa.io/get-pip.py | python3.12
sudo apt install python3.12-venv
python3.12 -m venv your_venv_name

After closing and reopening the terminal, you’ll notice that your virtual environment is active. The terminal will display an indicator with the name of your virtual environment, as shown below:

If your virtual environment doesn’t activate automatically, use the following command.

source  your_venv_name/bin/activate

Step 6: Install Required Python Packages

Odoo depends on several Python packages listed in the require file located in the ‘odoo18’ directory. To install these packages, execute the following command in the terminal:

pip install -r requirements.txt

If no errors occur, you can use the following command to verify that all the dependencies listed in requirements.txt have been successfully installed.

pip list


If you encounter any errors, open the requirements.txt file and install each dependency individually using the following command.

pip install requirement_name


In most cases, when installing packages listed twice, only one needs to be installed. So, if one fails to install, it usually isn’t an issue.

Additionally, if prerequisites defined with sys_platform as 'win32' fail to install, you can skip them.

If errors arise while installing the package "psycopg2==2.9.2 ; sys_platform != 'win32' and python_version <= '3.10' or psycopg2==2.9.5 ; python_version > '3.10' or sys_platform == 'win32'", use the following command to install an alternative package instead.

pip install psycopg2-binary

Step 7: Create the odoo.conf File in the odoo18 Directory

To create the configuration file, right-click the Odoo18 directory and select New -> File -> odoo.conf.

After creating the odoo.conf file, insert the following block of code, and make sure to update the db_password field with the password you set for the Odoo18 database user in the previous step.

[options]
admin_passwd = admin
db_host = localhost
db_port = 5432
db_user = odoo18
db_password = your_password
addons_path = /home/user/odoo18/addons
xmlrpc_port = 8018

Additionally, update the addons_path value with the actual path to the Odoo18 addons directory. You can obtain this path by navigating to the addons directory and pressing Ctrl + Shift + C. This will copy the current directory path, which you can then replace in the addons_path field. If you create a new directory for your custom modules, be sure to include its path in the addons_path, separated by commas.

eg: addons_path = /home/user/odoo/addons, /home/user/odoo/custom_addons

Step 8: Add Python Interpreter

To configure a Python interpreter, navigate to Settings -> Project: odoo18 -> Python Interpreter.

When you open the specified window, if the interpreter (Python 3.12 from the odoo18 virtual environment) is already configured, no changes are needed. Otherwise, choose the Add Interpreter option and proceed with the following selections.

Step 9: Configure the Project in PyCharm

To set up the project configuration, click Edit Configurations under Current File.

When the dialogue box appears, click the "+" button and choose "Python" from the list.

Then, fill in the fields as shown in the image below.

Name: You can assign any name to this configuration.

Python Interpreter: This field should include the Python interpreter for this project. Since we set up the interpreter in the previous step, it should populate automatically.

Script Path: Select the odoo-bin file located in the odoo18 directory.

Parameters: You can add parameters here to run with the script; the -c parameter is required. You may also need to include the configuration file as a parameter.

Working Directory: Specify the path to the project's current working directory here.

Step 10: Test Run Odoo

The Odoo setup is complete. You can now test it by clicking the button below to launch the project.

You can now test your setup by navigating to localhost:8018 in your browser. If all your configurations are correct, the browser will open the Odoo database management page, as shown below.


Sign in to leave a comment
How to Install Odoo 18 on Ubuntu 24.04 LTS Server

[Let’s make great things]

HAVE A PROJECT? SPEAK WITH OUR EXPERT


Tell us about your Challenge! , we are ready to solve.


Learn how we can drive you better business with the power of digital innovation. Book a free meeting and let us have a look at your opportunities with our smart solutions