How to Install PiGallery 2 on Clear Linux Latest

PiGallery 2 is a web-based photo gallery that can be installed on a Clear Linux Latest system. In this tutorial, we'll go through the steps to install PiGallery 2 on Clear Linux Latest.

Prerequisites

Step 1: Update the System

Before installing PiGallery 2, it's important to update the system to the latest available packages.

sudo swupd update
sudo swupd bundle-add package-utils

This will update the system and install the package-utils bundle which will provide the 'grep' and 'awk' commands we'll need later on.

Step 2: Install Required Packages

Next, you'll need to install the following packages:

sudo swupd bundle-add nginx php basic-dev

The packages will be installed using the Clear Linux package manager.

Step 3: Install PiGallery 2

You can download the latest release of PiGallery 2 from GitHub, or use the following command to download the latest version directly from the command line:

curl -L https://github.com/bpatrik/pigallery2/releases/latest/download/pigallery2.zip -o pigallery2.zip

Once downloaded, extract the zip file to the /srv/ directory:

sudo unzip pigallery2.zip -d /srv/
sudo mv /srv/pigallery2-* /srv/pigallery2

Step 4: Configure Nginx

Use the following commands to open the configuration file for Nginx:

sudo nano /etc/nginx/nginx.conf

Add the following block of code just before the closing } of the http block:

server {
        listen       80;
        server_name  localhost;

        location / {
            root   /srv/pigallery2;
            index  index.html index.htm index.php;
        }

        location /api/ {
            root /srv/pigallery2;
            fastcgi_pass unix:/run/php-fpm.sock;
            fastcgi_param SCRIPT_FILENAME $document_root/api.php;
            include fastcgi_params;
        }

        location /masonry/ {
            root /srv/pigallery2/vendor/commercial/masonry/dist;
        }

        error_page 404 /404.html;
            location = /40x.html {
        }

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
    }

Save and exit the file by pressing Ctrl + X. You'll need to verify Nginx's configuration before you can use it.

sudo nginx -t
sudo systemctl restart nginx
sudo systemctl enable nginx
sudo systemctl status nginx

Step 5: Configure PHP-FPM

Make sure PHP-FPM is configured to listen on a socket by using the following commands:

sudo sed -i 's/listen = 127.0.0.1:9000/listen = \/run\/php-fpm.sock/' /etc/php-fpm.d/www.conf
sudo systemctl restart php-fpm
sudo systemctl enable php-fpm
sudo systemctl status php-fpm

Step 6: Access PiGallery 2

Open a web browser and navigate to http://localhost/ to access PiGallery 2. You should see a message that says "No albums found" since you haven't uploaded any photos yet.

You can upload photos to the gallery by copying them to the /srv/pigallery2/gallery/ directory.

Congratulations! You've successfully installed PiGallery 2 on Clear Linux Latest.

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!