How to Install PiGallery 2 on Void Linux

PiGallery 2 is a powerful, free and open-source photo gallery management tool. This tutorial will guide you through the process of installing PiGallery 2 on Void Linux.

Prerequisites

Before you start the installation process, make sure you have the following prerequisites:

Step 1: Install Required Dependencies

First, make sure that your system is up to date by running the following command:

sudo xbps-install -Suy

Next, install the necessary dependencies with the following command:

sudo xbps-install -y nginx php7-fpm php7-gd php7-exif php7-mbstring php7-json php7-zip

Step 2: Download the PiGallery 2 Archive

To download the latest version of PiGallery 2, open a terminal window and use the following command:

wget https://github.com/bpatrik/pigallery2/releases/download/vX.X.X/pigallery2-X.X.X.tar.gz

Note: Replace X.X.X with the current version of PiGallery 2.

Extract the downloaded file using the following command:

tar -xzf pigallery2-X.X.X.tar.gz

Step 3: Configure Nginx

Create a new Nginx configuration file by running the following command:

sudo nano /etc/nginx/sites-available/pigallery2.conf

Copy and paste the following configuration into the file:

server {
    listen 80;
    server_name <your-domain-name>;
    root /path/to/pigallery2;
    index index.php index.html;
 
    location / {
        try_files $uri $uri/ /index.php$is_args$args;
    }
 
    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_pass unix:/run/php-fpm.sock;
    }
}

Replace the following with your own values:

Save and close the file.

Enable the new configuration file by creating a symbolic link:

sudo ln -s /etc/nginx/sites-available/pigallery2.conf /etc/nginx/sites-enabled/

Reload the Nginx configuration by running the following command:

sudo systemctl reload nginx

Step 4: Configure PiGallery 2

Open the config.php file in the PiGallery 2 directory:

sudo nano /path/to/pigallery2/config.php

Set the following values to match your configuration:

<?php
define('PG_CONFIG_PATH', '/path/to/pigallery2/config.ini');
define('PG_INDEX_PATH', '/var/www/html/pigallery2');
define('PG_CACHE_PATH', '/path/to/pigallery2/cache');
define('PG_THUMB_PATH', '/path/to/pigallery2/cache/thumbnails');
define('PG_TITLE', 'PiGallery');
define('PG_SHOW_SCROLL_TO_TOP', true);
define('PG_SHOW_IMAGE_METADATA', true);
define('PG_SHOW_EXIF_DATE', true);
define('PG_SHOW_EXIF_ISO', true);
define('PG_SHOW_EXIF_FOCAL', true);
define('PG_SHOW_EXIF_SHUTTER', true);
define('PG_SHOW_EXIF_APERTURE', true);
?>

Save and close the file.

Step 5: Access PiGallery 2

Open your web browser and enter the following URL:

http://<your-domain-name>/

If everything was configured correctly, you should see the PiGallery 2 interface in your browser.

Congratulations! You have successfully installed PiGallery 2 on Void Linux.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!