How to Install PiGallery 2 on Debian Latest

PiGallery 2 is a web-based photo gallery software that can turn your home media server into a beautiful and interactive photo album. In this tutorial, we will guide you through the steps to install PiGallery 2 on Debian Latest.

Prerequisites

Before we begin, make sure you have the following prerequisites fulfilled:

Step 1: Install Required PHP Extensions

The first step is to install the PHP extensions required by PiGallery 2. Open the terminal and run the following command:

sudo apt-get install php-imagick php-gd

Once the installation completes, restart the Apache web server to apply the changes:

sudo systemctl restart apache2

Step 2: Download and Install PiGallery 2

Next, download the latest version of PiGallery 2 from the official website using the following command:

wget https://github.com/bpatrik/pigallery2/releases/download/vX.Y.Z/pigallery2-X.Y.Z.zip

Replace 'X.Y.Z' with the latest stable release version available.

Extract the downloaded zip file by running:

unzip pigallery2-X.Y.Z.zip

Move the extracted directory to your web root directory /var/www/html/:

sudo mv pigallery2 /var/www/html/

Change the ownership and permissions of the directory recursively:

sudo chown -R www-data:www-data /var/www/html/pigallery2
sudo chmod -R 755 /var/www/html/pigallery2

Step 3: Configure PiGallery 2

Create a new MySQL/MariaDB database and user by running:

mysql -u root -p

Enter your MySQL/MariaDB root password when prompted.

CREATE DATABASE pigallery2;
CREATE USER 'pigallery2'@'localhost' IDENTIFIED BY 'password';
GRANT ALL ON pigallery2.* TO 'pigallery2'@'localhost';
FLUSH PRIVILEGES;
exit

Replace 'password' with a strong password of your choice.

Now, navigate to the pigallery2 directory and rename the config.sample.php file to config.php:

sudo mv config.sample.php config.php

Open the config.php file in a text editor and modify the following lines:

define('PIGALLEY_DATABASE_USER', 'pigallery2');
define('PIGALLEY_DATABASE_PASSWORD', 'password');
define('PIGALLEY_DATABASE_DATABASE', 'pigallery2');

Replace 'password' with the password you created for the pigallery2 user.

Save and close the file.

Step 4: Enable Apache Rewrite Module

PiGallery 2 uses Apache URL Rewrite module to make clean URLs. To enable this module, run:

sudo a2enmod rewrite

Restart the Apache web server to apply the changes:

sudo systemctl restart apache2

Step 5: Access PiGallery 2 Web Interface

Now, you can access PiGallery 2 web interface by visiting the following URL in your web browser:

http://your_server_ip/pigallery2/

You will be redirected to the login page where you can enter the default username and password, which is 'admin' for both.

Congratulations! You have successfully installed PiGallery 2 on your Debian Latest server. Now you can upload your photos and create beautiful galleries.

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!

Alternatively, for the best virtual desktop, try Shells!