How to Install Piwigo on Debian Latest

Piwigo is an open-source photo gallery software that lets you organize and share your photos with friends and family. Here's how to install Piwigo on Debian Latest.

Prerequisites

Before you get started, make sure you have the following prerequisites:

Step 1: Update the System

The first step is to update the Debian Linux system, which ensures the installed packages on the system are up-to-date.

Run the following command to update the package list:

sudo apt-get update

After updating the package list, you can now upgrade the installed packages by running:

sudo apt-get upgrade

Step 2: Install Nginx

To install Nginx, type the following command:

sudo apt-get install nginx

Once the installation is complete, start the Nginx service and enable it to automatically start at boot time:

sudo systemctl start nginx
sudo systemctl enable nginx

Step 3: Install PHP

Piwigo requires PHP to run, so you must install it on the Debian operating system alongside other PHP modules.

To install PHP and its modules, use the following command:

sudo apt-get install php7.4-fpm php7.4-common php7.4-mysql php7.4-xml php7.4-xmlrpc php7.4-curl php7.4-gd php7.4-imagick php7.4-cli php7.4-dev php7.4-imap php7.4-mbstring php7.4-opcache php7.4-soap php7.4-zip

Restart PHP by running:

sudo systemctl restart php7.4-fpm

Step 4: Install and Configure MariaDB

The next step is to install MariaDB, which is a popular open-source database management system.

To install MariaDB, use the following command:

sudo apt-get install mariadb-server

Once MariaDB is installed, run the following command to secure it:

sudo mysql_secure_installation

After securing MariaDB, create a database and a user for Piwigo using the following commands:

sudo mysql -u root -p
CREATE DATABASE piwigodb;
CREATE USER 'piwigouser'@'localhost' IDENTIFIED BY 'your-password';
GRANT ALL PRIVILEGES ON piwigodb.* TO 'piwigouser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Step 5: Install Piwigo

You can now install the Piwigo software by downloading it from the official website using the following command:

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

Extract the downloaded file and move it to the Nginx root document folder, which is /var/www/html/:

sudo apt-get install unzip
sudo unzip piwigo.zip -d /var/www/html/
sudo mv /var/www/html/piwigo/* /var/www/html/

Change the ownership of the piwigo folder to the www-data user and group:

sudo chown -R www-data:www-data /var/www/html/

Step 6: Configure Nginx

Finally, you need to configure Nginx to host the Piwigo application.

Create a new Nginx configuration file:

sudo nano /etc/nginx/sites-available/piwigo

Add the following configuration to the file:

server {
    listen 80;
    server_name example.com; #change this

    root /var/www/html;
    index index.php;

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

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
    }
}

Save and close the file. Then, create a symbolic link to this configuration file in Nginx's "sites-enabled" directory:

sudo ln -s /etc/nginx/sites-available/piwigo /etc/nginx/sites-enabled/piwigo

Validate the configuration file by running:

sudo nginx -t

If the test is successful, reload Nginx:

sudo systemctl reload nginx

Step 7: Finalize the installation

You can now finish the Piwigo installation by navigating to your server's IP address or domain name in a web browser.

Select your preferred installation language, and specify the database details you created earlier in Step 4.

After installation, Piwigo will prompt you to create an administrator account. After this step is complete, you can log in and start using Piwigo.

Conclusion

You have now successfully installed Piwigo on Debian Latest. Piwigo is an excellent photo gallery software that is easy to use and manage, allowing you to share your photos with just a few clicks. Happy photo-sharing!

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!