Piwigo – Create Your Own Photo Gallery Website

Piwigo is an open-source project which allows you to create your own photo gallery on the web and upload photos and create new albums. The platform includes some powerful features built-in, such as albums, tags, watermark, geolocation, calendars, system notifications, access control levels, themes, and statistics.

Piwigo has a huge amount of available plugins (over 500) and a great collection of themes. It is also translated in more than 50 languages. Its core functions are written in PHP programming language and require an RDBMS database backend, such as MySQL database.

Piwigo Photo Gallery
Piwigo Photo Gallery

This fact makes it easy to deploy Piwigo on top of a LAMP (Linux, Apache, MySQL, and PHP) stack installed on your own server, VPS, or on shared hosted environments.

An online demo is available for you to try before installing Piwigo on the CentOS system.

Demo URL: http://piwigo.org/demo/

Requirements:

  1. A dedicated VPS with a registered domain name.
  2. A CentOS 7 Server or CentOS 8 with Minimal install.
  3. A LAMP stack installed in CentOS 7 or CentOS 8.

Piwigo is an open-source project which can be deployed on a VPS server of your choice.

You can get a 2GB RAM VPS from Linode for $10, but it’s unmanaged. If you want a Managed VPS, then use our new BlueHost Promotion Offer, you will get up to 40% OFF on hosting. If you get a Managed VPS, they will probably install Piwigo for you.

In this guide, we’ll learn how to install and configure Piwigo image gallery software on top of a LAMP stack in a CentOS 8/7 VPS server.

Setting Up Pre-requirements for Piwigo

1. After you’ve installed the LAMP stack on your VPS by following the guide in the article description, make sure you also install the below PHP extensions required by Piwigo to properly run on your server.

# yum install php php-xml php-mbstring php-gd php-mysqli

2. Next, install the following command-line utilities on your VPS server in order to download and extract Piwigo archive sources in your system.

# yum install unzip zip wget 

3. Next, log in to the MySQL database and execute the below command in order to create a Piwigo database and the user which will be used to manage the database. Replace the database name and credentials used in this tutorial with your own settings.

# mysql -u root -p
MariaDB [(none)]> create database piwigo;
MariaDB [(none)]> grant all privileges on piwigo.* to 'piwigouser'@'localhost' identified by 'pass123';
MariaDB [(none)]> flush privileges;
MariaDB [(none)]> exit

4. Next, open and edit the PHP configuration file and set the correct timezone settings for your server. Use PHP docs to get the timezone settings list.

# nano /etc/php.ini

Locate and Insert the below line after [Date] statement.

date.timezone = Europe/Your_city
Set Timezone in PHP Configuration
Set Timezone in PHP Configuration

Save and close the file and restart the Apache HTTP server to apply all changes, by issuing the below command.

# systemctl restart httpd

5. Next, we need to apply the SELinux security context to allow apache to write into Piwigo web root directory /var/www/html using the following commands.

# yum install policycoreutils-python-utils
# semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html(/.*)?"
# restorecon -R -v /var/www/html

Install Piwigo in CentOS 8/7

6. On the next step, visit Piwigo official download page and grab the latest installer zip sources on your system using wget utility by issuing the below command. After the download completes, extract the Piwigo zip archive in your current working directory.

# wget http://piwigo.org/download/dlcounter.php?code=latest -O piwigo.zip
# ls 
# unzip piwigo.zip 
Download Piwigo Software
Download Piwigo Software

7. After you’ve extracted the zip archive, copy Piwigo sources files into your domain webroot path by issuing the below command. Afterward, grant Apache user full privileges to webroot files and list the content of your web server document root path.

# cp -rf piwigo/* /var/www/html/
# chown -R apache:apache /var/www/html/
# ls -l /var/www/html/
Setting Up Piwigo Under Apache
Setting Up Piwigo Under Apache

8. Next, change the webroot file permissions for Piwigo installed files and grant _data directory full write permissions for other system users, by issuing the below commands.

# chmod -R 755 /var/www/html/
# chmod -R 777 /var/www/html/_data/
# ls -al /var/www/html/
Setting Permissions on Piwigo
Setting Permissions on Piwigo

9. Now, start the installation process of Piwigo. Open a browser and navigate to your server IP address or domain name.

http://192.168.1.164
OR
http://your-domain.com

On the first installation screen, select Piwigo language and insert MySQL database settings: host, user, password, and table prefix. Also, add a Piwigo admin account with a strong password and the email address of the admin account. Finally, hit on the Start installation button to install Piwigo.

Piwigo Installation Configuration
Piwigo Installation Configuration

10. After the installation has been completed, hit on Visit the gallery button in order to be redirected to Piwigo admin panel.

Piwigo Installation Completed
Piwigo Installation Completed

11. On the next screen, because no image has been uploaded to the server yet, hit on Start the Tour button in order to display the software guidance window and review all steps required to upload your photos and use the Piwigo image gallery.

Start Piwigo Tour
Start Piwigo Tour
Piwigo Admin Dashboard
Piwigo Admin Dashboard

That’s all! Now you can start creating image galleries and upload your image files to the server using one of the most flexible open-source solutions to host your photos.

Piwigo Image Gallery
Piwigo Image Gallery

If you’re looking for someone to install Piwigo image gallery software, consider us, because we offer a wide range of Linux services at fair minimum rates with 14-days free support via email. Request Installation Now.

If you liked this article, then do subscribe to email alerts for Linux tutorials. If you have any questions or doubts? do ask for help in the comments section.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

6 thoughts on “Piwigo – Create Your Own Photo Gallery Website”

  1. Sincerest thanks, Matei and team, for crafting this wonderfully comprehensive walkthrough. I’m up and running thanks to the fine job you’ve done. A quick note regarding a challenge encountered with sending emails from within Piwigo; /var/log/php-fpm/www-error.log indicated that SMTP connection attempts were failing. A bit of research took me to the PHPMailer Troubleshooting guide (https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting) where the author shares that SELinux on CentOS / Fedora / RedHat distributions often, by default, disallow httpd from making connections for sending an email.

    Checking the current config with ‘getsebool httpd_can_sendmail‘ as directed, I was answered with “httpd_can_sendmail –> off“. As the author states, executing ‘sudo setsebool -P httpd_can_sendmail 1‘ allows httpd to send mail, and after a quick restart of the httpd service (‘systemctl restart httpd’), emails are flying free.

    Thank you again for another opportunity to learn and broaden horizons!

    Reply
  2. Yepp, I followed the instruction to the point. Also finally found out that one has to use the database root user/passwd at the installation. Not the piwigo account created in the instructions. That made me a bit scared … However it installed.

    Reply
    • @Thommy,

      That’s great you finally installed Piwigo. If any help, feel free to post your queries here, we love to answer..

      Reply
  3. Hi,

    I’ve followed your instructions on a Fedora 28, MariaDB, Apache and PHP server and I can access a test.php (phpinfo) from remote, but the Piwigo installation gives this error message “Cannot connect to server”.

    Any hints on where to start debugging?

    Reply

Leave a Reply to Lee Cancel reply

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.