Skip to main content
Back to Category

Immich Setup: Self-Hosted Photo and Video Backup

Immich Docker installation, automatic photo and video backup, face recognition, map view, shared albums, mobile app and self-hosted Google Photos alternative.

Read time: 14 dk Self-Hosting
immichphotovideobackupself-hostingdockergoogle photos alternative

Table of Contents

Immich Setup: Self-Hosted Photo and Video Backup

Immich is a self-hosted photo and video backup platform developed as an open-source alternative to Google Photos. It offers modern features like automatic backup via mobile apps, face recognition, map view, and shared albums.

What is Immich?

Immich lets you host your photo and video collection on your own server:

  • Automatic backup: Background backup via iOS and Android apps
  • Face recognition: Automatic face detection and grouping with machine learning
  • Map view: View photos on a map using GPS data
  • Shared albums: Share albums with family and friends
  • Timeline: Chronological photo browser
  • Search: Smart search by object, scene, and text

System Requirements

  • Docker and Docker Compose
  • Minimum 4 GB RAM (8 GB recommended for ML models)
  • Sufficient disk space (depends on photo/video collection)
  • PostgreSQL 14+ (auto-installed via Docker Compose)

Docker Installation

docker-compose.yml

hljs yaml
version: '3.8'

services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:release
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /etc/localtime:/etc/localtime:ro
    env_file:
      - .env
    ports:
      - "2283:2283"
    depends_on:
      - redis
      - database
    restart: always

  immich-machine-learning:
    container_name: immich_machine_learning
    image: ghcr.io/immich-app/immich-machine-learning:release
    volumes:
      - model-cache:/cache
    env_file:
      - .env
    restart: always

  redis:
    container_name: immich_redis
    image: redis:6.2-alpine
    restart: always
    healthcheck:
      test: redis-cli ping || exit 1

  database:
    container_name: immich_postgres
    image: tensorchord/pgvecto-rs:pg14-v0.2.0
    environment:
      POSTGRES_PASSWORD: ${DB_PASSWORD}
      POSTGRES_USER: ${DB_USERNAME}
      POSTGRES_DB: ${DB_DATABASE_NAME}
      POSTGRES_INITDB_ARGS: '--data-checksums'
    volumes:
      - pgdata:/var/lib/postgresql/data
    restart: always

volumes:
  pgdata:
  model-cache:

.env File

hljs bash
UPLOAD_LOCATION=/data/immich/upload
DB_PASSWORD=StrongPass123!
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

Starting the Installation

hljs bash
mkdir -p /data/immich/upload
docker compose up -d
docker logs immich_server -f

Access the Immich web interface at http://SERVER_IP:2283. You'll need to create an admin account on first login.

Nginx Reverse Proxy

hljs nginx
server {
    listen 443 ssl http2;
    server_name photos.example.com;

    ssl_certificate /etc/letsencrypt/live/photos.example.com/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/photos.example.com/privkey.pem;

    client_max_body_size 50000M;

    location / {
        proxy_pass http://127.0.0.1:2283;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_read_timeout 600s;
        proxy_send_timeout 600s;
    }
}

Mobile App Setup

  1. Download "Immich" from App Store or Google Play
  2. Enter server URL: https://photos.example.com
  3. Log in with username and password
  4. Configure automatic backup settings:
    • Background backup: Enabled
    • Backup on Wi-Fi: Enabled
    • Backup on mobile data: Optional
    • Video backup: Enabled/Disabled

External Library

hljs yaml
services:
  immich-server:
    volumes:
      - ${UPLOAD_LOCATION}:/usr/src/app/upload
      - /mnt/photos:/mnt/photos:ro
Administration → External Libraries
- Import Path: /mnt/photos
- Scan frequency: Every 24 hours
- Exclusion patterns: *.tmp, Thumbs.db

Machine Learning Settings

Administration → Machine Learning
- Face recognition: Enabled
- Smart search (CLIP): Enabled
- Object detection: Enabled
- Minimum face confidence score: 0.7

Backup

hljs bash
# Database backup
docker exec immich_postgres pg_dumpall -U postgres | \
  gzip > /backups/immich-db-$(date +%Y%m%d).sql.gz

# Upload directory backup
rsync -avz /data/immich/upload/ /backups/immich-upload/

Update

hljs bash
docker exec immich_postgres pg_dumpall -U postgres > immich-backup.sql
docker compose pull
docker compose up -d
docker logs immich_server -f

Immich is still under active development. Major version updates may contain breaking changes. Always back up the database before updating and read the release notes.

Conclusion

Immich is a powerful self-hosted alternative to Google Photos. You can securely store your photos and videos on your own server and benefit from modern features like face recognition and smart search. With 8 GB RAM on REXE servers, you can manage thousands of photos seamlessly.