Instalasi Odoo di Ubuntu Server

Instalasi Odoo di Ubuntu Server
Photo by Joran Quinten / Unsplash

Dear Pembaca Setia,

Kali ini Penulis hendak berbagi pengalaman instalasi Odoo 17 di Ubuntu Server 22.04.

Sumber penulis dapatkan di:

Berikut adalah langkah-langkahnya

Step 1. Update the System

sudo apt-get update -y && sudo apt-get upgrade -y

Step 2. Install Python and Required Libraries

sudo apt-get install -y python3-pip python3-dev python3-venv 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 -y

Step 3. Install NPM and CSS plugins

sudo apt-get install -y npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo npm install -g less less-plugin-clean-css
sudo apt-get install -y node-less

Step 4. Install Wkhtmltopdf

sudo wget https://packages.ubuntu.com/jammy/wkhtmltopdf 
sudo apt install wkhtmltopdf -y
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin
sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin

Step 5. Install PostgreSQL

sudo apt-get install postgresql -y
sudo systemctl start postgresql && sudo systemctl enable postgresql
sudo systemctl status postgresql

Hasilnya test kira-kira

root@host:/# sudo systemctl status postgresql
● postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
Active: active (exited) since Thu 2023-11-23 03:42:11 CST; 18s ago
Main PID: 20712 (code=exited, status=0/SUCCESS)
CPU: 3ms

Nov 23 03:42:11 host.test.vps systemd[1]: Starting PostgreSQL RDBMS...
Nov 23 03:42:11 host.test.vps systemd[1]: Finished PostgreSQL RDBMS.

Step 6. Create Odoo and PostgreSQL users

useradd -m -U -r -d /opt/odoo17 -s /bin/bash odoo17
usermod -a -G sudo odoo17

Jangan lupa untuk ubah password nya

passwd odoo17
New password: YourStrongPasswordHere
Retype new password: YourStrongPasswordHere
passwd: password updated successfully
sudo su - postgres -c "createuser -s odoo17"

Step 7. Install and Configure Odoo 17

su - odoo17

git clone https://www.github.com/odoo/odoo --depth 1 --branch 17.0 /opt/odoo17/odoo17

Mengaktifkan Python virtual environment

cd /opt/odoo17

python3 -m venv odoo17-venv

source odoo17-venv/bin/activate

pip install --upgrade pip

pip3 install wheel

pip3 install -r odoo17/requirements.txt

Deactivate

deactivate

mkdir /opt/odoo17/odoo17-custom-addons

chown -R odoo17:odoo17 /opt/odoo17/odoo17-custom-addons

sudo mkdir -p /var/log/odoo17

sudo touch /var/log/odoo17.log

sudo chown -R odoo17:odoo17 /var/log/odoo17

Step 8. Create Odoo 17 configuration file

sudo touch /etc/odoo17.conf

Berikutnya jangan lupa untuk mengubah passwordnya juga. Password ini adalah Master Password nya Odoo

[options]
admin_passwd = YourStrongPasswordHere
db_host = False
db_port = False
db_user = odoo17
db_password = False
xmlrpc_port = 8069
logfile = /var/log/odoo17/odoo17.log
addons_path = /opt/odoo17/odoo17/addons,/opt/odoo17/odoo17-custom-addons

Step 9. Create an Odoo systemd unit file

sudo touch /etc/systemd/system/odoo17.service

Buka text editor favorite, dan edit file tersebut dengan konten berikut

[Unit]
Description=odoo17
After=network.target postgresql@14-main.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

Reload daemon

sudo systemctl daemon-reload

sudo systemctl start odoo17 && sudo systemctl enable odoo17

Check daemon

sudo systemctl status odoo17

Hasil yang keluar kira-kira

root@host:~# sudo systemctl status odoo17
● odoo17.service - odoo17
Loaded: loaded (/etc/systemd/system/odoo17.service; enabled; vendor preset: enabled)
Active: active (running) since Thu 2023-11-23 06:34:36 CST; 6s ago
Main PID: 44663 (python3)
Tasks: 4 (limit: 4558)
Memory: 72.0M
CPU: 2.406s
CGroup: /system.slice/odoo17.service
└─44663 /opt/odoo17/odoo17-venv/bin/python3 /opt/odoo17/odoo17/odoo-bin -c /etc/odoo17.conf

Nov 23 06:34:36 host.test.vps systemd[1]: Started odoo17.

Akses Odoo di port 8069

http://YourServerIPAddress:8069