Skip to main content

Piwigo Installation and Configuration on gallery.deome.net

Overview

This page provides step-by-step instructions to install and configure Piwigo as a photo gallery on gallery.deome.net. This includes setting up the Apache virtual host, database configuration, and SSL with Let’s Encrypt.


1. Prerequisites

  1. Web Server: Apache (see Apache wiki page).
  2. Database: MariaDB (refer to MariaDB setup page).
  3. PHP: Ensure PHP is installed along with the necessary modules:
    sudo apt install php php-mysql php-xml php-mbstring php-gd php-curl -y
    

2. Download and Install Piwigo

  1. Create the Document Root Directory:

    • Create a directory for Piwigo:
      sudo mkdir -p /var/www/gallery
      
  2. Download Piwigo:

    • Navigate to the gallery directory and download the latest Piwigo release:
      cd /var/www/gallery
      sudo wget https://piwigo.org/download/dlcounter.php?code=latest -O piwigo.zip
      sudo unzip piwigo.zip
      sudo mv piwigo/* ./
      sudo rm -rf piwigo piwigo.zip
      
  3. Set File Permissions:

    • Make sure Apache has the correct permissions to access and modify the files:
      sudo chown -R www-data:www-data /var/www/gallery
      sudo chmod -R 755 /var/www/gallery
      

3. Configure the Database

  1. Log in to MariaDB:

    sudo mysql -u root -p
    
  2. Create a Database and User for Piwigo:

    CREATE DATABASE piwigodb;
    CREATE USER 'piwigouser'@'localhost' IDENTIFIED BY 'your_password';
    GRANT ALL PRIVILEGES ON piwigodb.* TO 'piwigouser'@'localhost';
    FLUSH PRIVILEGES;
    EXIT;
    

4. Configure Apache Virtual Host for gallery.deome.net

  1. Create the Virtual Host File:

    • Open a new virtual host configuration file for gallery.deome.net:
      sudo nano /etc/apache2/sites-available/gallery.deome.net.conf
      
  2. Add the Virtual Host Configuration:

    • Use the following configuration:
      <VirtualHost *:80>
        ServerName gallery.deome.net
        DocumentRoot /var/www/gallery
        <Directory /var/www/gallery>
            AllowOverride All
            Require all granted
        </Directory>
        ErrorLog ${APACHE_LOG_DIR}/gallery_error.log
        CustomLog ${APACHE_LOG_DIR}/gallery_access.log combined
      </VirtualHost>
      
  3. Enable the Site and Rewrite Module:

    • Enable the virtual host and rewrite module, then reload Apache:
      sudo a2ensite gallery.deome.net.conf
      sudo a2enmod rewrite
      sudo systemctl reload apache2
      

5. Set Up SSL with Let’s Encrypt

  1. Install Certbot:

    • If Certbot is not already installed:
      sudo apt install certbot python3-certbot-apache -y
      
  2. Generate SSL Certificate:

    • Use Certbot to obtain an SSL certificate for gallery.deome.net:
      sudo certbot --apache -d gallery.deome.net
      
  3. Enable Auto-Renewal:

    • Certbot will automatically handle renewal. Test the setup with:
      sudo certbot renew --dry-run
      

6. Complete Piwigo Setup

  1. Access the Piwigo Installation Wizard:

    • Open a browser and go to https://gallery.deome.net. You should see the Piwigo setup wizard.
  2. Follow the Setup Wizard:

    • Enter the database information:
      • Database Name: piwigodb
      • Database User: piwigouser
      • Database Password: your_password
    • Configure the admin account and complete the setup.

7. Testing and Verification

  1. Access Piwigo:

    • Verify that Piwigo loads correctly at https://gallery.deome.net.
  2. Check Logs:

    • Monitor the Apache logs if any issues arise:
      sudo tail -f /var/log/apache2/gallery_access.log
      sudo tail -f /var/log/apache2/gallery_error.log
      

8. Maintenance and Updates

  1. Database Backup:

    • Set up regular database backups:
      mysqldump -u root -p piwigodb > /path/to/backup/piwigodb.sql
      
  2. Updating Piwigo:

    • Periodically check for updates in the Piwigo admin dashboard.

This setup should get Piwigo running smoothly on gallery.deome.net. Let me know if you need any specific configurations or additional settings!