Self-hosting an application can provide you with greater control over your data and enhance your privacy. Immich, a self-hosted photo and video backup solution, can be easily set up on a Virtual Private Server (VPS). In this guide, we will walk you through the steps to install Immich on a VPS, using Docker for containerization.
We host our own photo library this way, and the thing worth knowing before you begin is that the install is the easy part. Getting the first few thousand photos uploaded, and having a backup you actually trust afterwards, is the work.
What You Need
-
VPS Provider: Choose a VPS provider that fits your needs. Here are some options:
Provider Price (EUR/USD) Features Link Contabo VPS 5.99 EUR/mo SSD Storage, Backup Options Contabo Hetzner Cloud 5.49 EUR/mo High Performance, Scalability Hetzner DigitalOcean 6 USD/mo User-Friendly, Developer Ecosystem DigitalOcean Vultr 6 USD/mo Global Data Centers, Fast Setup Vultr Linode 5 USD/mo Reliable Support, Advanced Networking Linode For a full VPS comparison, visit this page.
-
Domain Name: A domain name is recommended for accessing your Immich installation.
-
Basic Knowledge: Familiarity with Linux commands and Docker.
Step-by-Step Installation Guide
Step 1: Set Up Your VPS
-
Choose Your OS: For this installation, weโll be using Ubuntu 22.04. Other distributions can be used but may require adjustments in commands.
-
Access Your VPS: Connect to your VPS using SSH. Replace
userandip_addresswith your credentials:ssh user@ip_address -
Update the Package Repository:
sudo apt update sudo apt upgrade -y
Step 2: Install Docker
-
Install Required Packages:
sudo apt install apt-transport-https ca-certificates curl software-properties-common -y -
Add Dockerโs Official GPG Key:
sudo install -m 0755 -d /etc/apt/keyrings sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc sudo chmod a+r /etc/apt/keyrings/docker.asc -
Set Up the Stable Repository:
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null -
Install Docker:
sudo apt update sudo apt install docker-ce -y -
Enable Docker to Start on Boot:
sudo systemctl enable docker sudo systemctl start docker
Step 3: Install Docker Compose
-
Download Docker Compose:
sudo curl -L "https://github.com/docker/compose/releases/latest/download/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose -
Set Permissions:
sudo chmod +x /usr/local/bin/docker-compose -
Verify Installation:
docker-compose --version
Step 4: Deploy Immich
-
Create a Directory for Immich:
mkdir ~/immich cd ~/immich -
Create a Docker Compose File:
nano docker-compose.ymlAdd 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: -
Start the Immich Service:
docker-compose up -d -
Access Immich: Open your browser and navigate to
http://your-domain-or-ip:2283.
A note on the compose file above: take the current one from the Immich release you are installing rather than copying any example, including this one. Immich moves quickly and the project ships a compose file per release. We have broken our own instance by carrying an old file across an upgrade.
Step 5: Configure Domains and SSL (Optional)
For a production-level application, it is advisable to secure your installation with SSL using tools like Certbot.
-
Install Certbot and the Nginx service:
sudo apt install certbot python3-certbot-nginx -y -
Then, you can follow the Certbot instructions for your server setup to obtain an SSL certificate.
Do not treat this step as optional for a photo library. We put TLS in front of Immich before the first upload rather than after, because the mobile app will happily talk to a plain HTTP endpoint and you do not want it doing that over someone elseโs wifi.
FAQs
1. How does Immich compare to other self-hosted solutions?
Immich is designed specifically for photo and video storage, making it ideal for users who need a dedicated space for their multimedia content. Unlike Nextcloud or OwnCloud which offer broader functionalities, Immich focuses on providing a simple, fast, and efficient platform for your media files. It also boasts a sleek interface and easy setup via Docker, appealing to users looking for quick deployment without sacrificing performance.
2. Why should I use a VPS instead of shared hosting for Immich?
Using a VPS offers several advantages for self-hosting Immich, including better performance, dedicated resources, and complete control over the environment. Unlike shared hosting, a VPS allows you to install the necessary software and configure the server according to your needs. This is especially beneficial for resource-intensive applications like Immich, which require optimal storage and processing capabilities.
3. What are some common issues I might face when self-hosting Immich?
Common issues can include network configuration problems, database connection errors, or issues with file permissions. When deploying Immich, ensure that your VPS has adequate firewall rules to permit traffic on the required ports. Additionally, confirming that all dependencies are met and that Docker is configured correctly will help minimize potential issues. For troubleshooting, the Immich documentation and r/selfhosted community are great resources.
By following this guide, you can confidently self-host Immich on a VPS, giving you full control over your media files while enhancing your understanding of containerization with Docker.