How To Install the Piwigo Photo Gallery on Ubuntu 14.04

Published on December 18, 2014
How To Install the Piwigo Photo Gallery on Ubuntu 14.04


Piwigo is a free, open-source, and customizable photo gallery software program distributed under the GNU General Public License (version 2).

In this guide, we will focus on getting Piwigo installed with the Apache web server on Ubuntu 14.04. At the end of this tutorial, you’ll have a working photo gallery with multiple albums. You can add pictures from a browser-based control panel, and let anyone view your gallery from the web.


Before you begin, please make sure you have these prerequisites.

Step 1 — Configure the Database

In this section we will create a database and MySQL user for Piwigo.

To get started, log in to MySQL with the root account you set up during the LAMP installation.

mysql -u root -p

The system will prompt you for a password. This will be the same MySQL root password used in the prerequisite LAMP guide.

Let’s create a database to be used for Piwigo. We’ll call it piwigo in this example.


Next we need to create a database user and assign a password. You can use a different username than piwigouser if you want to, and you should definitely replace the password.

CREATE USER piwigouser@localhost IDENTIFIED BY 'password';

Grant the newly-created user permission to access the database:

GRANT ALL PRIVILEGES ON piwigo.* TO piwigouser@localhost;

Now set the new user and reload the privileges:


We can now exit out of MySQL:


Step 2 — Download Piwigo

Now we will download the latest version of Piwigo from the server.

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

In order to extract the compressed files, you will need to install the “unzip” package:

sudo apt-get install unzip

Extract the Piwigo files from the zip file:

unzip piwigo.zip

Step 3 — Copy Files to Document Root

Copy Piwigo’s files to Apache’s document root:

sudo rsync -avP ~/piwigo/ /var/www/html/

Alternately, you could set Piwigo up on a virtual host.

Step 4 — Install Dependencies

To allow Piwigo to add and create images, we will need to make sure the GD Graphics Library is installed:

sudo apt-get install php5-gd

Restart the web server:

sudo service apache2 restart

Step 5 — Complete Installation

Open a web browser and type in your domain name or IP address as the URL: http://your-server-ip/.

Note: If you see the default Apache page, you can remove it:

sudo rm /var/www/html/index.html

Refresh the page.

You will now be presented with the Piwigo installation page:

Piwigo Installation Page

Fill out the requested information as explained below.

Database configuration

By default, the Host and Database tables prefix will be filled in automatically and can be left with the original settings.

You will need to enter the details for the following:

  • User: In our example, we will use piwigouser. This is the same as the database user that was created in Step 1

  • Password: This password is the new database password entered in Step 1

  • Database name: For this guide, we will use piwigo. This is the name of the MySQL database you created in Step 1

Administration configuration

In this section, you can create a brand new username and password that will let you log in to the Piwigo control panel.

  • Username: Create a new username for the Piwigo website and to access the administration panel. For this guide, we will use “piwigo” as the username, but you can use your own

  • Password and Password [confirm]: Enter a password for your login, and once more to verify

  • Email address: Enter the email address you want to use as the site administrator

  • Options: Choose whether or not you want to Subscribe to Piwigo Announcements Newsletter and Send my connection settings by email – Both of the options are selected by default. You can choose not to receive the emails by unchecking the box for each

Once you filled everything out, click on the Start installation button. If everything was configured properly you will see a success message; otherwise, it will give you errors that will need to be corrected.

Congratulations. Piwigo installation is completed

Now you can click the Visit the gallery button to access the control panel

You’ll be prompted to Start the Tour. You have to click that button to get started. After that, you’ll be on the Piwigo home page.

You can click through the tour, or click the End tour button.

From the left menu, under Photos, click on Add.

Before you can add your first photo, you will need to click the create a new album link.

create a new album

Under Album name, type in a name and then click on the Create button.

Click on the Add Photos button to select one or more image files. Alternately, you can drag and drop files into the browser. Once you’re done, click on the Start upload button.

Add Photos

To visit the gallery, click on the Visit the gallery link at the top of the page.

Gallery home page

You can visit the gallery any time by visiting your IP address or domain in your browser.

To get back to the Piwigo control panel URL, you can visit http://your_server_ip/admin.php.


You now have a Piwigo photo gallery running on Ubuntu 14.04. To discover additional features of your gallery, you can launch live guides that will introduce you to different sections of the administration panel. From the main gallery view, you can access these guides by clicking on Administration, then Plugins, and then Take a Tour.

Thanks for learning with the DigitalOcean Community. Check out our offerings for compute, storage, networking, and managed databases.

Learn more about us

About the authors
Default avatar


Still looking for an answer?

Ask a questionSearch for more help

Was this helpful?

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

In case anyone runs into this:

“Connection to server successful, but the connection to the database was not possible.”

I had to run “use piwigo;” in between the following two steps:


CREATE USER piwigouser@localhost IDENTIFIED BY ‘password’;

As soon as I did that, installation proceed just fine!

Great tutorial - everything worked fine. The only thing I would change is your rsync command. It dumps everything into the top directory, which is fine if that’s all you are running on your web server, but many of us run other things as well. I suggest making a subdirectory (piwigo) and putting everything there.

sudo rsync -avP ~/piwigo/ /var/www/html/piwigo

Then go to http://your-server-ip/piwigo for the rest.


Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Join the Tech Talk
Success! Thank you! Please check your email for further details.

Please complete your information!

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel