Piwigo and Raspberry PI: a Private Open Source Photo Management Platform


Last Updated on 2nd September 2023 by peppe8o

In this tutorial, I’m going to show you how to install Piwigo on your Raspberry PI computer board. It can also be considered a great Google Photo alternative, as the Google service requires a paid subscription once you require more space. An important thing is, after the Piwigo installation, to use the official users manual to keep our files secure from any outage with periodic backups.

About Piwigo

Keeping your pictures and videos in smartphones can suddenly drain your storage space. Piwigo with Raspberry PI can save your space and give you more features to manage them privately.

Basically, Piwigo is an open source photo management software. It is built on a client-server architecture: all the specific software needed to run the platform is installed in your server (Raspberry PI according to this tutorial). You can use the platform both from a common web browser or from Piwigo client applications available both for Android and Apple devices. For desktop clients, you can use Piwigo with desktop applications like digiKam, Shotwell and Lightroom or FTO clients.

The server component can be installed both in a local computer or can be served from the Piwigo cloud. The latter can be get by subscribing to their cloud plans, but you can self-host Piwigo locally without any fee.

The aim of this software is to enhance photo management, by making it simpler to edit them in batch or filtering images by collections, dates and tags.

Another interesting feature is that you can use the plugin for Google Maps or OpenStreetMap in order to browse your pictures based on the geo metadata on an interactive map.

Piwigo is highly customizable in an easy manner: just browse their themes and plugins, choose your preferred one and click “install” to get it installed.

Finally, you can publish your Piwigo pictures to external users, allowing them to post comments, rates, mark photos as favourites, perform searches and get notified of news by email. With a few more pieces of hardware, you can also create your digital frame and photo management platform hosted on the same RPI running the Raspberry PI in kiosk mode (Raspberry PI OS Desktop is required in this case, but all the remaining steps from this guide remain the same).

For this tutorial, I’m going to use a Raspberry PI 3 Model A+, but you can use these steps with any Raspberry PI computer board.

What We Need

As usual, I suggest adding from now to your favourite e-commerce shopping cart all the needed hardware, so that at the end you will be able to evaluate overall costs and decide if to continue with the project or remove them from the shopping cart. So, hardware will be only:

raspberry pi 3 model A+

Check hardware prices with the following links:

Amazon raspberry pi boards box
Amazon Raspberry PI 3 Model A+ box
Amazon Micro SD box
Amazon Raspberry PI Power Supply box

Step-by-Step Procedure

Prepare The Operating System

Please start with OS installation. You can use both Raspberry PI OS Lite (to get a fast, headless OS) or Raspberry PI OS Desktop (a little slower, but including a full desktop environment).

Make sure that your OS is up to date. From the terminal, please use the following command:

sudo apt update -y && sudo apt upgrade -y

You can now proceed with the next steps by installing LAMP in your Raspberry PI.

Add the required packages

Install the required php modules/packages, according to Piwigo requirements:

  • imagick > we’ll install it
  • gd > we’ll install it
  • exif: already included in php-common
  • ffmpeg > we’ll install it
  • mbstring (required for Debian) > we’ll install it
  • XML (required for Debian) > we’ll install it

You can get them satisfied with the following terminal command:

sudo apt install php-imagick php-gd ffmpeg php-mbstring php-xml -y

Finally, restart the Apache service:

sudo systemctl restart apache2.service

Configure MariaDB for Piwigo

Log into MariaDB shell as root:

sudo mariadb -u root

Create a database for Piwigo (I called it “piwigo”, but you can name it as you prefer):

create database piwigo;

grant all privileges of Piwigo database to the user (with password) that you will configure in Piwigo in the next steps. Please use your favourite database name, DB user and DB password instead of red ones (respectively piwigo, piwigouser and piwigopassword):

grant all privileges on piwigo.* to piwigouser@localhost identified by 'piwigopassword';

Flush the privileges table for the changes to take effect and then exit

flush privileges;

Install Piwigo in your Raspberry PI

Now we can proceed with the real Piwigo installation. I’ll use the manual install method, as the netinstall method get problems in the past.

Download the installation package directly in your Raspberry PI and uncompress it:

curl http://piwigo.org/download/dlcounter.php?code=latest -o piwigo.zip
unzip piwigo.zip

Move the content into the Apache public folder in a new folder named “piwigo” (or you can name it how you prefer, remembering to use you folder name both on URL and in the following commands):

sudo mkdir /var/www/html/piwigo
sudo mv piwigo/{.,}* /var/www/html/piwigo/

The mv command may result in warnings that can be skipped (as shown in the following code snippet): with the “{.,}” part we moved also the hidden files and with this trick the mv command tries also to move the current folder (“.”) and the parent folder (“..”), but it doesn’t perform the move of the two.

pi@raspberrypi:~ $ sudo mv piwigo/{.,}* /var/www/html/piwigo/
mv: cannot move 'piwigo/.' to '/var/www/html/piwigo/.': Device or resource busy
mv: cannot move 'piwigo/..' to '/var/www/html/piwigo/..': Device or resource busy

Finally, assign the proper privileges to the public folder in order to make it possible for Piwigo installer to do its job:

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

We can also remove the old piwigo folder from your user home, as it remained empty after the move operation:

rmdir piwigo/

Complete Piwigo Installation from Web GUI

From here, we can use a remote browser to complete the installation steps. Use your Raspberry PI’s IP address, followed by the “piwigo”. That means, for example, being my local RPI IP address, my URL will be “”. As the software detects that Piwigo installation isn’t still completed, it will automatically propose the installation page. From here, you can already set your favourite language:


Now, you will have to add your database name, DB user and DB password (according to what was set in the previous “Configure MariaDB for Piwigo” step). Please leave the Host variable set to “localhost”.

Moreover, you will need to choose the administrator username, password and email address. These credentials will be the ones you will use to access the web dashboard. you can also choose or not to subscribe your email for Piwigo Announcements Notices. Finally, click the “Start installation” button:


We are near the installation end… and a confirmation message will be shown once all have been completed successfully:


From here, please click the “Visit the gallery” button. Your installation is still empty, so Piwigo is just advising you that your Gallery hasn’t any content:


With the “I want to add photos” button, you will go to the Piwigo dashboard:


Piwigo installation in your Raspberry PI ended. Once added the first pictures, considering your Raspberry PI IP address instead of the “RPI_address” label, you will have:

  • http://RPI_address/piwigo -> from this page you will reach your photo management dashboard
  • http://RPI_address/piwigo/admin.php -> from this page you will reach the administration dashboard (only for administrator users)

From here, you can use the official Piwigo user manual, even if the interface is more than intuitive. A few more examples will be shown in the next chapters.

Change Piwigo Theme

Piwigo offers a lot of free themes that can be installed with a few clicks. Please note that themes apply only to the photo management pages, while the administration dashboard will probably remain unchanged even with different themes.

Once logged with the administrator user, from the left sidebar please click Configuration, then select themes:


You will reach the Themes menu, which shows all the installed themes. To search for new themes, please use the “Add a new Theme” tab:


The new page will show a lot of free themes available for installation. Choose your favourite and click the “Install button” for that theme:


A message will notify that the new theme is installed, even if still not active:


Go back to the “Installed Themes”. In my case, I’ve been “unlucky” as the theme I’ve chosen requires a root theme. This is shown by passing the mouse over the “Activate” button at the installed theme:


Of course, this depends on what theme you have selected and installed. In my case, I have to go back to the “Add a new theme” to identify the required theme “Pure_default” and install it. Once done, my favourite theme becomes activable (as the Activate button changes colour):


Click Activate button. In this way you will make the new theme available for users, as it will be listed in “Active Themes” section:


You can also “Set as default” the theme so that users will find it active from the first time they connect to your Piwigo pages. As said, it will not apply to the Administration pages, but moving to “http://RPI_address/piwigo” URL will show the new theme:


Please note that you need to create at least your first Album in order to be able to see the Piwigo pages with the new theme.

Use External USB Storage with Piwigo and Raspberry PI

As pictures may take a lot of space and usually the Raspberry PI SD card hasn’t enough space for your needs, a common operation required for Piwigo installations is getting the main data on external USB Storage.

For this task, there isn’t an official procedure. But, according to what is mentioned in some Piwigo forum posts, the main folders to move should be:

  • galleries
  • _data
  • upload

First of all, please note that Raspberry PI OS Lite doesn’t mount automatically external USB storage at boot. So, we have to make it fixed and with the right grants for the www-data user and group (Apache) access and edit.

I will use an USB storage formatted with FAT32 File System and I will mount it at the /media/myUSB mount point using the FSTAB, as described in my Automount USB storage with Raspberry PI OS Lite: fstab and autofs tutorial. Please note that the FSTAB row allowing Apache access will be like the following:

UUID=your_disk_UUID /media/myUSB vfat uid=www-data,gid=www-data 0 2

Where you must add your USB storage UUID instead of the red chars.

Please remember to assure that the new USB Storage is mounted before proceeding. For this you can both reboot your Raspberry PI or issue the command:

sudo mount -a

You can see the storage with the df command (the “-H” option will simplify the Byte reading), which shows the partitions use:

pi@raspberrypi:~ $ df -H
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        16G  2.3G   13G  16% /
devtmpfs         84M     0   84M   0% /dev
tmpfs           220M     0  220M   0% /dev/shm
tmpfs            88M  988k   87M   2% /run
tmpfs           5.3M  4.1k  5.3M   1% /run/lock
/dev/mmcblk0p1  268M   33M  236M  12% /boot
/dev/sda1        32G   66k   32G   1% /media/myUSB
tmpfs            44M     0   44M   0% /run/user/1000

Once the above steps are completed and the USB Storage is correctly mounted at “/media/myUSB” mount point, we can create a folder on the USB Storage that will contain all the files:

sudo mkdir /media/myUSB/piwigo

Now, we can move all the files for the “_data”, “galleries” and “upload” in our USB Storage:

sudo mv /var/www/html/piwigo/_data/ /media/myUSB/piwigo/
sudo mv /var/www/html/piwigo/galleries/ /media/myUSB/piwigo/
sudo mv /var/www/html/piwigo/upload/ /media/myUSB/piwigo/

We’ll substitute the old folders in Apache with symlinks:

sudo ln -s /media/myUSB/piwigo/galleries/ /var/www/html/piwigo/galleries
sudo ln -s /media/myUSB/piwigo/_data/ /var/www/html/piwigo/_data
sudo ln -s /media/myUSB/piwigo/upload/ /var/www/html/piwigo/upload

and finally give the symlinks again the www-data ownership:

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

While adding photos to your Piwigo, you can check that the space in your USB Storage will increase:

pi@raspberrypi:~ $ df -H
Filesystem      Size  Used Avail Use% Mounted on
/dev/root        16G  2.3G   13G  16% /
devtmpfs         84M     0   84M   0% /dev
tmpfs           220M     0  220M   0% /dev/shm
tmpfs            88M  988k   87M   2% /run
tmpfs           5.3M  4.1k  5.3M   1% /run/lock
/dev/mmcblk0p1  268M   33M  236M  12% /boot
/dev/sda1        32G  4.4M   32G   1% /media/myUSB
tmpfs            44M     0   44M   0% /run/user/1000

What’s Next

Interested in more cool ways to use your RPI? Take a look at peppe8o Raspberry PI computer tutorials!

Enjoy your Piwigo on Raspberry PI!

How useful was this post?

Click on a star to rate it anonymously!

Average rating 5 / 5. Vote count: 1

No votes so far! Be the first to rate this post.

We are sorry that this post was not useful for you!

Let us improve this post!

Tell us how we can improve this post?