How to Install Odoo 18 on Ubuntu 22.04: A Step-by-Step Guide

Odoo 18 is the latest version of the popular ERP system, packed with significant functional and technical improvements. This guide provides a comprehensive walkthrough for installing Odoo 18 on an Ubuntu 22.04 LTS server.


Step 1: Log in to the Ubuntu Server

To begin, access your Ubuntu server via SSH or a direct connection. Use one of the following methods:

  1. Default SSH Port:ssh username@server_ip_address
  2. Custom SSH Port:ssh -p port_number username@server_ip_address
  3. PEM Key Authentication:ssh -i /path/to/your/key.pem username@server_ip_address

Replace placeholders (e.g., username, server_ip_address) with your server details.


Step 2: Update the Server

Ensure your server is up-to-date:

sudo apt-get update
sudo apt-get upgrade

Step 3: Secure the Server

  1. Install OpenSSH Server:sudo apt-get install openssh-server
  2. Install Fail2Ban:sudo apt-get install fail2ban sudo systemctl start fail2ban sudo systemctl enable fail2ban
  3. Verify Fail2Ban Status:sudo systemctl status fail2ban

Step 4: Install Packages and Libraries

Install the prerequisites for Odoo 18:

  1. Python 3 Pip:sudo apt-get install -y python3-pip
  2. Development Libraries: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. Node.js and NPM:sudo apt-get install -y npm sudo ln -s /usr/bin/nodejs /usr/bin/node
  4. Plugin for Clean CSS: sudo npm install -g less less-plugin-clean-css
  5. Install Node-Less: sudo apt-get install -y node-less

Step 5: Set Up the Database Server

  1. Install PostgreSQL:sudo apt-get install -y postgresql
  2. Switch to the PostgreSQL User:sudo su - postgres
  3. Create PostgreSQL User: createuser --createdb --username postgres --no-createrole --superuser --pwprompt odoo18
  4. Exit: exit

Step 6: Create a System User for Odoo

sudo adduser --system --home=/opt/odoo18 --group odoo18

Step 7: Clone the Odoo Repository

  1. Install Git:sudo apt-get install -y git
  2. Switch to Odoo User and Clone Repository:sudo su - odoo18 -s /bin/bash
  3. Clone the Odoo Repository:git clone https://www.github.com/odoo/odoo --depth 1 --branch master --single-branch .
  4. Exit the Odoo User Session:exit

Step 8: Install Python Dependencies

  1. Python Virtual Environment:sudo apt install -y python3-venv
  2. Create a Python Virtual Environment:sudo python3 -m venv /opt/odoo18/venv
  3. Activate and Install Dependencies:sudo -s cd /opt/odoo18/ source venv/bin/activate
  4. Install Python Dependencies:pip install -r requirements.txt
  5. Install wkhtmltopdf:sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
  6. Install OpenSSL Dependency: sudo wget http://archive.ubuntu.com/ubuntu/pool/main/o/openssl/libssl1.1_1.1.1f-1ubuntu2_amd64.deb
       sudo dpkg -i libssl1.1_1.1.1f-1ubuntu2_amd64.deb
  7. Install Additional Fonts:sudo apt-get install -y xfonts-75dpi
  8. Install wkhtmltopdf Package:sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb
  9. Fix Dependency Issues:sudo apt install -f
  10. Deactivate Virtual Environment:deactivate

Step 9: Configure Odoo

  1. Copy Configuration File:sudo cp /opt/odoo18/debian/odoo.conf /etc/odoo18.conf
  2. Edit Configuration File:sudo nano /etc/odoo18.conf
  3. Add:[options] admin_passwd = admin db_host = localhost db_port = 5432 db_user = odoo18 db_password = 123456 addons_path = /opt/odoo18/addons logfile = /var/log/odoo/odoo18.log
  4. Set Permissions:sudo chown odoo18: /etc/odoo18.conf sudo chmod 640 /etc/odoo18.conf
  5. Create a Log Directory:sudo mkdir /var/log/odoo sudo chown odoo18:root /var/log/odoo

Step 10: Set Up Odoo as a Service

  1. Create Service File:sudo nano /etc/systemd/system/odoo18.service
  2. Add:[Unit] Description=Odoo18 Documentation=http://www.odoo.com [Service] Type=simple User=odoo18 ExecStart=/opt/odoo18/venv/bin/python3 /opt/odoo18/odoo-bin -c /etc/odoo18.conf [Install] WantedBy=default.target
  3. Set Permissions:sudo chmod 755 /etc/systemd/system/odoo18.service sudo chown root: /etc/systemd/system/odoo18.service
  4. Start Service:sudo systemctl start odoo18.service

Access Odoo

Navigate to:

http://<your_domain_or_IP_address>:8069

Monitor Logs

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

Enable the Odoo Service at Boot

sudo systemctl enable odoo18.service

By following these steps, you’ve successfully installed Odoo 18 on Ubuntu 22.04. This installation provides a robust platform for managing business operations efficiently.

Related Articles

Responses

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

Dev D Academy

Elevate your professional journey by joining our team!

PWM Download
Dev D Academy

Elevate your professional journey by joining our team!

PDM Download
Dev D Academy

Elevate your professional journey by joining our team!

101 Download
Dev D Academy

Elevate your professional journey by joining our team!

PITS Download