How to Install Piwigo on Ubuntu 20.04

Piwigo is a free and open-source photo gallery that allows users to upload and manage their photos on the web. Simply put, it's a photo manager, more like Google Photos, with a strong emphasis on user experience and simplicity. It provides an intuitive and easy-to-use User Interface that allows you to create photo albums and upload your favorite photos.

Piwigo provides additional plugins that allow users to further customize the look and feel of the UI and improve the overall presentation of photos.

There are two ways distinct ways that you can get Piwigo. You can host it by yourself on your VPS provided by your Web hosting company, in which case you have total control over your data and configuration. The other option is to sign up for Piwigo Cloud Hosting from Offical Piwigo Site. In the Cloud-hosted Piwigo model, all the technical tasks including installation, updates, backup, and maintenance are fully managed by the Company.

In this tutorial, we learn how to install Piwigo on Ubuntu 20.04.


Before getting started, perform a flight check and ensure you have the following:

  1. An instance of Ubuntu 20.04 with a sudo user configured
  2. A FQDN ( Fully Qualified Domain Name ) pointing to your server. If you don't have one, the server IP will still do the trick in the configuration of Piwigo.

Step 1: Install LAMP server

Piwigo is written in PHP and is a front-end application that stores data in a database. You can either use LAMP (Linux, Apache, MySQL/MariaDB, and PHP) or LEMP (instead of Apache use Nginx) stack. Here we are going to use the LAMP stack.

First following this detailed guide on how to install LAMP server on Ubuntu 20.04.

Once the LAMP server is installed, proceed and install some additional PHP extensions which will be essential during the installation of Piwigo.

$ sudo apt install libapache2-mod-php php-common php-intl php-mysql php-gd php-xml php-ldap php-zip php-mbstring php-xmlrpc php-cli php-curl unzip

With all the PHP modules installed, some changes need to be made in the php.ini file which defines PHP settings. So, access the file using your preferred text editor.

$ sudo vim /etc/php/7.4/apache/php.ini 

Modify the following directives in the php.ini file:

memory_limit = 256M
upload_max_filesize = 100M
date.timezone = Europe/Lisbon

For the date.timezone attribute, you are at liberty to specify your current timezone.

Once the changes have been made, save the file and restart Apache Webserver.

$ sudo systemctl restart apache2.service

Step 2: Create database for Piwigo

The next course of action is to create a database and database user for Piwigo in the MariaDB database.

Therefore, log in to the MariaDB prompt as shown.

$ sudo mysql -u root -p

First, we will create a database called piwigo_db as shown:


Next, we will create a database user called piwigo_user and grant all privileges to the user on the database.

CREATE USER  'piwigo_user'@'localhost' IDENTIFIED BY 'myP@ssword';
GRANT ALL ON piwigo_db.* TO  'piwigo_user'@'localhost' IDENTIFIED BY 'myP@ssword' WITH GRANT OPTION;

Then save the changes and exit the database server.


Step 3: Install Piwigo on Ubuntu 20.04

With the database ready, the next step is to download Piwigo's installation file. This comes in a zip file format. So, run the command shown.

$ curl -o

Next, extract or unzip the file in the /var/www/html path.

$ sudo unzip  -d /var/www/html/

Assign the Piwigo directory the required directory ownership.

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

And do likewise to the directory permissions.

$ sudo chmod -R 755 /var/www/html/piwigo/

In the next step will are going to further configure Piwigo.

Step 4: Create Virtualhost file for Piwigo

For Apache webserver to serve the Piwigo site, we need to create a virtual host file for Piwigo.

$ sudo vim /etc/apache2/sites-available/piwigo.conf

Paste the following content

<VirtualHost *:80>
DocumentRoot /var/www/html/piwigo

<Directory /var/www/html/piwigo/>
Options +FollowSymlinks
AllowOverride All
Require all granted

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined


Be sure to define the ServerName attribute with your own FQDN domain or server-IP address. Next, enable the Piwigo Virtual host file and enable the Apache rewrite module.

$ sudo a2ensite piwigo.conf
$ sudo a2enmod rewrite

Then finally restart the Apache webserver.

$ sudo systemctl restart apache2

Step 5: Complete installation of Piwigo

With everything set, launch your browser and browse your server's IP address or domain name:

http://server-ip or domain-name

This directs you to the Piwigo configuration page.

Piwigo configuration page
Piwigo configuration page

Fill out the database details from Step 2. Thereafter, define an Admin user by providing the username, password, and email of the Administrator. Once done, click 'Start Installation.

Fill out database configuration and Admin details for Piwigo
Fill out database configuration and Admin details for Piwigo

The installation takes just a few minutes and once done, click on the 'Visit the gallery' button.

By default, the gallery is empty so click on 'I want to add photos' button.

This ushers you to the Piwigo dashboard. From here, you can proceed to create your albums and add the photos.

Piwigo dashboard

The latest stable release, at the time of writing this is Piwigo 11.5.0. To update Piwigo go to Administration > Tools > Updates and click Update button.

You can follow this tutorial if you are interested to set up a free SSL certificate using Lets Encrypt.


This concludes the tutorial on how to install Piwigo on Ubuntu 20.04.

If you need a fully managed Piwigo service, enroll for Piwigo Cloud hosting which gets you started with a free month's Trial.

Leave a Comment