This guide will help you install Odoo17 Community Edition on your Debian 10/11/12 server. All commands assume you are running from a user account (not root), with sudo permissions.
I’ve provided the instructions for installation below. If you’d rather use a script that I’ve created to automate the installation, I’ve created separate guides to cover the automated install process:
1: Update your system
Before installing, ensure your system is up to date. This will avoid any packages being out of sync/incompatible. As always, it is preferred to have a fresh system with no other software installed. Reboot after updating to ensure everything is running current code.
$ sudo apt update
$ sudo apt upgrade -y
$ sudo reboot
2: Install wkhtmltopdf
In order to generate PDFs or print reports, you will need to install wkhtmltopdf. I’ve covered the installation on Debian here:
Debian 11: Install wkhtmltopdf on Debian
Debian 12: Install wkhtmltopdf on Debian12
3: Install Odoo 17
Import Odoo’s repository key:
$ sudo apt update
$ sudo apt install gnupg2
$ wget https://nightly.odoo.com/odoo.key
$ cat odoo.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/odoo.gpg >/dev/null
Add Odoo’s repository:
$ echo "deb http://nightly.odoo.com/17.0/nightly/deb/ ./" | sudo tee /etc/apt/sources.list.d/odoo.list
Update apt cache:
$ sudo apt update
Install Odoo 16:
$ sudo apt install odoo
4: Set Odoo to start on boot
When installation completes, the Odoo service will be started for you. It will not start automatically after you reboot. To set it to automatically start, run the following command:
$ sudo systemctl enable --now odoo
5: Configure Nginx with LetsEncrypt SSL certificate
It is possible to use Nginx without SSL, but I do not recommend it, and will not be covering it in this article.
#Debian 11/12
sudo apt update
sudo apt install certbot python3-certbot-nginx
#Debian 10
sudo apt update
sudo apt install certbot python-certbot-nginx
#stop Nginx
sudo systemctl stop nginx
#Generate SSL certificates
export DOMAIN="odoo.robfauls.com"
export EMAIL="rockinit@robfauls.com"
sudo /usr/bin/certbot certonly --standalone -d ${DOMAIN} --preferred-challenges http --agree-tos -n -m ${EMAIL} --keep-until-expiring
Set up cron job for certificate renewal:
$ sudo crontab -e
15 3 * * * /usr/bin/certbot renew --pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx"
Create Nginx configuration file.
$ sudo nano /etc/nginx/sites-available/odoo.conf
Paste the following into odoo.conf:
#odoo server
upstream odoo {
server 127.0.0.1:8069;
}
upstream odoochat {
server 127.0.0.1:8072;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
# http -> https
server {
listen 80;
server_name odoo.robfauls.com;
rewrite ^(.*) https://$host$1 permanent;
}
server {
listen 443 ssl;
server_name odoo.robfauls.com;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
# Add Headers for odoo proxy mode
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
# SSL parameters
ssl_certificate /etc/letsencrypt/live/odoo.robfauls.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/odoo.robfauls.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/odoo.robfauls.com/chain.pem;
ssl_session_timeout 30m;
ssl_protocols TLSv1.2;
ssl_ciphers ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384;
ssl_prefer_server_ciphers off;
# log
access_log /var/log/nginx/odoo.access.log;
error_log /var/log/nginx/odoo.error.log;
# Redirect websocket requests to odoo gevent port
location /websocket {
proxy_pass http://odoochat;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection $connection_upgrade;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
# Redirect requests to odoo backend server
location / {
proxy_redirect off;
proxy_pass http://odoo;
}
# common gzip
gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;
gzip on;
}
Enable the configuration (symlink from sites-available to sites-enabled):
ln -s /etc/nginx/sites-available/odoo.conf /etc/nginx/sites-enabled/
Double check that the Nginx configuration is in a healthy state:
$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Restart Nginx:
$ sudo systemctl restart nginx
7: Optimize Odoo.conf
Edit odoo.conf:
$ sudo nano /etc/odoo/odoo.conf
Insert/edit the following lines:
[options]
db_host = False
db_port = False
db_user = odoo
db_password = False
default_productivity_apps = True
proxy_mode = True
max_cron_threads = 2
workers = 3
longpolling_port = 8072
addons_path = /var/lib/odoo/.local/share/Odoo/addons/17.0
xmlrpc = True
xmlrpc_interface =
xmlrpc_port = 8069
xmlrpcs = True
xmlrpcs_interface =
xmlrpcs_port = 8071
Restart odoo:
$ sudo systemctl restart odoo
8: Access Odoo and configure it
9: All done! (for now)
Now that you’ve completed the initial installation of Odoo 16, it’s time to begin configuring everything. There are a number of tweaks you’ll want to perform in order to get things working the way you’d expect. Please check Odoo – Overview for more information and additional guides. A few of my “top annoyances” have been covered, and I’ll include more as I’m able to dedicate some time to this documentation.
3 Comments
Thank you for sharing, it helped me solve a lot of problems
Changelog:
1) Updated the instructions to reference /etc/nginx/sites-available instead of editing /etc/nginx/cond.f/odoo.conf. This is better practice. Not sure why I had that behavior previously.
2) Added auto-installer guide and linked at top of article. Auto-installer is where most of my efforts go. As features/options/configurations are added, they will be applied to the auto-installer first, and documented in this article as time permits. Example feature not documented here: Cloudflare DNS Proxy Client IP Logging- when following this guide, if using cloudflare, your server will log Cloudflare IP addresses. It will not log client IP addresses. The script addresses this issue and also installs a cron job to update CF IPs on a daily basis.
Hi Rob, what are the lines that optimize odoo?, could you help to understand or where can I read about this concepts:
*default_productivity_apps
*proxy_mode
*workers
*longpolling
*xmlrpc(s)
thanks in advance!—