Odoo 14 uzstādīšana uz Debian / Ubuntu servera


Komandas jāveic ar letotāju, kam ir atbilstošās tiesības (parasti zemāk minētajām komandām iepriekš pievienojot "sudo".

Sistēmas un Postgresql uzstādīšana

apt update; apt -y upgrade
dpkg-reconfigure locales ## ieliek lv_LV.UTF-8
dpkg-reconfigure tzdata
apt install git postgresql postgresql-client postgresql-contrib
apt install postgresql-server-dev-XX # XX atbilstoši postgresql versijai
su - postgres -c 'psql template1 -c "CREATE EXTENSION \"unaccent\"";'
apt install python3-pip
apt install libsasl2-dev python-dev libldap2-dev libssl-dev
apt install wkhtmltopdf
addgroup odoo

Odoo uzstādīšana

mkdir -p /opt/odoo/14/odoo; cd /opt/odoo/14/odoo
git clone --branch 14.0 --depth 1 https://github.com/odoo/odoo.git .
pip3 install -r /opt/odoo/14/odoo/requirements.txt
adduser --system --home=/opt/odoo/home/odoo --ingroup odoo odoo
chown -R odoo:odoo /opt/odoo/home/odoo
mkdir /var/log/odoo/; sudo chgrp odoo /var/log/odoo
su - postgres -c "createuser --createdb --username postgres --no-createrole --no-superuser --no-password odoo" 
systemctl restart postgresql
cp /opt/odoo/14/odoo/debian/odoo.conf /opt/odoo/home/odoo/; chown odoo /opt/odoo/home/odoo/odoo.conf
touch /var/log/odoo/odoo1.log; sudo chown odoo /var/log/odoo/odoo.log
su - odoo -s /bin/bash -c "/opt/odoo/14/odoo/odoo-bin -c /opt/odoo/home/odoo/odoo.conf -s --logfile=/etc/stdout"
nano /opt/odoo/home/odoo/odoo.conf ## iestata db lietotāja vārdu, "template1" un addons_path
mkdir -p /var/odoo/filestore; sudo chmod 775 /var/odoo/filestore; sudo chgrp odoo /var/odoo/filestore
ln -s /var/odoo/filestore /opt/odoo/home/odoo/.local/share/Odoo/filestore
mkdir /opt/odoo/14/l10n_lv_addons; cd /opt/odoo/14/l10n_lv_addons
git clone --branch 14.0 --depth 1 https://github.com/odoo-latvia/l10n_lv_addons.git .
nano /lib/systemd/system/odoo.service # Aizpilda ar odoo.service skriptu
systemctl enable odoo1
systemctl start odoo1 

Odoo servisa vadības skripts (/lib/systemd/system/odoo.service)

[Unit]
Description=Odoo Open Source ERP and CRM
Requires=postgresql.service
After=network.target postgresql.service

[Service]
Type=simple
PermissionsStartOnly=true
SyslogIdentifier=odoo1
User=odoo1
Group=odoo
ExecStart=/opt/odoo/14/odoo/odoo-bin --config=/opt/odoo/home/odoo1/odoo.conf
WorkingDirectory=/opt/odoo/home/odoo1/
StandardOutput=journal+console

[Install]
WantedBy=multi-user.target