Odoo 18 Installation Guide for Ubuntu 24.04

TEAM-BASSAM
November 14, 2024
odoo-18-installation-guide

Let us analyse the advantages of the Ubuntu 24.04 and Odoo 18 collaboration by checking the step-by-step installation guide. Like any other Odoo version, the Odoo 18 installation for Ubuntu can also be completed efficiently by following a systematic process.

Steps to Odoo 18 Installation

1. Login to the Ubuntu Server through SSH

Before Odoo Installation to a remote server, connect to that server remotely using ssh. You can avoid this step if you are installing it on a local system.

ssh username@remote_server -i ~/.ssh/id_rsa

2. Remember to Update Server Packages

Use the following commands to update and upgrade packages to the newer versions.

sudo apt update

sudo apt upgrade -y

(We can use apt or apt-get for this process)

3. Ensure that your server is secure

Improve server security by installing opens sh-server and fail2ban packages. By following these steps, we can ensure an extra layer of protection by detecting and blocking potential security threats.

sudo apt install opens sh-server fail2ban

Now, start the fail2ban service to start it automatically on boot.

sudo systemctl start fail2ban

sudo systemctl enable fail2ban

Now, Verify fail2ban Status: This is to ensure fail2ban is running without error. This can be checked with:

sudo systemctl status fail2ban

unauthorized access.

4. Proceed to Odoo 18 Installation: Install Packages and Libraries

Some packages and libraries, which work as dependencies are essential to proceed with Odoo installation as Odoo is built on Python.

Install Python 3 pip, a package installer for Python essential to manage Python libraries.

sudo apt install python3-pip

Now, it is time to Install Development Libraries and Dependencies:

sudo apt install -y git python3-venv 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 lib-atlas-base-dev

We decide the packages and libraries to be installed based on the Odoo and Ubuntu versions. The best-suited dependencies for each version help you prevent issues during installation and operation.

Here, we need to install node.js and npm.

node.js is important to complete various frontend tasks. The package manager used here is NPM.

sudo apt install -y npm

After installing node.js, create a Symlink for node.js.

Though Node.js can sometimes be installed as nodejs, some applications may expect node and to ensure this compatibility we need to create a symlink.

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

Then, you have to install less and less-plugin-clean-css: Here, Less is a CSS pre-processor. Clean CSS plugin helps us minify CSS files.

sudo npm install -g less less-plugin-clean-CSS

Next is to install node-less: We can use this package to integrate Less with node.js.

sudo apt install -y node-less

5. Install and Configure PostgreSQL

Install PostgreSQL as the database back-end for Odoo and then create a PostgreSQL user named odoo18.

The command to Install the PostgreSQL database server is below:

sudo apt install PostgreSQL -y

After completing this step, you need to switch to the PostgreSQL User.

As PostgreSQL uses its user account for database management, create a new user by switching to this account.

sudo su – postgres

Now, Create a new Database User and enter a password for this user.

create user-created –username postgres –no-create role –superuser –pwprompt odoo18

created: This allows the user to create databases.

username postgres: Using this you can specify the PostgreSQL superuser.

no-create role: We can prevent the user from creating roles.

superuser: This grants superuser privileges.

pwprompt: we can prompt a password for the new user using this.

odoo18: The name of the new user.

Now we need a username and password on the configuration file. When we talk about Postgres, it uses a distinct system user to perform tasks.

psql

ALTER USER odoo17 WITH SUPERUSER;

\q

exit

6. Install Wkhtmltopdf

Now, it’s our task to find a solution for generating PDF reports. For an Odoo 18, we need to go for a wkhtmltopdf version that is higher than 0.12.2. Do you know that Wkhtmltopdf is an open-source command line tool to render HTML data into PDF format using Qt Webkit? Let us follow the below-given steps to install wkhtmltopdf on your Ubuntu 24.04 server.

sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb

sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb

You may also experience some errors while using the above commands. This is because some dependencies (eg. libssl1.1 ) could not be installed. Once you notice such errors, continue to install those dependent packages separately. You can run the above command after completing the installation.

dpkg: dependency problems prevent configuration of wkhtmltox:

wkhtmltox depends on libssl1.1; however:

Package libssl1.1 is not installed.

wkhtmltox depends on fonts-75dpi; however:

Package fonts-75dpi is not installed.

wkhtmltox depends on fonts-base; however:

Package fonts-base is not installed.

You may sometimes encounter the above-mentioned errors. In such cases, you have to run the below-listed commands to install dependencies and then wkhtmltopdf. If you do not encounter such an error, you can skip these commands.

wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.0g-2ubuntu4_amd64.deb

sudo dpkg -i libssl1.1_1.1.0g-2ubuntu4_amd64.deb

sudo apt --fix-broken install

sudo apt install fonts-75dpi fonts-base

sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb

7. Create an Odoo User

In the next step, we need to create a new user named odoo18 with a home directory /home/odoo. This step helps us prevent security risks posed by running Odoo under the root user. In this step, you can use any name for your user, the only thing to remember is to use the same name as the PostgreSQL user.

sudo useradd -m -d /home/odoo -U -r -s /bin/bash odoo18

system: This helps to create a system user with a lower UID.

home=/home/odoo: Here you can specify the home directory for the user.

group odoo18: This step helps you create a group with the same name and assigns the user to it.

By completing this step, you ensure that Odoo has a dedicated user and database to securely manage operations.

8. Install Odoo

In this step, we can clone version 18.0 from the Odoo repository. Use odoo17 and the inside.

  •  /home/odoo directory for this.
  • sudo su – odoo18
  • cd ~/home/odoo
  • git clone —branch=18.0 —depth=1 —single-branch https://www.github.com/odoo/odoo

Here, we will discuss the method to install Odoo using a Python virtual environment. We can run the below commands to create a virtual environment and connect to it.

python3 -m venv odoo18-venv

source odoo18-venv/bin/activate

After completing this, we need to install the necessary Python packages for Odoo 18. This can be done by using the requirements.txt file located in the Odoo directory.

pip3 install wheel

pip3 install -r Odoo/requirements.txt

deactivate

9. Create a Directory for Custom Modules

mkdir /home/odoo/custom_addons

Create a directory and add it to the addons_path parameter that defines a list of directories where Odoo searches for modules. Now, switch back from Odoo user and exit.

10. Setup Configuration File for Odoo

Specific information, including database user, password, add-on locations, and more are required for the efficient use of Odoo. It is suggested to create a configuration file to streamline the process. Otherwise, we will have to provide them during each run.

sudo nano /etc/odoo.conf

You can either check a sample of the configuration file inside the Odoo folder or copy the content from the section below.

[options]

addons_path = /home/odoo/odoo/addons,/home/odoo/custom_addons  

data_dir = /home/odoo/.local/share/Odoo

admin_passwd = "your_admin_password"

db_host = False

db_name = False  

db_filter=False  

db_password = False

db_port = 5432

db_user = odoo18

list_db = True

log_db = False

log_db_level = warning

log_handler = :INFO

log_level = info

logfile = /var/log/odoo/odoo.log

To grant system user odoo18 access to this config file follow the below steps.

sudo chown odoo18: /etc/odoo.conf

sudo chmod 640 /etc/odoo.conf

It is time to create a log directory for Odoo. Now, set the necessary permissions for odoo18 to access it.

sudo mkdir /var/log/odoo

sudo chown odoo18: /var/log/odoo

11. Create an Odoo Service File

A system service file needs to be created for Odoo to help in starting/stopping/restarting the Odoo server.

sudo nano /etc/systemd/system/odoo-server.service

You can now copy and paste the above content making sure of the accuracy of the information. Remember to incorporate the changes you have made while following this blog.

[Unit]

Description=Odoo18

Requires=postgresql.service

After=network.target PostgreSQL.service

[Service]

Type=simple

SyslogIdentifier=odoo18

PermissionsStartOnly=true

User=odoo18

Group=odoo18

ExecStart=/home/odoo/odoo18-venv/bin/python3 /home/odoo/odoo/odoo-bin -c /etc/odoo.conf

StandardOutput=journal+console

[Install]

WantedBy=multi-user.target

Finally, set the necessary permissions and start the Odoo server

sudo chmod 755 /etc/systemd/system/odoo-server.service

sudo chown root: /etc/systemd/system/odoo-server.service

sudo systemctl start odoo-server.service

Using the above command, you can start the odoo-server.

Then, use the below-given command to check the status of the odoo-server.

systemctl status odoo-server.service

12. Create and Access the Odoo Database

Once you complete the Odoo installation, the status will be active. We can now access Odoo using the following URL. The URL will redirect you to the database create page and enable you to create the Odoo database.

Odoo runs on port 8069 by default. If not, we can also configure this from the configuration file.

http://localhost_or_ip_address:8069

Let us use the below command to access the Odoo log file.

tail -f /var/log/odoo/odoo.log

If you want to stop the Odoo servicer, use the below command

sudo service odoo-server stop

To start the odoo server, use the below command.

sudo service odoo-server start

Follow the below command to restart the Odoo server.

sudo service odoo-server restart

After completing the above-listed processes, you can run your Odoo 18 on the Ubuntu 24.04 server. This will be accessible via your browser and will be set to configure to start automatically on boot.

This odoo 18 installation guide will help you install the ERP and also use it for future reference. Better knowledge about the necessary libraries and packages is essential for troubleshooting all related issues.

Bassam Infotech, a leading Odoo Implementation Company, helps you complete your process with ease.

"Unlock the Full Potential of Your Business with Odoo ERP!"

"Get a Cost Estimate for Your ERP Project, Absolutely FREE!"

Get a Free Quote

Leave a Reply

Your email address will not be published. Required fields are marked *