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:
- Default SSH Port:
ssh username@server_ip_address
- Custom SSH Port:
ssh -p port_number username@server_ip_address
- 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
- Install OpenSSH Server:
sudo apt-get install openssh-server
- Install Fail2Ban:
sudo apt-get install fail2ban sudo systemctl start fail2ban sudo systemctl enable fail2ban
- Verify Fail2Ban Status:
sudo systemctl status fail2ban
Step 4: Install Packages and Libraries
Install the prerequisites for Odoo 18:
- Python 3 Pip:
sudo apt-get install -y python3-pip
- 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
- Node.js and NPM:
sudo apt-get install -y npm sudo ln -s /usr/bin/nodejs /usr/bin/node
- Plugin for Clean CSS:
sudo npm install -g less less-plugin-clean-css
- Install Node-Less:
sudo apt-get install -y node-less
Step 5: Set Up the Database Server
- Install PostgreSQL:
sudo apt-get install -y postgresql
- Switch to the PostgreSQL User:
sudo su - postgres
- Create PostgreSQL User:
createuser --createdb --username postgres --no-createrole --superuser --pwprompt odoo18
- Exit:
exit
Step 6: Create a System User for Odoo
sudo adduser --system --home=/opt/odoo18 --group odoo18
Step 7: Clone the Odoo Repository
- Install Git:
sudo apt-get install -y git
- Switch to Odoo User and Clone Repository:
sudo su - odoo18 -s /bin/bash
- Clone the Odoo Repository:
git clone https://www.github.com/odoo/odoo --depth 1 --branch master --single-branch .
- Exit the Odoo User Session:
exit
Step 8: Install Python Dependencies
- Python Virtual Environment:
sudo apt install -y python3-venv
- Create a Python Virtual Environment:
sudo python3 -m venv /opt/odoo18/venv
- Activate and Install Dependencies:
sudo -s cd /opt/odoo18/ source venv/bin/activate
- Install Python Dependencies:
pip install -r requirements.txt
- Install wkhtmltopdf:
sudo wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.bionic_amd64.deb
- 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 - Install Additional Fonts:
sudo apt-get install -y xfonts-75dpi
- Install wkhtmltopdf Package:
sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb
- Fix Dependency Issues:
sudo apt install -f
- Deactivate Virtual Environment:
deactivate
Step 9: Configure Odoo
- Copy Configuration File:
sudo cp /opt/odoo18/debian/odoo.conf /etc/odoo18.conf
- Edit Configuration File:
sudo nano /etc/odoo18.conf
- 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
- Set Permissions:
sudo chown odoo18: /etc/odoo18.conf sudo chmod 640 /etc/odoo18.conf
- Create a Log Directory:
sudo mkdir /var/log/odoo sudo chown odoo18:root /var/log/odoo
Step 10: Set Up Odoo as a Service
- Create Service File:
sudo nano /etc/systemd/system/odoo18.service
- 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
- Set Permissions:
sudo chmod 755 /etc/systemd/system/odoo18.service sudo chown root: /etc/systemd/system/odoo18.service
- 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.
Responses