Skip to content
Home » My Blog Tutorial » How to Install Odoo 17 with Docker on Ubuntu 22.04

How to Install Odoo 17 with Docker on Ubuntu 22.04

odoo docker installation ubuntu

odoo docker installation ubuntu. Are you looking to deploy Odoo 17 using Docker containers on Ubuntu 22.04? This comprehensive guide will walk you through the complete installation process of setting up Odoo 17 with Docker. Moreover, we’ll cover best practices, security considerations, and essential maintenance tasks.

Prerequisites for Odoo Docker Installation

Before we begin odoo docker installation ubuntu, ensure you have:

  • A Ubuntu 22.04 server with root access
  • Minimum 4GB RAM and 2 CPU cores
  • At least 20GB free disk space
  • Basic knowledge of Linux commands

Setting Up the Ubuntu Server Environment

First, let’s prepare our Ubuntu server with necessary updates and dependencies:

# Update system packages
sudo apt update && sudo apt upgrade -y

# Install required dependencies
sudo apt install -y \
    apt-transport-https \
    ca-certificates \
    curl \
    software-properties-common

Installing Docker and Docker Compose

Next, we’ll install Docker and Docker Compose:

# Add Docker's official GPG key
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg

# Add Docker repository
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null

# Install Docker
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io

# Install Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

Creating the Odoo Docker Environment

Now, let’s set up the directory structure for our Odoo installation:

# Create project directory
mkdir ~/odoo17
cd ~/odoo17

# Create required subdirectories
mkdir -p postgresql
mkdir -p odoo/addons
mkdir -p odoo/config

Configuring Docker Compose for Odoo

Create a docker-compose.yml file with the following configuration:

version: '3'
services:
  db:
    image: postgres:15
    environment:
      - POSTGRES_DB=postgres
      - POSTGRES_PASSWORD=odoo_password
      - POSTGRES_USER=odoo
    volumes:
      - ./postgresql:/var/lib/postgresql/data
    restart: always

  odoo:
    image: odoo:17.0
    depends_on:
      - db
    ports:
      - "8069:8069"
    volumes:
      - ./odoo/addons:/mnt/extra-addons
      - ./odoo/config:/etc/odoo
      - ./odoo/data:/var/lib/odoo
    environment:
      - HOST=db
      - USER=odoo
      - PASSWORD=odoo_password
    restart: always

Setting Up Odoo Configuration

Create an odoo.conf file in the odoo/config directory:

[options]
addons_path = /mnt/extra-addons
data_dir = /var/lib/odoo
admin_passwd = your_secure_password
db_host = db
db_port = 5432
db_user = odoo
db_password = odoo_password

Launching Odoo Container

Start the Odoo installation:

# Set proper permissions
sudo chown -R 101:101 odoo/

# Start containers
docker-compose up -d

Security Best Practices

Implement these security measures:

  1. Configure UFW Firewall:
sudo ufw allow 22/tcp
sudo ufw allow 8069/tcp
sudo ufw enable
  1. Set up Nginx reverse proxy (recommended for production):
sudo apt install nginx
sudo nano /etc/nginx/sites-available/odoo

Add this configuration:

upstream odoo {
    server 127.0.0.1:8069;
}

server {
    listen 80;
    server_name your_domain.com;

    proxy_read_timeout 720s;
    proxy_connect_timeout 720s;
    proxy_send_timeout 720s;

    location / {
        proxy_pass http://odoo;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

Maintenance and Backup Procedures

Create a backup script (backup.sh):

#!/bin/bash
BACKUP_DIR="/home/ubuntu/odoo_backups"
CONTAINER_NAME="odoo17_db_1"
DB_USER="odoo"
DB_NAME="your_database_name"

mkdir -p $BACKUP_DIR
docker exec $CONTAINER_NAME pg_dump -U $DB_USER $DB_NAME > $BACKUP_DIR/backup_$(date +%Y%m%d_%H%M%S).sql

Set up automated backups:

chmod +x backup.sh
crontab -e
# Add: 0 2 * * * /home/ubuntu/odoo17/backup.sh

Troubleshooting Common Issues

  1. If Odoo fails to start, check logs:
docker-compose logs -f
  1. For database connection issues:
docker-compose down
docker-compose up -d

Conclusion

You have now successfully installed Odoo 17 using Docker on Ubuntu 22.04. Remember to regularly update your system, monitor resource usage, and maintain regular backups. For production environments, consider implementing additional security measures like SSL certificates and regular security audits.

Need help with your Odoo installation? Feel free to leave a comment below or check our other tutorials for more advanced Odoo configurations and optimizations.


Discover more from teguhteja.id

Subscribe to get the latest posts sent to your email.

Leave a Reply

Optimized by Optimole
WP Twitter Auto Publish Powered By : XYZScripts.com

Discover more from teguhteja.id

Subscribe now to keep reading and get access to the full archive.

Continue reading