User Tools

Site Tools


Installation on Debian

Preparing the installations


  1. MySQL database installed
  2. Have the databases root user password available
  3. Apache web server installed

Installing Gallery3

Since the packages transported via HTTPS, you need to have the right transport method installed for APT:

apt-get install apt-transport-https

Add the repository containing the gallery 3 package:

echo 'deb unstable/
deb-src unstable/' > /etc/apt/sources.list.d/schultmc.list

Import the repository key, update your sources and install the package:

apt-key adv --keyserver --recv-keys 9EC002FE1C9CA517
apt-get update
apt-get upgrade
apt-get install gallery3

The configuration dialog will ask you if it should restart your Apache server.

If the Apache server did not start:

service apache2 start

You should now be able to access the fresh Gallery 3 installation under

http(s)://<hostname or ip>/gallery3

Configuring Gallery3

Changing the re-write base

If you want to change the re-wirte base there are a bunch of .htaccess files in the Debian installation that need to be touched.

The following command changes the re-write base to the site-root:

find /var/lib/gallery3/ -name '.htaccess' | xargs -n 1 sed -i 's/RewriteRule .* \/gallery3/RewriteRule (.*) /'

Migrate from Gallery2 to Gallery3

Regenerate thumbnails

In Gallery2 regenerate the thumbnails to make sure they are all correct:

  1. Click “Site Admin”
  2. In the navigation under section “Gallery” click “Maintenance”
  3. Click “Build all thumbnails/resizes”

Depending on the size of your gallery that may take a some minutes.

Import from Gallery2

Switch your Gallery3 to maintenance mode:

  1. Click “Maintenance”
  2. Click “Turn on maintenance mode”
  3. Activate the modules: “Comments” and “Gallery2” import

Configure the importer module in Gallery3:

  1. From “Settings” choose “Gallery 2 import”
  2. Enter the path to Gallery2's embed.php file (usually /usr/share/gallery2/embed.php)
  3. The importer gives you tips on how to speed up the import - follow them

The import will run very long for a big collection of photos - be patient!

If the import stops, you check the in-app log via the web GUI and resume it.

  1. Click “Maintanance”
  2. Check the logs under “Finished tasks”
  3. Resume

Note that Gallery3 has a intentionally limited set of supported media formats. For example it refuses to import BMP files.

Moving from server to server

Note that the standard import only works if Gallery2 and Gallery3 are installed on the same machine. So if you want to migrate from 2 to 3 while switching to a new server, I recommend the following procedure:

  1. Install Gallery3 on the origin server in parallel to Gallery2
  2. Follow the instructions for the migration
  3. Copy the data to the destination server
  4. Take a nap - this will take a while if you have many photos

Troubleshooting the parallel installation

When tried to install Gallery2 and Gallery3 in parallel on my Debian 6 server, the configuration script enabled modphp4 which was not installed since PHP5 was there. Disabling the module solved the problem:

rm /etc/apache2/mods-enabled/php4.load

Generating a database dump and moving it

Generate a dump of the gallery3 database on the source machine:

mysqldump -u root -p --databases gallery3 > /tmp/gallery3_database_dump.sql

Transfer the dump to the destination machine (e.g. via scp).

On the destination server restore the database from the dump:

mysql -u root -p < /tmp/gallery3_database_dump.sql

Make sure the database user gallery3 has the right permissions. In MySQL type:

GRANT SELECT, INSERT, LOCK TABLES, UPDATE, DELETE, ALTER ON gallery3.* TO gallery3@localhost IDENTIFIED BY '<password>';
FLUSH privileges;
scp -rp /usr/share/gallery3/var <destination host>:/usr/share/gallery3

Check if the contents of the file /usr/share/gallery3/var/database.php match the new server! I ended up with a segmentation fault because the gallery3 MySQL user did not have access to the database.

gallery3.txt · Last modified: 2015/05/17 17:44 (external edit)