How to Install Odoo 18 on Ubuntu 24.04 LTS Server
Step-by-Step Process to Install Odoo 18
Prerequisites
1.Update Your System
sudo apt update && sudo apt upgrade -y
2.Install Required Packages
sudo apt install -y git python3-pip python3-dev build-essential \
libssl-dev libffi-dev python3-setuptools \
libjpeg-dev libxml2-dev libxslt1-dev libmysqlclient-dev \
libpq-dev libldap2-dev libsasl2-dev \
zlib1g-dev
libssl-dev libffi-dev python3-setuptools \
libjpeg-dev libxml2-dev libxslt1-dev libmysqlclient-dev \
libpq-dev libldap2-dev libsasl2-dev \
zlib1g-dev
3. Install PostgreSQL
sudo apt install -y postgresql postgresql-server-dev-all
Create a PostgreSQL User:
sudo -u postgres createuser --createdb --username postgres --pwprompt odoo
4. Install Wkhtmltopdf (for PDF generation):
sudo apt install -y xfonts-75dpi xfonts-100dpi
sudo apt install -y wkhtmltopdf
sudo apt install -y wkhtmltopdf
Step 1: Install Odoo 18
1.Clone the Odoo Repository:
sudo git clone https://github.com/odoo/odoo --depth 1 --branch 18.0 /opt/odoo
2.Create a Python Virtual Environment:
cd /opt/odoo
python3 -m venv odoo-venv
source odoo-venv/bin/activate
python3 -m venv odoo-venv
source odoo-venv/bin/activate
3.Install Python Packages:
pip install wheel
pip install -r /opt/odoo/requirements.txt
pip install -r /opt/odoo/requirements.txt
Step 2: Configure Odoo
sudo nano /etc/odoo.conf
Or
if you want to add odoo.conf in odoo folder itself and run through there
Add the following configuration:
[options]
admin_passwd = your_admin_password
db_host = False
db_port = False
db_user = odoo
db_password = your_db_password
addons_path = /opt/odoo/addons
logfile = /var/log/odoo/odoo.log
Replace your_admin_password
and your_db_password
with secure passwords.
2.Set Permissions:
sudo chown odoo:odoo /etc/odoo.conf
sudo chmod 640 /etc/odoo.conf
3. Create Log Directory:
sudo mkdir /var/log/odoo
sudo chown odoo:odoo /var/log/odoo
Step 3: Start and Stop Odoo Manually
Starting Odoo
1 Navigate to the Odoo Directory:
cd /opt/odoo
2 Activate the Virtual Environment:
source odoo-venv/bin/activate
3 Start Odoo:
python3 odoo-bin -c /etc/odoo.conf
Odoo will start, and you should see log messages in the terminal.
Stopping Odoo:
To Stop Odoo, use CTRL+C
in the terminal where Odoo is running. This will terminate the process.
Step 4: Create Odoo Systemd Service
1. Create a systemd service file:
sudo nano /etc/systemd/system/odoo.service
2. Add the following content to the service file:
[Unit]
Description=Odoo
Documentation=http://www.odoo.com
After=network.target postgresql.service
[Service]
# Unix user that runs the Odoo service
User=odoo
# Working directory
WorkingDirectory=/opt/odoo
# Command to start Odoo (the virtual environment and configuration file are important)
ExecStart=/opt/odoo/odoo-venv/bin/python3 /opt/odoo/odoo-bin -c /etc/odoo.conf
# Restart Odoo service automatically if it crashes
Restart=always
[Install]
# Target for starting the service
WantedBy=multi-user.target
Documentation=http://www.odoo.com
After=network.target postgresql.service
[Service]
# Unix user that runs the Odoo service
User=odoo
# Working directory
WorkingDirectory=/opt/odoo
# Command to start Odoo (the virtual environment and configuration file are important)
ExecStart=/opt/odoo/odoo-venv/bin/python3 /opt/odoo/odoo-bin -c /etc/odoo.conf
# Restart Odoo service automatically if it crashes
Restart=always
[Install]
# Target for starting the service
WantedBy=multi-user.target
3.Reload the systemd daemon to apply the new service:
sudo systemctl daemon-reload
4.Start the Odoo service:
sudo systemctl start odoo
5. Check the status of the Odoo service:
If Odoo is running correctly, you should see output indicating that it is "active (running)."
6.Enable Odoo to start automatically on system boot:
sudo systemctl enable odoo
Step 5: Manage Odoo with Systemd
1. Start Odoo:
sudo systemctl start odoo
2. Stop Odoo:
sudo systemctl stop odoo
3. Restart Odoo:
sudo systemctl restart odoo
4. Check Odoo status:
sudo systemctl status odoo
5. Enable Odoo to start on boot:
sudo systemctl enable odoo
6. Disable Odoo from starting on boot:
sudo systemctl disable odoo
Step 6: Troubleshooting
1.Check Odoo logs:
If Odoo is not running correctly, you can check the logs for any errors.
tail -f /var/log/odoo/odoo.log
2. View system logs for Odoo service:
You can also check the system logs related to the Odoo service using the
journalctl
command. sudo journalctl -u odoo
3. Ensure the PostgreSQL service is running:
Odoo depends on PostgreSQL. Ensure it’s up and running:
sudo systemctl status postgresql
Step 7: Access Odoo in a Browser
Open your browser and access Odoo:
Go to
http://localhost:8069
or your ipaddress:8069 to access the Odoo web interface. Create a new database:
Follow the instructions on the screen to create your Odoo database and log in
Comments