Gallery2 Quickstart Guide

Add comments

Gallery is an open source PHP web application that enables management of digital photos and other media.

Installing Gallery2

Download and extract the latest version of Gallery2, I choose the Minimal version

$ wget http://downloads.sourceforge.net/gallery/gallery-2.2.4-minimal.tar.gz
$ tar -zxvf gallery-2.2.4-minimal.tar.gz
$ cp gallery2/* /var/www/gallery

Create a database for gallery to use, for MySQL

mysql> create database databasename
mysql> grant SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER ON databasename.* TO 'username'@'localhost' identified by 'password'

Run the install script by pointing your browser to the base url of your website (e.g http://gallery.vincentkong.com), which will bring you through an installation wizard to setup Gallery.

Gallery Installer

When the Storage Setup is reached, Gallery will ask to specific a directory g2data where all the images will be stored. It is recommend that this directory is not web accessible, however if that’s not possible then add a randomize string to the end of the directory e.g. g2data_e76ab32e8b. Create the directory and set read/write permission to it.

$ cd /var/www/gallery
$ mkdir g2data_e76ab32e8b
$ chmod 777 g2data_e76ab32e8b

Storage Setup

Continue with the installation until the Create a config file step is reached, which then requires the config.php file to be created with read/write permissions

$ cd /var/www/gallery
$ touch config.php
$ chmod 666 config.php

After the installation has been completed, it’s recommended that write permission be removed from the config.php file.

$ chmod 644 config.php

Securing Gallery

It’s important to have the Gallery secure, here are a few things which can be done:

  • Prevent the viewing of the Gallery code by adding the following to the Apache configuration file or by creating a .htaccess in the Gallery root directory.
    <FilesMatch "\.(inc|class)$">
        Deny from all
    </FilesMatch>
  • If the g2data directory is web accessible it should be block from access with the following:
    <Directory /var/www/gallery/g2data>
        Deny from all
    </Directory>

For more information on securing Gallery refer to the Security Guide.

Troubleshooting

The thumbnails are not displaying for the albums.

  • To generate thumbnails Gallery2 requires the GD Library for PHP.  To install the GD Library in Ubuntu:
    $ apt-get install php5-gd

Related posts:

  1. Upgrading Gallery2
  2. Drupal Quickstart Guide
  3. MySQL for Ubuntu Quickstart Guide
  4. Gallery2 URL Rewrite Plugin
  5. WordPress Quickstart Guide

Comments are closed.

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Log in