Install Odoo 19 with PostgreSQL 18 on Ubuntu 24 with SMTP Relay for Outgoing E-mails
Odoo installation
The article uses Docker for installing Odoo as it is the easiest way to set up Odoo without worrying about dependencies. So, follow the official docker installation instructions before proceeding further.
After installing Docker, create a directory named odoo. Switch to this directory and create a new file named compose.yml. This file contains instructions for Docker to start different services. There are multiple configuration parameters and we will explore these as we set up our services.
Docker compose file for installing Odoo + PostgreSQL + Nginx-proxy + Acme-companion
To install Odoo 19 alongside PostgreSQL 18.2 as its database, we will use a docker compose file. Additionally, we will use nginx-proxy and acme-companion to set up SSL certificates for our domain. If you are running Odoo on a local development server, follow the instructions in comments. For running on a development server without a domain, you won't be able to set up outgoing e-mail service.
services:
# Comment nginx-proxy for testing on a development server
nginx-proxy:
image: jwilder/nginx-proxy
container_name: nginx-proxy
ports:
- "80:80"
- "443:443"
networks:
- proxy
volumes:
- /var/run/docker.sock:/tmp/docker.sock:ro
- ./certs:/etc/nginx/certs:rw
- ./vhost.d:/etc/nginx/vhost.d
- ./html:/usr/share/nginx/html
restart: always
# Comment letsencypt-companion for testing on a development server
letsencrypt-companion:
image: nginxproxy/acme-companion
container_name: letsencrypt-companion
environment:
- NGINX_PROXY_CONTAINER=nginx-proxy
networks:
- proxy
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./certs:/etc/nginx/certs:rw
- ./vhost.d:/etc/nginx/vhost.d
- ./html:/usr/share/nginx/html
restart: always
odoo:
image: odoo:19.0
container_name: odoo
depends_on:
- postgres
# Uncomments ports for testing on a development server
# ports:
# - "8069:8069"
environment:
- HOST=postgres
- USER=demo_user
- PASSWORD=demo_password
# Comment virtual host, virtual port, let's encrypt host and email for testing on a development server
- VIRTUAL_HOST=demo.example.com
- VIRTUAL_PORT=8069
- LETSENCRYPT_HOST=demo.example.com
- LETSENCRYPT_EMAIL=demo@example.com
networks:
- proxy
volumes:
- ./data/odoo:/var/lib/odoo
restart: always
postgres:
image: postgres:18.2
container_name: postgres
environment:
- POSTGRES_USER=demo_user
- POSTGRES_PASSWORD=demo_password
- POSTGRES_DB=demo_database
networks:
- proxy
# For some older versions of PostgreSQL, you will have to use /var/lib/postgresql/data as the mount point
volumes:
- ./data/postgres:/var/lib/postgresql
restart: always
networks:
proxy:
name: proxy
driver: bridge
To start the docker container, open a terminal in current working directory and execute the following command.
# Start the docker container in detached mode
docker compose up -d
Set correct ownerships and permission for host volumes
The compose file uses host volumes for Docker installation as it makes it easy to backup and migrate to a different machine. After starting the container, check the UID and GID of Odoo container and update the ownership and permissions for Odoo host volume.
# Check UID and GID of a container
docker exec -it odoo id
# Change ownership of Odoo data folder. Assuming the container UID=100 and GID=101
chown -R 100:101 ./data/odoo
# Give Odoo permission to modify contents in folder
chmod -R 755 ./data/odoo
Use a SMTP relay for E-mails
We will use Brevo SMTP relay service for e-mails as it offers a free plan with 300 outgoing e-mails per day. This is more than sufficient for a small-scale business.
- Create an account on Brevo.
- Generate a SMTP key in Brevo dashboard and add the SMTP relay information in outgoing email server settings in Odoo.
- Authenticate the domain at Brevo.com for sending emails by adding TXT and CNAME records with your domain registrar.
- Check transactional logs in Brevo dashboard for debugging errors.
Author
Anurag Gupta is an M.S. graduate in Electrical and Computer Engineering from Cornell University. He also holds an M.Tech degree in Systems and Control Engineering and a B.Tech degree in Electrical Engineering from the Indian Institute of Technology, Bombay.
Comment
This policy contains information about your privacy. By posting, you are declaring that you understand this policy:
- Your name, rating, website address, town, country, state and comment will be publicly displayed if entered.
- Aside from the data entered into these form fields, other stored data about your comment will include:
- Your IP address (not displayed)
- The time/date of your submission (displayed)
- Your email address will not be shared. It is collected for only two reasons:
- Administrative purposes, should a need to contact you arise.
- To inform you of new comments, should you subscribe to receive notifications.
- A cookie may be set on your computer. This is used to remember your inputs. It will expire by itself.
This policy is subject to change at any time and without notice.
These terms and conditions contain rules about posting comments. By submitting a comment, you are declaring that you agree with these rules:
- Although the administrator will attempt to moderate comments, it is impossible for every comment to have been moderated at any given time.
- You acknowledge that all comments express the views and opinions of the original author and not those of the administrator.
- You agree not to post any material which is knowingly false, obscene, hateful, threatening, harassing or invasive of a person's privacy.
- The administrator has the right to edit, move or remove any comment for any reason and without notice.
Failure to comply with these rules may result in being banned from submitting further comments.
These terms and conditions are subject to change at any time and without notice.
Similar content
Past Comments