Self-hosted Google Photos: Полное руководство по Immich для вашего Homelab

Установка и настройка Immich — высокопроизводительного самохостинг решения для управления фото и видео. Подробный гайд по Docker, внешнему доступу и ИИ-функциям.

Не указано

Prepare the Directory

Create a dedicated directory for Immich to keep all configuration and data paths organized. This simplifies management, updates, and removal.

mkdir ~/immich && cd ~/immich

Download Configuration Files

Download the official docker-compose.yml file and the example environment file. The example file contains all available configuration variables.

curl -L https://github.com/immich-app/immich/releases/latest/download/docker-compose.yml -o docker-compose.yml
curl -L https://github.com/immich-app/immich/releases/latest/download/example.env -o .env

Configure the Environment File (.env)

Edit the .env file to customize critical variables. You MUST set UPLOAD_LOCATION to the path where your photos and videos will be stored (ideally on a large, separate drive). You should also change DB_PASSWORD from the default 'postgres' for security.

nano .env

# Example .env configuration:
# Path to your external media storage
UPLOAD_LOCATION=/path/to/your/media/storage

# URL used for accessing the server from your network
IMMICH_SERVER_URL=http://192.168.1.100:2283

# Database credentials (change the default password!)
DB_PASSWORD=your_strong_password
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

# Path for database files (defaults to ./postgres)
DB_DATA_LOCATION=./postgres

Start the Containers

Launch the Immich stack in detached mode. Docker Compose will pull the necessary images and start all services (server, machine learning, database, redis).

docker compose up -d

Verify Service Status

Check that all containers are up and running healthy. This confirms the installation was successful.

docker compose ps

Initial Web Setup

Open your web browser and navigate to the server's IP address on port 2283 (e.g., http://192.168.1.100:2283). Follow the on-screen wizard to create your first administrator account and configure your initial library.

Import Existing Photos (External Library)

To avoid duplicating large amounts of data, mount your existing photo folder as an external library. Edit the docker-compose.yml to add the volume mount, then create the library in the web interface under Administration -> Libraries. Note: This step is optional if you are starting fresh.

services:
  immich-server:
    volumes:
      # ... existing volumes
      - /path/to/your/existing/photos:/usr/src/app/external_library:ro

Secure External Access

By default, Immich is only accessible on your local network. For secure access from the internet, set up a reverse proxy with SSL. A simple option is Caddy or Nginx Proxy Manager. Never expose Immich directly to the internet without HTTPS.

# Example Caddyfile configuration
your-domain.com {
    reverse_proxy localhost:2283
}

Configure Regular Backups

Your data is critical. Set up a backup strategy for both the UPLOAD_LOCATION (your media) and the DB_DATA_LOCATION (your database containing metadata, albums, and face recognition data). Use tools like rsync or restic to automate this process.

# Example backup script snippet
rsync -av /path/to/your/media/ /mnt/backup_drive/media/
rsync -av /path/to/your/immich/postgres/ /mnt/backup_drive/immich_db/