meta données pour cette page
Installation de Odoo
Ressources
via paquet Debian
Suite à l'installation d'une Dibian fraiche, on peut installer le paquet odoo depuis ce dépot :
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys DEF2A2198183CBB5 echo "deb http://nightly.odoo.com/15.0/nightly/deb/ ./" >> /etc/apt/sources.list apt-get update && apt-get install odoo
Il se peut que les paquets python soit pas adapté à l'application et pip d'obtenir les bonnes version de ses dépendances:
apt install python3-pip su - odoo pip install werkzeug==0.16.0
Il reste à installer wkhtmltox pour générer les pdf :
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox_0.12.5-1.buster_amd64.deb dpkg -i wkhtmltox_0.12.5-1.buster_amd64.deb apt -f install dpkg -i wkhtmltox_0.12.5-1.buster_amd64.deb ln -s /usr/local/bin/wkhtmltopdf /usr/bin ln -s /usr/local/bin/wkhtmltoimage /usr/bin
Installation manuelle
Près requis
apt install gcc python3-pip libjpeg-dev build-essential python-dev python3-pil python3-pyldap python3-dev python3-setuptools python3-psycopg2 python3-venv libxslt-dev git libzip-dev libldap2-dev libsasl2-dev libpq-dev wkhtmltopdf python3-num2words postgresql apt install sudo vim update-alternatives --install /usr/bin/python python /usr/bin/python3 1 sudo -iu postgres createuser -s odoo
Adapter ces valeurs pour optimiser le temps de réponse de postgres:
vim /etc/postgresql/13/main/postgresql.conf shared_buffers = 3072MB effective_cache_size = 8192MB systemctl restart postgresql
Installation
adduser odoo su - odoo git clone --depth=1 -b 13.0 https://github.com/odoo/odoo.git /home/odoo/odoo python3 -m venv /home/odoo/.venv source /home/odoo/.venv/bin/activate cd odoo pip install --upgrade pip pip install phonenumbers jwt psycopg2-binary psycopg2 PyPDF2 babel decorator jinja2 reportlab docutils gevent pip install -r /home/odoo/odoo/requirements.txt
L'application démarrera ainsi :
/home/odoo/.venv/bin/python3 /home/odoo/odoo/odoo-bin -c /home/odoo/odoo/debian/odoo.conf
Le port 8069 sera en écoute
Configuration
Au minimum:
cat /home/odoo/odoo/debian/odoo.conf
[options] db_host = False db_port = False db_user = odoo db_password = False list_db = False without_demo = all limit_time_real = 0 limit_time_cpu = 0 log_level = debug logfile = /home/odoo/odoo/odoo.log
Autres directives:
Interface d'écoute de l'application: http_interface = 127.0.0.1 Là ou sera stocké le filstore : #data_dir = /var/lib/odoo Odoo créera pas de base avec des accents unaccent = true Emplacement des fichiers addons: addons_path = /opt/odoo/auto/addons, /opt/odoo/auto/addons2 Indiquer que l'application se trouve derrière un reverseproxy: proxy_mode = true Paramètre de connexion SMTP: smtp_host = 10.0.3.1 smtp_server = smtp smtp_port = 25 smtp_user = false smtp_password = false smtp_ssl = false Désactiver l'API: xmlrpc = False xmlrpcs = False Ne pas charger les données de démos des modules: without_demo = all Emplacement du module qui servirait à géolocaliser les personnes grâce aux IPs que Odoo collecte #geoip_database = /opt/odoo/auto/geoip/GeoLite2-City.mmdb
On peut en découvrir d'autres en exportant la configuration chargé :
/usr/bin/odoo --stop-after-init --save
On retrouve alors un fichier dans ~/.odoorc
Nginx
Apache
a2enmod proxy_http
cat /etc/apache2/sites-enabled/odoo.conf
<VirtualHost *:80 *:443> ServerName domaine.org ServerAlias www.domaine.org ServerAdmin webmaster@domaine.org ProxyPass /.well-known/acme-challenge ! Alias /.well-known/acme-challenge /var/www/html/.well-known/acme-challenge DocumentRoot /var/www/odoo <Directory "/var/www/odoo"> # Options -Indexes Require all granted </Directory> SSLEngine On SSLCertificateFile /etc/letsencrypt/live/domaine.org/cert.pem SSLCertificateKeyFile /etc/letsencrypt/live/domaine.org/privkey.pem SSLCertificateChainFile /etc/letsencrypt/live/domaine.org/chain.pem SSLVerifyClient None ServerSignature Off CustomLog /var/log/apache2/access.log combined ErrorLog /var/log/apache2/error.log ProxyPass /longpolling/ http://10.0.3.12:8072/longpolling/ ProxyPassReverse /longpolling/ http://10.0.3.12:8072/longpolling/ ## Auto-redirection from http to https RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,QSA] <Location "/robots.txt"> ProxyPass "!" </Location> Alias "/robots.txt" "/var/www/odoo/robots.txt" # <Location "/503.html"> # ProxyPass "!" # </Location> # Alias "/503.html" "/var/www/odoo/503.html" <IfModule mod_proxy.c> ProxyRequests Off <Proxy *> Order deny,allow Allow from all </Proxy> ProxyVia On ProxyPass / http://10.0.3.12:8069/ retry=0 <Location / > Allow from all ProxyPassReverse http://10.0.3.12:8069/ </Location> SSLProxyEngine On </IfModule> RequestHeader set "X-Forwarded-Proto" "https" ## Fix IE problem (httpapache proxy dav error 408/409) SetEnv proxy-nokeepalive 1 # Header unset Cache-Control # Header unset Set-Cookie #Cause une "400 bad request" lorsque l'on se login au backend (CSRF_request) Header unset Age # Header unset Etag Header unset X-Content-Type-Options Header unset Via Header unset Server #Header set Access-Control-Allow-Origin "*" #Header set Access-Control-Allow-Methods "POST, GET, OPTIONS" #Header set Access-Control-Allow-Headers "origin, content-type, accept" Header always set Strict-Transport-Security "max-age=15552000; includeSubDomain;" ProxyErrorOverride On ErrorDocument 404 "https://domaine.org" ErrorDocument 503 /var/www/odoo/503.html </VirtualHost>
Postfix
systemd
Nous aurons besoin d'une unité pour que l'application soit lancé au démarrage du système:
cat /etc/systemd/system/odoo.service
[Unit] Description=Odoo Requires=postgresql.service After=network.target postgresql.service [Service] Type=simple SyslogIdentifier=odoo PermissionsStartOnly=true User=odoo Group=odoo Environment="VIRTUAL_ENV=/home/odoo/.venv" Environment="PATH=/home/odoo/.venv/bin" WorkingDirectory=/home/odoo/odoo ExecStart=/home/odoo/.venv/bin/python3 /home/odoo/odoo/odoo-bin -c /home/odoo/odoo/debian/odoo.conf StandardOutput=journal+console [Install] WantedBy=multi-user.target
On prend en compte ce changement:
systemctl daemon-reload