How to Install And Set Up PhotoPrism On Docker compose With A Database On Ubuntu: A Step-by-Step Guide

For tech enthusiasts looking to efficiently manage their photo collections, PhotoPrism is an excellent choice. This application not only organizes photos but also provides robust search capabilities powered by AI. In this guide, we will provide you with a detailed step-by-step process to install and set up PhotoPrism using Docker on an Ubuntu system, including setting up a database for optimal performance.

Prerequisites

Before proceeding, ensure you have the following:

  1. Ubuntu Server or Desktop (18.04 or later)
  2. Docker and Docker Compose installed. If you haven’t installed Docker yet, execute the following commands:
   sudo apt update
   sudo apt install docker.io
   sudo systemctl start docker
   sudo systemctl enable docker

For Docker Compose, run:

   sudo apt install docker-compose
  1. Basic knowledge of the terminal for command execution.

Step 1: Create a Directory for PhotoPrism

Start by creating a dedicated directory for housing PhotoPrism files:

mkdir ~/photoprism
cd ~/photoprism

Step 2: Create a Docker Compose File with Database

Using your preferred text editor, create a docker-compose.yml file in the photoprism directory:

nano docker-compose.yml

Add the following configuration to the file, which includes both the PhotoPrism and PostgreSQL services:

version: '3.8'

services:
  postgresql:
    image: postgres:13
    restart: unless-stopped
    environment:
      POSTGRES_DB: photoprism
      POSTGRES_USER: photoprism
      POSTGRES_PASSWORD: YourDatabasePassword
    volumes:
      - "./database:/var/lib/postgresql/data"

  photoprism:
    image: photoprism/photoprism
    restart: unless-stopped
    ports:
      - "2342:2342"
    environment:
      PHOTOPRISM_ADMIN_PASSWORD: "YourAdminPassword"
      PHOTOPRISM_DATABASE_DRIVER: "postgres"
      PHOTOPRISM_DATABASE_PORT: "5432"
      PHOTOPRISM_DATABASE_HOST: "postgresql"
      PHOTOPRISM_DATABASE_USER: "photoprism"
      PHOTOPRISM_DATABASE_PASSWORD: "YourDatabasePassword"
      PHOTOPRISM_ORIGINALS_PATH: "/photoprism/originals"
    volumes:
      - "./originals:/photoprism/originals"
      - "./database:/photoprism/database"

Important Notes:

  • Replace YourAdminPassword with a strong password for the PhotoPrism admin account.
  • Replace YourDatabasePassword with a secure password for accessing the PostgreSQL database.

Step 3: Start the Docker Containers

With your docker-compose.yml file configured, start the services by running:

docker-compose up -d

This command will pull the necessary images and spin up the PostgreSQL and PhotoPrism containers in detached mode.

Step 4: Verify the Installation

Once the containers are running, check the status of your services:

docker-compose ps

Both the PostgreSQL and PhotoPrism containers should be listed as running. If you encounter any issues, review the logs for troubleshooting:

docker-compose logs -f

Step 5: Access PhotoPrism

Now that PhotoPrism is operational, open your web browser and navigate to:

http://localhost:2342

Log in using the credentials from Step 2. You will have administrative access to manage your photo collection.

Step 6: Upload Your Photos

To start building your photo library, place your original photos in the ~/photoprism/originals directory. PhotoPrism will automatically index and categorize these photos for easy access.

Step 7: Adding Backup and Maintenance (Optional)

To safeguard your data, consider implementing backup solutions for your PostgreSQL database and your photo originals. This can be performed using standard backup tools or custom scripts to periodically save your data.

Conclusion

You have now successfully installed and set up PhotoPrism on Docker with a PostgreSQL database on your Ubuntu system. By following this guide, you’ll have a powerful platform for organizing, searching, and managing your photo library.

Enjoy diving into your memories with enhanced organization and ease, and remember to keep Docker images and containers up to date for optimal performance. Happy photo organizing!

Leave a Reply

Your email address will not be published. Required fields are marked *