How to install and use Piwigo on your Raspberry Pi
There are dozens of photo management packages to self-host on the Raspberry Pi, and Piwigo is one of the best, offering a beautiful interface, multi-user management, and beautiful themes. While it’s not quite a replacement for Google Photos, it lets you take control of, access and view your snapshots on the internet.
What is Piwigo and why should you self-host it on your Raspberry Pi?
Over the past decade, smartphone users have grown accustomed to free, unlimited storage for photos taken on their phones. They could rest assured that the countless images of beach vacations, family reunions and major events would remain safe (albeit at lower quality than the original) in the hands of tech giants such as Google. , free forever.
That assurance was shaken in 2021 with the announcement that Google was to discontinue its free, unlimited storage option and possibly delete photos and albums if certain conditions were met. This has left users looking for an alternative that they can run, without restrictions, on their own hardware and at home.
Piwigo is one of these solutions. The software is considerably older than Google Photos, having been first released as PhpWebGallery in 2001, and re-released under a GNU General Public License in 2002. The license means users are free to run, study, share and modify the software for their own purposes. PhpWebGallery was renamed Piwigo in 2009.
Piwigo gives you an easy way to upload, manage, and view your photos online, and comes with beautiful theme options, mobile clients, and extensions. Piwigo will happily post photos to the web of models as old as the original Raspberry Pi.
How to install Piwigo on your Raspberry Pi
The first thing you need to do is prepare your Raspberry Pi for use as a server. Once the software is installed and working as it should, update and upgrade all installed packages:
sudo apt update
sudo apt upgrade
As with most awesome self-hosting projects, Piwigo requires a database to run and keep track of your photos, their locations, names, dates, and any edits you make. Run MariaDB:
…and enter the following, one line at a time, to create a new database and database user for Piwigo:
CREATE DATABASE piwigo;
CREATE USER piwigo IDENTIFIED BY 'supertopsecretpassword';
GRANT USAGE ON *.* TO piwigo@localhost IDENTIFIED BY 'supertopsecretpassword';
GRANT ALL privileges ON piwigo.* TO piwigo@localhost;
Visit your registrar’s Advanced DNS page and create a new Type A record, host@, and value as the public IP address. If you plan to use a subdomain, the host should be the desired subdomain alone, without the rest of the domain name.
Change directory and use nano to create a new Apache configuration file for Piwigo:
sudo nano piwigo.conf
In the file, specify port 80; set the ServerName to your domain or subdomain, and DocumentRoot to the directory where you plan to store Piwigo.
Save and exit nano with CTRL+Othen CTRL+X.
Activate the configuration file, then restart Apache:
sudo service apache2 restart
You have instructed Apache to accept incoming requests to your domain or subdomain and serve content from /var/www/piwigo/. This directory does not yet exist; create it and move to the new location with:
sudo mkdir /var/www/piwigo/
Download and rename the Piwigo net installer:
sudo curl https:
Give ownership of the current directory and its contents to the Apache user:
sudo chown -R www-data:www-data .
Install the Piwigo Photo Server
You are now ready to install the Piwigo photo server. Open a browser and navigate to your-domain-name.tld/install.php.
You will be asked to select a language and set a destination for the Piwigo archive. If you plan to access Piwigo through your base domain or subdomain name, delete everything after the /and leave this field blank.
Click on Retrieve and unzip Piwigo, and the installer will do exactly what it promised. You can check what was recovered with:
ls -a /var/www/piwigo/
Return to the browser to ensure that “Everything went well. You are now ready to start the installation procedure.” Click it Install Piwigo now button.
On the next screen, fill in the database configuration; the Host and Database table prefix the fields must already be filled in, so you only have to fill in the Name of the data base and user fields (both piwigo), and your password.
Complete it Administrative settings section to create an administrator user, then click Start the installation. Almost instantly, you will receive the message “Congratulations, Piwigo installation is complete”. Very easy.
Now that the administrator account is set up, you need to secure your website with TLS and upgrade the connections from HTTP to HTTPS.
Enter your email address when prompted and select your domain or subdomain from a list. Certbot will retrieve security certificates and keys from Let’s Encrypt and deploy them to your Raspberry Pi.
Use Piwigo on your Raspberry Pi
You can now visit your Piwigo photo library by visiting your domain or subdomain, but as you have no uploaded photos you will be told that “your Piwigo photo gallery is empty”.
The developers helpfully provide a large I want to add pictures button, which flashes orange when you mouse over it. Click on it then Create a new album. In the album, you can either click on the Add pictures or drag your files into the browser. Start downloading will, as expected, start downloading. Depending on the quality and number of photos you want to upload, this may take a long time.
The photos are paginated in the albums, and you can access the albums via the main page of your Piwigo installation.
Piwigo offers many configuration options, including the ability to add and manage multiple users, set default photo sizes, watermark images with your own stamp, and enable comments. These parameters are accessible by clicking on Administrator > Configuration. Another nice touch is the Piwigo theme gallery, with which you can completely change the look of your albums.
Piwigo on the go
Downloading photos from your phone to your computer and then uploading them to Piwigo via the web interface is a hassle. Luckily, the Piwigo developers have created mobile apps to take some of the effort out of it. The Piwigo app is available for iOS devices through the Apple App Store, for Android devices through the Google Play Store, and because Piwigo and its companion Android app are open source, through F Droid.
You can now use Piwigo to host and upload images to your Raspberry Pi!
In addition to being a personal archive for family photos, your online Piwigo gallery can serve as a showcase through which you show your talent to the world! Become a better photographer by learning about light and shadow or specialize in particular types of shots!