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.
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.
CREATE DATABASE piwigo;
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
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:
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:
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.
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
Open a web browser and type in your domain name or IP address as the URL:
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:
Fill out the requested information as explained below.
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
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.
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.
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.
To visit the gallery, click on the Visit the gallery link at the top of the 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
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.
Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in our Questions & Answers section, find tutorials and tools that will help you grow as a developer and scale your project or business, and subscribe to topics of interest.Sign up now
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 DATABASE piwigo;
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.