Prerequisites
- OS: Ubuntu 24.04
- Python: Version 3.10 or higher
- Access: SSH with sudo privileges
1. System Preparation and Dependencies
First, make sure your system repositories are up to date and install the necessary dependencies for Python and the database.
-
Download the sources: Download and extract the Odoo Community and Enterprise source folders to your server.
-
Install the Python virtual environment:
bashsudo apt install python3-venv -
Install PostgreSQL:
bashsudo apt install postgresql postgresql-client -
Configure the PostgreSQL user:
Create a new postgres user. Replace
$USERwith your actual system username.bashsudo -u postgres createuser -d -R -S $USER createdb $USER -
Install development libraries:
bashsudo apt install python3-pip libldap2-dev libpq-dev libsasl2-dev
2. Environment Setup and Installation
-
Create the virtual environment:
Create a virtual environment (venv) in the same directory where the Odoo Community and Enterprise folders are located, then activate it.
bashpython3 -m venv venv source venv/bin/activate(Note: Make sure you are inside the active virtual environment for the following steps).
-
Install Python prerequisites:
Navigate to the community folder and run:
bashpip install -r requirements.txt pip install phonenumbers -
Install wkhtmltopdf:
Download and install the specific version required for report printing.
bashwget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3/wkhtmltox_0.12.6.1-3.jammy_amd64.deb sudo dpkg -i wkhtmltox_0.12.6.1-3.jammy_amd64.debNote: The above command will fail. Run the next step to fix it:
bashsudo apt install -f -
Verify the installation:
Go back to the community path and verify that Odoo is accessible:
bashpython3 -m odoo --version
3. Initial Test Launch
Before fully configuring the production service, perform a test launch to set up the database.
-
Start Odoo manually:
Run the following command to point to the Enterprise addons path and initialize the test database.
bashpython3 -m odoo --addons-path=/home/ubuntu/odoo_enterprise/ -d odoo_db_test -
Access the Web interface:
Open the port in your firewall and access it through your browser.
bashsudo ufw allow 8069/tcpGo to:
http://<server-ip>:8069and verify that Odoo starts correctly and the database manager is displayed. -
Stop the server:
Go back to your terminal and stop Odoo with
ctrl+c.
4. Production Configuration
We will now create the permanent configuration file and prepare the system for production.
-
Create and edit odoo.conf:
Create the configuration file:
bashvim /home/ubuntu/odoo.confFirst, generate a hashed master password. With your venv activated, run:
bashsource /home/ubuntu/venv/bin/activate python3 -c "from passlib.context import CryptContext; print(CryptContext(['pbkdf2_sha512']).hash('YOUR_PASSWORD_HERE'))"Replace
YOUR_PASSWORD_HEREwith your actual master password. This will output something like:text$pbkdf2-sha512$25000$abc123...long_hash_string...Copy that entire hash and add it to the configuration file below:
ini[options] admin_passwd = $pbkdf2-sha512$25000$abc123...the_full_hash... db_user = ubuntu db_password = False db_host = False db_port = False addons_path = /home/ubuntu/odoo_enterprise/odoo/addons,/home/ubuntu/odoo_community/odoo/addons workers = 17 logfile = /home/ubuntu/odoo.log log_level = debug http_port = 8069 longpolling_port = 8072 proxy_mode = TrueConfiguration notes:
admin_passwd: The hashed master password you generated above.db_user: Replaceubuntuif the$USERcreated in step 1.4 is different.addons_path: Adjust if your source folders are located elsewhere.log_level: Can be changed toinfoonce in production.workers: Calculated usingecho "workers = $(( $(nproc) * 2 + 1 ))". Adjust this number based on your CPU cores. Decrease if the instance has limited RAM.proxy_mode: Set to True because we will be using Nginx.
-
Prepare the log file:
bashtouch /home/ubuntu/odoo.log -
Prepare the startup script:
Navigate to the community folder and download
odoo-bin.bashcd /home/ubuntu/odoo_community wget https://raw.githubusercontent.com/odoo/odoo/refs/heads/19.0/odoo-bin chmod +x odoo-bin
5. Systemd Service Configuration
Create a system service to manage Odoo automatically.
-
Create the service file:
bashsudo vim /etc/systemd/system/odoo.service -
Paste the service configuration:
ini[Unit] Description=Odoo 19 Service Documentation=https://www.odoo.com # Wait for network and postgres before starting Requires=postgresql.service After=network.target postgresql.service [Service] # --------------------------------------------------------- # Run as your user so it can access your home dir & venv # --------------------------------------------------------- User=ubuntu Group=ubuntu # --------------------------------------------------------- # PATHS # --------------------------------------------------------- # We run from the community folder so relative paths work if needed WorkingDirectory=/home/ubuntu/odoo_community # IMPORTANT: Point to your VENV python, then the module, then the config ExecStart=/home/ubuntu/venv/bin/python3 /home/ubuntu/odoo_community/odoo-bin -c /home/ubuntu/odoo.conf # --------------------------------------------------------- # RELIABILITY # --------------------------------------------------------- # Restart automatically if it crashes Restart=always RestartSec=5s # Increase open file limit (Critical for 17 workers!) LimitNOFILE=65535 # standard output is handled by Odoo internal logging, # but this catches startup errors before Odoo takes over StandardOutput=journal+console StandardError=journal+console [Install] WantedBy=multi-user.target -
Start the service:
bashsudo systemctl daemon-reload sudo systemctl start odooCheck the status to make sure it is running, then enable it.
6. Nginx Reverse Proxy Configuration
Configure Nginx to handle traffic, SSL, and buffering.
-
Install Nginx:
bashsudo apt install nginx -y -
Create the Odoo site configuration:
bashsudo vim /etc/nginx/sites-available/odoo -
Paste the Nginx configuration:
nginx# Upstream for the main web interface upstream odoo { server 127.0.0.1:8069; } # Upstream for LiveChat/Websockets upstream odoochat { server 127.0.0.1:8072; } server { listen 80; server_name erp.tadoo.io; # Increase upload size to 100MB client_max_body_size 100M; # Proxy Headers 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; # Timeouts for long reports proxy_read_timeout 720s; proxy_connect_timeout 720s; proxy_send_timeout 720s; # Route Websocket traffic to port 8072 location /websocket { proxy_pass http://odoochat; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; } # Route standard traffic to port 8069 location / { proxy_redirect off; proxy_pass http://odoo; } # Cache static files location ~* /web/static/ { proxy_cache_valid 200 90m; proxy_buffering on; expires 864000; proxy_pass http://odoo; } }Note: Replace
erp.tadoo.iowith your own domain name. -
Enable the site:
bashsudo ln -s /etc/nginx/sites-available/odoo /etc/nginx/sites-enabled/ sudo rm /etc/nginx/sites-enabled/default sudo nginx -t sudo systemctl reload nginx
7. Security and Finalization
-
Configure SSL (TLS):
Install Certbot and configure SSL for the domain.
bashsudo apt install certbot python3-certbot-nginx -yThen run Certbot to obtain and configure the SSL certificate:
bashsudo certbot --nginx -d erp.tadoo.ioNote: Replace
erp.tadoo.iowith your own domain name.You can now access your Odoo instance via
https://your-domain.com. -
Create the production database:
Go to
/web/database/managerand create your production database, making sure to set a strong user password. -
Lock the database manager:
To prevent database switching and hide the manager, edit the configuration file again:
bashvim /home/ubuntu/odoo.confAdd these lines:
inidbfilter = ^tadoo$ list_db = FalseNote: Replace
tadoowith the name of your production database. -
Apply the changes:
bashsudo systemctl restart odoo
Your Odoo 19 installation is now complete!