Mar 11, 2024

Ubuntu : Install Piwigo Server

Piwigo is an Open Source Photo Management Server, it allows you to self-host your very own photo management, organizing and share your photo easily on the web.

More information about Piwigo can be found at (https://piwigo.org)

Let's get started.....


1. As always, ensure that your Ubuntu Server is up-to-date.

sudo apt update && sudo apt upgrade -y


2. Next is to install the Web Server, Database Server and some utilities.

sudo apt install apache2 libapache2-mod-php mariadb-server unzip curl imagemagick -y


3. We also need to install the following dependencies.

sudo apt install php php-common php-intl php-mysql php-gd php-xml php-ldap php-zip php-mbstring php-xmlrpc php-cli php-curl -y


4. After installation completed, we need to modify the PHP Configurations.

sudo nano /etc/php/8.1/apache2/php.ini

Inside the "php.ini" configuration file, look for the following settings and modify it accordingly.

memory_limit = 256M

upload_max_filesize = 200M

post_max_size = 200M



5. Then restart the Apache2 Server.

sudo systemctl restart apache2


6. Now, we need to create the Database for Piwigo to work, just press [ENTER] key when prompted for password.

sudo mysql -u root -p

Follow the below to create the database.

CREATE DATABASE piwigo_db;

CREATE USER 'piwigo_user'@'localhost' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON piwigo_db.* TO 'piwigo_user'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;

FLUSH PRIVILEGES;

QUIT;



7. Download the latest Piwigo version.

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


8, After download complete, extract the zip file to the web server.

sudo unzip piwigo.zip -d /var/www/html


9. Next is allow the appropriate credentials for the Piwigo folder.

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

sudo chomod -R 755 /var/www/html/piwigo/


10. Next is to create the Apache configuration file.

sudo nano /etc/apache2/sites-available/piwigo.conf

Create the configuration file as per below.

<VirtualHost *:80>
   ServerAdmin webmaster@localhost
   ServerName piwigo.localhost
   DocumentRoot /var/www/html/piwigo
   ErrorLog ${APACHE_LOG_DIR}/error.log
   CustomLog ${APACHE_LOG_DIR}/access.log combined

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


11. Then we need to enable the newly created site.

sudo a2ensite piwigo.conf


12. We also need to enable Apache module as below.

sudo a2enmod rewrite


13. Finally we need to restart Apache Server.

sudo systemctl restart apache2


14. Once done, open any preferred browser and browse to Piwigo site.

http://[IP Address]/piwigo


15. You will need to perform initial configurations of piwigo, enter all the relevant information as required. This includes the Database Name and Credentials, also you will need to create an administrator user (to manage the Piwigo) which are not "Root".


16. Once everything are successfully configured, you will be able to login to the Piwigo site and you can start to create your first album and start uploading photos.

Note : It is recommended to install a Plugin called "Community" which allows your "Users" to create their own albums and upload photos.





!!! HAPPY COMPUTING !!!