Immich Self-Hosted Photo Backup on Linux with External Storage
Platform

Immich Self-Hosted Photo Backup on Linux with External Storage

  • Author :Liam K.
  • Date :August 3, 2026
  • Time :18 minutes

Immich is a high-performance self-hosted photo and video platform with mobile apps, facial recognition, and timeline browsing. Storage planning matters more than the install itself: original assets grow fast, and machine-learning containers need RAM. This guide gets Immich running with HTTPS and a sane backup layout.

Prerequisites

  • Linux server with 4+ CPU and 8 GB RAM (ML features need more)
  • Fast disk or dedicated volume for uploads and thumbnails
  • DNS for photos.example.com

Step 1: Prepare Storage Layout

bash
sudo mkdir -p /mnt/photos/{library,postgres,model-cache,encoded-video}
sudo mkdir -p /opt/immich
cd /opt/immich
# Prefer a separate disk mounted at /mnt/photos for originals and DB.

Step 2: Download Official Compose Files

bash
wget -O docker-compose.yml https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml
wget -O .env https://github.com/immich-app/immich/releases/latest/download/example.env
sed -i 's|^UPLOAD_LOCATION=.*|UPLOAD_LOCATION=/mnt/photos/library|' .env
sed -i 's|^DB_DATA_LOCATION=.*|DB_DATA_LOCATION=/mnt/photos/postgres|' .env
# Set DB_PASSWORD to a strong random value
DB_PASSWORD=$(openssl rand -hex 24)
sed -i "s|^DB_PASSWORD=.*|DB_PASSWORD=$DB_PASSWORD|" .env
chmod 600 .env
[...]
Command truncated. Copy to view full command.

Step 3: Reverse Proxy with Large Uploads

bash
sudo tee /etc/nginx/sites-available/immich >/dev/null <<'EOF'
server {
    listen 80;
    server_name photos.example.com;
    client_max_body_size 0;
    location / {
        proxy_pass http://127.0.0.1:2283;
        proxy_http_version 1.1;
[...]
Command truncated. Copy to view full command.

Step 4: Create Admin and Connect Mobile Apps

Open https://photos.example.com, create the admin user, then point the Immich mobile app at the same URL. Enable background backup on Wi-Fi only if cellular data is limited.

Step 5: External Library and Backup

bash
# External libraries can mount existing NAS folders read-only into Immich
# Backup originals + DB regularly
tar -czf /var/backups/immich-library-$(date +%F).tar.gz -C /mnt/photos library
docker compose exec -T database pg_dumpall -U postgres | gzip > /var/backups/immich-db-$(date +%F).sql.gz

Production Checklist

  • Keep originals on a monitored volume with free-space alerts.
  • Back up the database and upload library together.
  • Pin Immich release versions; ML model upgrades can be heavy.
  • Restrict registration after the first family/team accounts exist.
  • Disable public sharing links if the instance should stay private.

"Photo platforms look like apps, but in production they are storage systems with an authentication UI."

Technical Author

Technical Author - Liam K.
Liam K.

System administrator and technical writer specializing in server infrastructure, security and deployment. Creating comprehensive guides to help you master server administration.