Introduction
Immich is an open-source, self-hosted photo and video backup solution that allows users to manage their media in a secure environment. Leveraging Hetznerโs robust infrastructure, you can quickly set up and manage your own Immich instance. This guide will walk you through the entire process, from provisioning your Hetzner VPS to installing and configuring Immich.
Fair warning before you start: Immich is the most storage hungry thing we self-host. The application itself is light, the library is not, and the machine learning features add a memory floor that catches people out. The steps below are the ones we use, but read the sizing note under Choosing the Right VPS before you commit to a plan.
Choosing the Right VPS
When it comes to self-hosting applications like Immich, the choice of VPS provider is crucial. Hetzner offers competitive pricing and performance which makes it an excellent choice for developers. Below is a comparison of some popular VPS providers based on their prices and specifications:
| Provider | Monthly Price | Memory | CPU Cores | Disk Space |
|---|---|---|---|---|
| Hetzner Cloud | 5.49 EUR | 4 GB | 2 | 40 GB NVMe |
| Contabo VPS | 5.99 EUR | 4 GB | 2 | 200 GB SSD |
| DigitalOcean | 6 USD | 2 GB | 1 | 50 GB SSD |
| Vultr | 6 USD | 2 GB | 1 | 55 GB SSD |
| Linode (Akamai) | 5 USD | 2 GB | 1 | 50 GB SSD |
Consider your specific needs when selecting a VPS provider. For this guide, weโll proceed with Hetzner due to its affordability and performance even at entry-level plans.
The honest caveat on that table is that 40 GB is the boot disk, not your photo library. A single phone with a few years of photos will fill it. Plan on attaching a volume, and remember that Immich also generates thumbnails and transcodes on top of the originals, which in our case added roughly a third again on top of the raw import.
Step 1: Provisioning a Hetzner VPS
- Go to the Hetzner Cloud website.
- Sign up for an account if you do not have one.
- Create a new project and launch a new server.
- Choose a server type. CX23 (2 vCPU, 4 GB RAM, 5.49 EUR/mo excl. VAT) is the practical minimum: 4 GB is enough to run Immich, but the machine-learning container that powers face and object recognition sits right at the edge of it. If you plan to import a large existing library, CX33 with 8 GB will save you from watching the ML worker get killed mid-job.
- Select your preferred data center location.
- Proceed with the creation and take note of your SSH key for access.
Step 2: Connecting to Your VPS
Once your server is up and running, connect to it via SSH. Open a terminal (or Command Prompt on Windows) and enter:
ssh root@YOUR_IP_ADDRESS
Replace YOUR_IP_ADDRESS with the IP assigned to your Hetzner VPS.
Step 3: Installing Required Software
Before installing Immich, youโll need to set up Docker and Docker Compose. Execute the following commands:
# Update the package list
apt update && apt upgrade -y
# Install Docker
apt install docker.io -y
# Enable and start Docker
systemctl enable docker
systemctl start docker
# Install Docker Compose
apt install docker-compose-v2 -y
Verify the installation:
docker --version
docker compose version
Step 4: Configuring Immich
Create a directory for Immich:
mkdir ~/immich && cd ~/immich
Create a docker-compose.yml file using a text editor:
nano docker-compose.yml
Insert the following configuration:
services:
immich-server:
image: ghcr.io/immich-app/immich-server:release
restart: always
ports:
- "2283:2283"
environment:
DB_HOSTNAME: database
DB_USERNAME: immich
DB_PASSWORD: your-secure-password
DB_DATABASE_NAME: immich
REDIS_HOSTNAME: redis
UPLOAD_LOCATION: ./library
volumes:
- ./library:/data
depends_on:
- database
- redis
immich-machine-learning:
image: ghcr.io/immich-app/immich-machine-learning:release
restart: always
volumes:
- model-cache:/cache
redis:
image: docker.io/valkey/valkey:9
restart: always
database:
image: ghcr.io/immich-app/postgres:14-vectorchord0.4.3-pgvectors0.2.0
restart: always
environment:
POSTGRES_USER: immich
POSTGRES_PASSWORD: your-secure-password
POSTGRES_DB: immich
volumes:
- db-data:/var/lib/postgresql/data
volumes:
db-data:
model-cache:
Make sure to replace immich-password with a more secure password of your choice.
Step 5: Running Immich
Now, you can launch Immich using Docker Compose:
docker compose up -d
To verify that Immich is running correctly, access it via your web browser at http://YOUR_IP_ADDRESS:2283. You should see the Immich setup interface.
Two things we would do differently on a fresh install. Give the machine learning container an explicit memory limit, because on a 4 GB box it will otherwise take the whole machine down during the first bulk import. And run that first import overnight, since it is the single heaviest thing the server will ever do.
Step 6: Configuring your Domain (Optional)
If you want to use a custom domain for your Immich installation, ensure that your DNS records point to the IP address of your Hetzner VPS. You can also set up a reverse proxy with Nginx or Traefik for SSL support.
FAQs
1. What are the main features of Immich?
Immich provides a suite of features designed for personal media management. Users can upload, store, and retrieve images and videos seamlessly. It supports multiple user access levels and can handle photo organization through albums and searchable tags. Furthermore, its backup capability allows you to securely store your media files on your own infrastructure.
2. Is it safe to self-host Immich?
Self-hosting applications like Immich can be safe if proper security measures are implemented. This includes using strong passwords, regularly updating your software, setting up firewalls, and possibly using SSL encryption. Itโs important to secure your server with only the necessary ports open and consider employing tools like UFW (Uncomplicated Firewall) to monitor access.
3. Can I scale my Hetzner VPS if needed?
Yes, Hetzner allows you to scale your VPS as your demands grow. You can easily upgrade your serverโs CPU, memory, and storage via the Hetzner Cloud control panel. This flexibility makes it suitable for projects that may grow over time, allowing you to handle more users and greater storage without major reconfiguration.
For an extended look into various VPS options, check out our full VPS comparison. Happy hosting!