Immich Setup Guide: How to Self-Host Your Own Google Photos Alternative

6月6日 Published inMobile Applications

Immich is a robust open-source, self-hosted solution designed for managing personal photo and video libraries. It allows you to maintain full control over your backups, share albums with family and friends, and seamlessly synchronize media from both iOS and Android devices.

System Requirements

To run Immich effectively, your hardware should have at least 4GB of RAM and 2 CPU cores. Docker is a prerequisite for the installation.

Server Setup

1. Prepare the Directory

Create a dedicated directory for Immich—for example, ./immich-app. This folder will store your configuration files, specifically docker-compose.yml and .env.

mkdir ./immich-app
cd ./immich-app
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

Alternatively, you can download these files via a web browser and move them into the directory manually. If you do this, ensure the example.env file is renamed to .env.

2. Configure the .env File

Open the .env file and review the following key settings:

UPLOAD_LOCATION=./library
DB_DATA_LOCATION=./postgres
# TZ=Etc/UTC
IMMICH_VERSION=release
DB_PASSWORD=postgres

DB_USERNAME=postgres
DB_DATABASE_NAME=immich

Point UPLOAD_LOCATION to a directory on your server with sufficient storage for your entire media library. Change DB_PASSWORD to a secure, random string; use only alphanumeric characters (letters and numbers) to ensure compatibility with Docker’s environment parsing. Tools like pwgen can generate these quickly. If your server requires a specific timezone, uncomment and modify the TZ= line.

3. Launch the Containers

From within the directory containing your configured files, execute the following command:

docker compose up -d

This command starts Immich as a background service.

Accessing the Web Interface

The first account created on the instance is automatically granted administrative privileges. Open your browser and navigate to http://<your-server-ip>:2283, then click "Getting Started." Enter an email address, password, and name to create your account. Once logged in, you can begin uploading photos directly through the web interface.

Mobile App Configuration

The Immich app is available on Google Play, the Apple App Store, F-Droid, or as an APK via GitHub Releases. To connect, use your server’s API endpoint: http://<your-server-ip>:2283/api.

After logging in, any photos previously uploaded via the web will be visible. To set up your mobile backup, tap the cloud icon in the top-right corner to access the backup menu. Select the albums you wish to sync, scroll down, and select "Start Backup." Note that large libraries may take considerable time to upload initially. For a trial run, select only a few photos first. You can monitor progress and metadata processing in the "Tasks" tab of the web interface.

Important Note on Backups

Immich features a built-in database backup utility. This preserves your metadata and user account information, but it does not back up your actual image and video files. You must implement a separate backup strategy for the contents of your UPLOAD_LOCATION directory to prevent data loss.

Installation Prerequisites

Hardware Requirements

Operating System: Immich performs best on Linux or Unix-like systems such as Ubuntu or Debian. Running Docker on non-Linux hosts can be more complex. If you are using Windows, utilize Docker Desktop with the WSL 2 backend. macOS users should use Docker Desktop. While Immich runs reliably within a full virtual machine, LXC containers are generally not recommended due to potential permission issues; if you encounter problems in an LXC, transition to a supported VM.

RAM: A minimum of 4GB is required, though 6GB is recommended for smoother performance.

CPU: A minimum of 2 cores is required, with 4 cores recommended for faster media processing.

Storage: Ensure you use a Unix-compatible filesystem that supports standard user/group permissions, such as EXT4, ZFS, or APFS. Be aware that generating thumbnails and transcoding videos typically increases the total storage requirement by 10–20% of your original library size.

System performance relies heavily on a fast, stable connection between Immich and its PostgreSQL database. The database itself usually requires between 1GB and 3GB of space. It is critical to place DB_DATA_LOCATION on a local SSD and avoid using network shares (like SMB or NFS). If you set Docker resource constraints, allocate at least 2GB of RAM to the Postgres container.

Software Requirements

You must have Docker and the Docker Compose plugin installed. Use the docker compose command (note that the older, hyphenated docker-compose is deprecated and not supported by Immich). Linux servers should use Docker Engine, while Windows and macOS users should use Docker Desktop.

Special Instructions for Windows Users

On Windows, the PostgreSQL database directory (DB_DATA_LOCATION) must be stored on a filesystem that supports Unix-style ownership and permissions (such as EXT4 via WSL). NTFS and exFAT filesystems are not compatible with the database container. Mounting host directories under /mnt in WSL will also lead to errors.

To resolve this, use a Docker volume instead of a standard bind mount.

In your .env file, update the setting:

- DB_DATA_LOCATION=./postgres
+ DB_DATA_LOCATION=pgdata

Then, append the following lines to the end of your docker-compose.yml file:

volumes:
  model-cache:
  pgdata: