Successful relocation of Gallery 2

June 9th, 2007 - 8:23am by Slye Fox

Now that's how it's supposed to happen! Works the first time like a charm. With the re-porting of goobertech from Drupal 4.7 to 5.0, I first recreate the entire site on a new location so the original can stay un-adultered and live. After re-doing the new drupal installation (with a few errors and tribulations), I set about duplicating the 1.47 gigs of gallery data on the new location. Here's how I did it:

  1. First Backup the g2data folder. I did this easily with shell access. The command is...
    tar -czvpf gallerybackup.tgz g2data/

    This created a tarred zip file of the entire gallery file data. This includes all of the albums and actual pictures/files.
  2. Then I backed up the gallery database. Since I combine my drupal and gallery databases for some fancy and complex site manuevers, this took a bit more doing. The drupal database already existed and since phpMyAdmin can only handle about 5 Mb without timing out, I had to move most of the gallery tables one at a time. I simply exported them from the original database, and then opened them through sql in the new database.
  3. Now the fun part -- waiting. It took almost 5 hours to download the zipped gallerybackup file and then upload it to the new location.

    UPDATE - with my new shell interface as root on the server (use putty), I can now do all this from shell. Now download/upload. The trick at this step is to copy the backup file to the new user directory. Inside the old user directory (with the backup file) type:

    cp gallerybackup.tgz /home/new_user_dir
  4. Meanwhile, I uploaded the new gallery 2 system files and installed a virgin copy in the new location. I simply let gallery do its own database table creating and gave it a new g2data folder to get a clean install.
  5. Once the backup file was uploaded, I renamed the g2data folder used by the fresh install to something else, (g2data2), for example. Then I unzipped the backup with this command in shell...
    tar -xzvpf gallerybackup.tgz

    So far so good.
  6. Then I recursively chmodded the entire directory with this...
    chmod -R 777 g2data/

    Now all the files and directories in g2data have read/write permission.
  7. Without touching the gallery install yet, I deleted all the gallery tables from the new database. Then I used the backed up tables from the original database to recreate them with phpMyAdmin's sql tab.
  8. Now I browsed to my gallery install (direct link). The gallery wizard did an upgrade and all was well!
  9. The last step was to copy the original site's .htaccess file (the one in the root directory). Otherwise gallery had login/permissions errors. I also had to update the member data in gallery (the owner, specifically) to match the new owner/admin name in drupal.

And that's it -- a perfect relocation with no links lost. I did have to re-activate the urlRewrite module and the matrix theme. But afterwards, everything simply worked. As it should be!