Installing Piwigo on Void Linux

Piwigo is an open-source photo gallery software that allows you to upload and manage your photos, organize them into albums, and share them with others. In this tutorial, we'll show you how to install Piwigo on Void Linux.

Prerequisites

Before we proceed with the installation, ensure that your Void Linux system is up to date:

sudo xbps-install -Suv

Install Required Software

To install Piwigo, you need to install a web server, PHP , and a database server. In this tutorial, we will use the Nginx webserver, PHP7, and MariaDB as a database server. So, run the following command to install these packages:

sudo xbps-install -S nginx php7 php7-fpm php7-mysqli php7-gd php7-exif mariadb

After installing these software packages, let's move to the next step.

Configure Nginx

Now, we need to configure Nginx to serve Piwigo. Open the Nginx configuration file using your preferred editor:

sudo vi /etc/nginx/conf.d/piwigo.conf

Then, add the following configuration:

server {
    listen 80;
    server_name domain.com;
    root /usr/share/webapps/piwigo/;
    index index.php;

    # Logs for piwigo
    access_log /var/log/nginx/piwigo.access.log;
    error_log /var/log/nginx/piwigo.error.log;

    location / {
        try_files $uri $uri/ /index.php?$args;
    }

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_pass unix:/run/php/php-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;
    }
}

Here, we define a server block that listens on port 80 and serves piwigo from /usr/share/webapps/piwigo/ directory. We also defined the index file as index.php. In addition, we set up the error and access logs for piwigo. Save and close the file.

Now, test the Nginx configuration:

sudo nginx -t

If the configuration is correct, restart the Nginx service to apply the changes:

sudo systemctl restart nginx 

Create a MariaDB Database

Now, we will create a MariaDB database for piwigo. Login to MariaDB root account using the following command:

sudo mysql -u root -p

Then, create a new database and user for piwigo:

CREATE DATABASE piwigo;
CREATE USER piwigo_user@localhost IDENTIFIED BY 'password_here';
GRANT ALL PRIVILEGES ON piwigo.* TO piwigo_user@localhost;
FLUSH PRIVILEGES;
EXIT;

Replace password_here with a strong password for the piwigo_user. Remember this password, as you will need it later.

Download and Install Piwigo

Download the latest Piwigo version from the Piwigo official website using the following command:

sudo wget https://piwigo.org/download/dlcounter.php?code=latest -O piwigo.zip

Unpack the downloaded file to the Nginx document root directory:

sudo unzip piwigo.zip -d /usr/share/webapps/

Change the ownership of the piwigo directory to the nginx user:

sudo chown -R nginx:nginx /usr/share/webapps/piwigo/

Configure Piwigo

Now, we will configure Piwigo by editing the configuration file. To create a new configuration file, copy the config_default.inc.php file to config.inc.php:

sudo cp /usr/share/webapps/piwigo/include/config_default.inc.php /usr/share/webapps/piwigo/include/config.inc.php

Next, open the configuration file for editing:

sudo vi /usr/share/webapps/piwigo/include/config.inc.php 

Update the following fields in the configuration file:

$conf['dblayer'] = 'mysqli';
$conf['db_host'] = 'localhost';
$conf['db_user'] = 'piwigo_user';
$conf['db_password'] = 'password_here';
$conf['db_name'] = 'piwigo';

Ensure to replace the password_here field with the MariaDB root password you created earlier.

Finalizing the Installation

After completing the installation and configuration, you need to restart the PHP7-FPM service:

sudo systemctl restart php-fpm

Finally, open your web browser and visit http://your-domain.com. On the welcome page, click the "Let's go!" button to start the Piwigo installation process.

Conclusion

You now have Piwigo fully installed on your Void Linux system. You can start uploading and sharing your photos with Piwigo. If you have any issues, feel free to consult Piwigo official documentation for help.

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!