Odoo is a management software that gives you control of your data and streamlines your processes. It acts like a digital hub for your business by managing everything from customers and inventory to sales and projects. Odoo is written in Python and JavaScript and seamlessly integrated with PostgreSQL to create powerful databases of your data in one place.
Installing Odoo on Ubuntu 24.04 is easy, and you can do it by following the steps mentioned in this guide.
Table of Contents:
- How to Install Odoo on Ubuntu 24.04
- Installing Odoo Dependencies (Python and Git)
- Creating Odoo Users
- Installing PostgreSQL
- Installing and Configuring wkhtmltopdf
- Installing and Configuring Odoo 17
- Starting and Testing Odoo 17
- How to Change Port Number for Odoo 17
- How to Configure Reverse Proxy for Odoo17 in Ubuntu 24.04
- Conclusion
1. How to Install Odoo on Ubuntu 24.04
To install Odoo you can clone its git repository and then set it by creating Odoo users. But before that, you have to install some prerequisite dependencies that are needed for the Odoo server to work. First, you will need a terminal with sudo privileges. This will help you manage Odoo services directly from the terminal. Next, a web browser is required to access the Odoo server.
Make sure Git is installed on your system, as this will help you to clone the Odoo latest stable version directly from the Git repository to your Ubuntu 24.04 system. As Odoo is written in Python, you will need Pip to manage the necessary Python libraries for Odoo. Lastly, make sure Node.js is available on your Ubuntu 24.04 as it is needed for some web-based features.
2. Installing Odoo Dependencies (Python and Git)
Before proceeding to dependencies installation, first start by updating your system’s current packages:
sudo apt update
Odoo 17 isn’t currently compatible with Python 3.12, so you’ll encounter issues if you try to install it that way. To solve this, use Python 3.11 instead. Additionally, there are some essential Python libraries we’ll need before proceeding. Here’s the command to get those dependencies set up.
sudo apt install build-essential wget git python3.11-dev python3.11-venv \
libfreetype-dev libxml2-dev libzip-dev libsasl2-dev \
node-less libjpeg-dev zlib1g-dev libpq-dev \
libxslt1-dev libldap2-dev libtiff5-dev libopenjp2-7-dev libcap-dev
Remember to paste the above command as it is. Also, you may encounter the following errors on the terminal while installing the dependencies.
To resolve the unable to locate packages error, run these commands:
sudo apt install software-properties-common
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt update
After installing all the Odoo dependencies, the next step is to create a dedicated Odoo user.
3. Creating Odoo Users
Instead of using root privileges, it’s recommended to create a dedicated user account for Odoo to improve security.
We’ll use a command to set up a new user named odoo17 (this name can be changed if needed). This user will have its home directory located at /opt/odoo17 and will use the bash shell by default.
sudo /usr/sbin/adduser \
--system \
--shell /bin/bash \
--gecos 'Odoo user' \
--group \
--home /opt/odoo17 \
odoo17
4. Installing PostgreSQL
Odoo relies on PostgreSQL as its database. For PostgreSQL installation, run:
sudo apt install postgresql
Enter Y to continue PostgreSQL installation.
Next, create an Odoo user. Since using the root user for database management is risky, we’ll create a dedicated user named odoo17 (this name can be adjusted if needed). This Odoo user has permission to manage the Odoo database.
To create the user, run this command while logged in as the Postgres user:
sudo su - postgres -c "createuser -s odoo17"
Remember, it is the same username that we have defined above for our Odoo directory.
We’ve successfully created both a system user and a PostgreSQL user, both named odoo17.
5. Installing and Configuring wkhtmltopdf
The next step is to install and configure the wkhtmltopdf. The wkhtmltopdf is an HTML to PDF conversion free and open-source tool. It uses your system’s behind-the-scenes rendering engine to create reports in various formats.
To download it, open a terminal window and type:
sudo apt install wkhtmltopdf
Enter Y to continue installation and wait for the process to finish. Now, you should be able to use wkhtmltopdf to convert webpages to your desired format.
6. Installing and Configuring Odoo 17
To install Odoo 17 or any latest version, first switch to the special user that we created earlier using the sudo su – odoo command. This keeps Odoo’s operations separate from your main account:
sudo su - odoo17
Next, use the git command to download the Odoo source code:
git clone https://www.github.com/odoo/odoo --depth 1 --branch 17.0 odoo17
Modify the above command if you are downloading any other version of Odoo.
Now, create a virtual environment specifically for Odoo using this command:
python3.11 -m venv odoo17-venv
This isolates Odoo’s Python dependencies from your system’s.
Now activate the virtual environment for Odoo. To use the newly created environment, run this command:
source odoo17-venv/bin/activate
You’ll see the environment name appear in your terminal prompt.
Now install the essential components Odoo requires using the pip3 install command:
pip3 install wheel setuptools pip --upgrade
Similarly, install the odoo/requirements.txt:
pip3 install -r odoo17/requirements.txt
Next, create a directory to store any custom modules you develop for Odoo:
mkdir /opt/odoo17/odoo17/custom-addons
Exit the odoo user with exit to switch back to your main account with administrative privileges:
exit
Now, create a new configuration file for Odoo:
sudo nano /etc/odoo17.conf
Paste the provided configuration details. Remember to replace PASSWORD with a strong password for database access.
[options]
admin_passwd = strongpasswordhere
db_host = False
db_port = False
db_user = odoo17
db_password = False
addons_path = /opt/odoo17/odoo17/addons,/opt/odoo17/odoo17/custom-addons
Save the file and exit.
Run the given editor command to create a service file for Odoo:
sudo nano /etc/systemd/system/odoo17.service
Paste the provided service definition. This tells the system how to run and manage Odoo.
[Unit]
Description=odoo17
Requires=postgresql.service
After=network.target postgresql.service
[Service]
Type=simple
SyslogIdentifier=odoo17
PermissionsStartOnly=true
User=odoo17
Group=odoo17
ExecStart=/opt/odoo17/odoo17-venv/bin/python3 /opt/odoo17/odoo17/odoo-bin -c /etc/odoo17.conf
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target
Save and close this file.
Update the system’s service list with sudo systemctl daemon-reload:
systemctl daemon-reload
Now, Odoo is ready to be used!
7. Starting and Testing Odoo 17
Now set Odoo to start automatically using this command:
systemctl enable --now odoo17
Authenticate when prompted.
This will make sure that Odoo starts whenever your system is started.
Run this command to check if Odoo is active:
systemctl status odoo17
Look for active (running) to confirm it’s working.
Odoo logs everything in a file called journalctl. You can view any errors by running:
sudo journalctl -u odoo17
This step is helpful if something seems wrong during startup.
Now, to access Odoo, open any browser on your Ubuntu 24.04 system and open this URL:
http://localhost:8069
This will take you to the Odoo setup page. Use the password found in the /etc/odoo.conf file (usually labeled admin_password) to proceed. This will get Odoo ready for you to test its functionalities
The above command is when you have configured Odoo for the local host, in case of a dedicated server, you can run this command by replacing the IP address:
http://YOUR_SERVER_IP_ADDRESS:8069
Odoo17 is successfully installed on your Ubuntu 24.04 system.
8. How to Change Port Number for Odoo 17
By default, Odoo listens for connections on port 8069. To improve Odoo server security, it’s recommended to change this port number.
Now open the /etc/odoo.conf file to restrict access and set a new port. After opening the configuration file, add the following lines:
xmlrpc_interface = 127.0.0.1
netrpc_interface = 127.0.0.1
xmlrpc_port = 1111
This restricts access to Odoo to your local machine (localhost) and sets the new port to 1111. Any of the unused ports can be defined for this.
In the end, restart Odoo services, which will apply all new settings:
sudo systemctl restart odoo
New security settings will be applied after running the above systemctl command.
Now, Odoo is only accessible from your machine on port 1111, making it more secure.
9. How to Configure Reverse Proxy for Odoo17 in Ubuntu 24.04
Right now, your Odoo website can only be reached at its internal address (http://YOUR_SERVER_IP_ADDRESS:8069). We can set up a web server as a reverse proxy to make it more user-friendly. This allows you to access Odoo using a regular domain name.
Using a reverse proxy has different advantages, like balancing traffic across servers, storing frequently accessed content for faster loading, reducing file sizes, and serving static files efficiently. In this step, we’ll install either Nginx or Apache. You only need to choose one – we’ll skip setting up the other option.
Install and Configure Nginx
First, install Nginx using this:
sudo apt install nginx
Now create a Nginx server block file:
sudo nano /etc/nginx/conf.d/odoo.conf
Paste the below content inside the file.
upstream odoo17 {
server 127.0.0.1:8069;
}
upstream odoochat {
server 127.0.0.1:8072;
}
server {
listen 80;
server_name yourdomain.com;
access_log /var/log/nginx/odoo17.access.log;
error_log /var/log/nginx/odoo17.error.log;
proxy_buffers 16 64k;
proxy_buffer_size 128k;
location / {
proxy_pass http://odoo17;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
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 https;
}
location /longpolling {
proxy_pass http://odoochat;
}
location ~* /web/static/ {
proxy_cache_valid 200 60m;
proxy_buffering on;
expires 864000;
proxy_pass http://odoo17;
}
}
Ensure to change the domain URL and the subdomain name that is pointing to your server IP address.
Finally, restart Nginx, so all settings get updated:
sudo systemctl restart nginx
Now, access Odoo17 at http://your_domain.com.
Install and Configure Apache
On the other hand, if you prefer Apache to Nginx, or it’s already set up, you can follow these steps.
First, install Apache if it is not on your Ubuntu:
sudo apt install apache2
Now, create a virtual host by creating the below configuration file:
sudo nano /etc/apache2/sites-enabled/odoo.conf
Simply paste the following content inside the file and ensure to update the domain URL:
<VirtualHost *:80>
ServerName yourdomain.com
ServerAlias www.yourdomain.com
ErrorLog ${APACHE_LOG_DIR}/yourdomain-error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
ProxyRequests Off
<Proxy *>
Order deny,allow
Require all granted
</Proxy>
ProxyPass / http://127.0.0.1:8069/
ProxyPassReverse / http://127.0.0.1:8069/
<Location />
Order allow,deny
Require all granted
</Location>
</VirtualHost>
To apply the changes, restart the Apache service using this command:
sudo systemctl restart apache2
Odoo17 is successfully set up on the Ubuntu 24.04 system.
Conclusion
Odoo is an all-in-one platform that can help you manage your businesses and network all in one place. Installing Odoo on Ubuntu 24.04 can be done by cloning the Odoo git repository directly from the Ubuntu terminal. Before you clone the Odoo repository, make sure that necessary dependencies like Python3, Pip, and Git must be installed. Your system also needs Node.js to seamlessly help Odoo to work. For detailed steps for Odoo 17 installation in Ubuntu 24.04, check the above article.
TUTORIALS ON LINUX, PROGRAMMING & TECHNOLOGY