Gallery 2 is a popular web based photo album application. This details how to install Gallery2 on Ubuntu 7.10 (Gutsy Gibbon). These instructions assume you have installed Apache2, PHP, and MySQL (as per an install of Ubuntu Server).
- Create Gallery2 Image Storage
- Create the Gallery2 Database
- Install the PHP GD library and/or NetPBM library
- Download and unpack Gallery2
Create Gallery2 Image Storage
We need to create a directory for Gallery2 to store images in, and this directory needs to be writable by the web-server. On Ubuntu this means creating a directory owned by the group “www-data”, and making the directory group-writable.
$ mkdir ~/.gallery2images
$ sudo chgrp www-data ~/.gallery2images
$ chmod 770 ~/.gallery2images
If you’re not an admin, you’ll have to settle for making the directory world-writable:
$ mkdir ~/.gallery2images
$ chmod 777 ~/.gallery2images
Create the Gallery2 Database
If you have root access to the mysql database, then:
$ mysqladmin -uroot -p create gallery2db
$ mysql gallery2db -uroot -p \
-e"GRANT ALL ON gallery2db.* TO dbusername@localhost IDENTIFIED BY 'password'"
Replace “dbusername” with your database user name of choice, and “password” with your password of choice.
If you do not have root access, then you need to get your administrator to create a database for you. You can use an existing database; Gallery prefixes all tables and columns in the database with a string you can configure later in the installation process.
Install an image processing library
Gallery2 supports a few different 3rd party image libraries for generating thumbnails, resizing images, and so forth. ImageMagick is a popular choice, and is installable from the Ubuntu repository, however at the time of this writing the ImageMagick in the Ubuntu repository is 126.96.36.199, which has known security issues. So instead we have the choice of the GD library for PHP or NetPBM, both also from the Ubuntu repository. Install with:
$ sudo apt-get update
$ sudo apt-get install php5-gd
$ sudo apt-get install netpbm
$ sudo /etc/init.d/apache2 restart
The restart of Apache2 is required so PHP will find the GD library.
If you don’t have administrator access to the Ubuntu machine, you’ll need to get your administrator to install one of these libraries.
Download and unpack Gallery2
Go grab the latest Gallery 2 . In my case, this is 2.2.4. Go to the directory where you want to install gallery and unpack it. This must be a directory which is visible on the web:
$ cd public_html
$ tar xvzf ../gallery-2.2.4-typical.tar.gz
And then point your browser at the install directory. From here you can pretty much follow the instructions given by the installer. If you need additional help, have a look at the instructions from the Gallery2 website.