Self-Hosting·7 min read·

Self-Hosting Immich: High-Performance Photo Management on Linux VPS

Deploy and tune Immich on Ubuntu for private, high-speed mobile photo backup, configuring machine learning microservices and pgvector storage.

NB

Netbay Developer Relations

Netbay Engineering

On this page

Smartphones capture thousands of high-resolution photos and 4K video clips, yet storing them on commercial cloud providers compromises user privacy and incurs ever-increasing subscription fees. Immich has emerged as the premier open-source self-hosted alternative to Google Photos and Apple iCloud. It provides automated mobile background syncing, facial recognition clustering, reverse geocoding, and semantic image search powered by local machine learning models.

Running Immich on an Ubuntu 24.04 Linux instance with dedicated Intel Xeon Platinum cores and High-Speed SSD storage delivers fluid timeline scrolling and instant full-resolution asset retrieval.

The Microservice Ecosystem of Immich

Immich operates as a coordinated collection of Docker containers:

  1. **immich-server**: Handles REST API requests, mobile OAuth tokens, WebSocket timeline push updates, and file storage layout.
  2. **immich-machine-learning**: A Python FastAPI service running ONNX Runtime models for facial detection (Scratchpad/InsightFace) and natural language semantic image search (CLIP).
  3. **database**: PostgreSQL 16 equipped with pgvector/pgvecto-rs for high-dimensional vector similarity lookups.
  4. **redis**: Valkey/Redis instance acting as the job broker for transcoding queues, metadata exifs, and thumbnail generation.

Running these services on High-Speed SSD storage prevents IO bottlenecks while thousands of raw mobile camera files are cataloged simultaneously.

Writing the Production docker-compose.yml

Create a dedicated application directory and download the official configuration templates:

bash
mkdir -p /srv/immich && cd /srv/immich
mkdir -p upload library

Create docker-compose.yml:

yaml
# /srv/immich/docker-compose.yml
services:
  immich-server:
    container_name: immich_server
    image: ghcr.io/immich-app/immich-server:release
    volumes:
      - /srv/immich/upload:/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: valkey/valkey:8-alpine
    restart: always

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

volumes:
  pgdata:
  model-cache:
Expand
Immich Self-Hosted Photos
Immich Machine Learning Photo Management

Tuning Machine Learning on Intel Xeon Platinum

Create the .env configuration file to tune concurrency, upload limits, and ONNX machine learning execution threads on multi-core CPU instances:

ini
# /srv/immich/.env
UPLOAD_LOCATION=/srv/immich/upload
IMMICH_VERSION=release

# Database credentials
DB_DATABASE_NAME=immich
DB_USERNAME=immich_admin
DB_PASSWORD=SecureGeneratedDbPassword2026

# Machine learning optimization for Intel Xeon
IMMICH_MACHINE_LEARNING_WORKERS=2
MACHINE_LEARNING_THREAD_LIMIT=4
IMMICH_MACHINE_LEARNING_TRANSFORMERS_CACHE=/cache

# Hardware acceleration settings (CPU-optimized AVX2)
IMMICH_TRANSCODING_PRESET=faster
IMMICH_TRANSCODING_THREADS=4

Starting Immich with AVX2 instruction support accelerates CLIP image embedding generation by over 3x compared to generic virtualization.

Launch the stack:

bash
sudo docker compose up -d
sudo docker compose ps
Immich Multi-Container Machine Learning Pipeline Mobile Upload (REST) - iOS / Android background - Immich Server :2283 - High-Speed SSD ingestion - Dispatches Valkey task Instant photo ingestion Machine Learning ML - ONNX Runtime engine - Intel Xeon AVX2 threads - InsightFace recognition - CLIP semantic vectors Zero cloud telemetry PostgreSQL & pgvector - 512-dim face embeddings - HNSW similarity search - Exif / GPS coordinates - Full-text search index Lucknow DC01 SSD Immich combines on-device photo backup with server-side AI vector search
Self-Hosting Media and Storage Solutions for Privacy
YouTube

Automated Library Backup Automation

Photo libraries are irreplaceable. Configure an automated daily backup script to snapshot the PostgreSQL database and archive the media volume:

bash
# Backup PostgreSQL database schema and vector records
sudo docker exec -t immich_postgres pg_dumpall -c -U immich_admin > /srv/immich/immich_db_backup.sql

# Test semantic search query via curl
curl -X POST http://localhost:2283/api/search/smart   -H "x-api-key: YOUR_IMMICH_API_KEY"   -H "Content-Type: application/json"   -d '{"query": "sunset over the beach"}'

Immich provides private, high-speed mobile photo synchronization without third-party vendor lock-in.

Deploy your private Immich photo vault on Netbay Linux VPS in under 60 seconds with High-Speed SSD in Lucknow DC01 — netbayhosts.in.

Keep reading

Follow along on a real VPS

Deploy Linux in under 60 seconds

These guides are written against Ubuntu, Debian, and RHEL-family images — the same ones on NetBay.

Deploy an instance