Introduction

PhotoPrism is an open-source photo management system designed for self-hosting, perfect for users who want a private cloud solution for organizing and viewing their photos. With its support for facial recognition, metadata management, and high-quality image organization, PhotoPrism is a great alternative to cloud services like Google Photos. In this guide, we’ll show you how to set up PhotoPrism on your VPS using Docker.


What You’ll Need

Before getting started, ensure that you have the following:

  • A VPS running Ubuntu (or another supported OS)
  • Docker and Docker Compose installed on your server
  • A domain or subdomain configured for accessing PhotoPrism
  • Basic knowledge of the Linux terminal

Step 1: Preparing the VPS

1.1 Update and Install Dependencies

First, make sure your system is up-to-date:

sudo apt update && sudo apt upgrade -y
sudo apt install curl git -y

1.2 Install Docker & Docker Compose

If you haven’t already installed Docker and Docker Compose, do it now:

# Install Docker
sudo apt install docker.io -y

# Install Docker Compose
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose

Verify the installations:

docker --version
docker-compose --version

Step 2: Set Up PhotoPrism with Docker

2.1 Clone the PhotoPrism Repository

Now, clone the PhotoPrism repository to your server:

git clone https://github.com/photoprism/photoprism.git
cd photoprism

2.2 Configure Docker Compose

Create a .env file for PhotoPrism configuration. This file contains environment variables that will be used by Docker Compose.

nano .env

Add the following settings, replacing placeholders with your own values:

PHOTOPRISM_ADMIN_PASSWORD=your-password
PHOTOPRISM_HTTP_PORT=2342
PHOTOPRISM_HTTPS_PORT=443
PHOTOPRISM_IMPORT_PATH=/photoprism/import
PHOTOPRISM_UPLOAD_PATH=/photoprism/uploads

2.3 Start PhotoPrism with Docker Compose

Now, start the PhotoPrism service using Docker Compose:

docker-compose up -d

This will pull the necessary images and start the containers in the background. To check if the containers are running:

docker ps

Step 3: Set Up a Reverse Proxy (Optional)

If you want to use a domain or subdomain to access PhotoPrism securely over HTTPS, you can set up a reverse proxy with Nginx.

3.1 Install Nginx

Install Nginx on your server:

sudo apt install nginx -y

3.2 Configure Nginx

Create a new configuration file for your domain:

sudo nano /etc/nginx/sites-available/photoprism

Add the following configuration, replacing yourdomain.com with your actual domain:

server {
listen 80;
server_name yourdomain.com;

location / {
proxy_pass http://localhost:2342;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

server {
listen 443 ssl;
server_name yourdomain.com;

ssl_certificate /etc/letsencrypt/live/yourdomain.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/yourdomain.com/privkey.pem;

location / {
proxy_pass http://localhost:2342;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}

Enable the Nginx configuration:

sudo ln -s /etc/nginx/sites-available/photoprism /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx

3.3 Secure with SSL (Optional)

For SSL, you can use Certbot to get a free SSL certificate:

sudo apt install certbot python3-certbot-nginx -y
sudo certbot --nginx -d yourdomain.com

Step 4: Accessing PhotoPrism

Once everything is set up, navigate to your domain or IP address in a browser:

http://yourdomain.com or https://yourdomain.com

Log in with the admin password you set earlier. You should now see the PhotoPrism interface, where you can upload, organize, and view your photos.


Conclusion

Now you have a fully functional self-hosted PhotoPrism instance running on your VPS! You can start uploading your photos and enjoy the privacy and control that comes with self-hosting. Additionally, PhotoPrism offers advanced features like face detection and metadata management, making it a powerful tool for organizing your photo library.


About EngineerHow.com

EngineerHow.com provides easy-to-follow tutorials for IT professionals, engineers, and self-hosting enthusiasts. Whether you’re setting up servers, exploring Docker, or working on civil engineering projects, you’ll find step-by-step guides and resources to help you along the way.


Leave a Comment

Have questions or feedback about setting up PhotoPrism? Drop a comment below!


Comparison Chart:

FeaturePhotoPrismGoogle PhotosApple iCloud Photos
Open-Source
Facial Recognition
Self-Hosting
Paid Subscription
Cloud StorageUser-ProvidedProvidedProvided

Top-Rated Free Alternatives:

  • Lychee: A self-hosted photo management system.
  • Piwigo: Another open-source photo gallery software.
  • Photoview: A privacy-friendly photo viewer.

Links:

  • Official PhotoPrism Documentation: Link
  • Download PhotoPrism: Link