Gallery2:Preinstaller - Gallery Codex
Personal tools

Gallery2:Preinstaller

From Gallery Codex

The Gallery 2 Pre-Installer is a very small tool that puts Gallery 2 automatically on your webserver. Installing Gallery 2 on your webserver is as simple as:

  1. Download the preinstaller and put a single file on your webserver
  2. After two clicks Gallery 2 is ready on your server to be configured.

This is a great alternative for those users who do not have the option of extracting .zip or .tar files directly on the webserver. Our advice would be to switch to a better webhoster in such a case: better doesn't always mean more expensive. But if you want or need to stick with your current webhost that only offers FTP access or another simple web-transfer method, you should definitely use the Pre-Installer since uploading all Gallery 2 files and directories can take more than an hour and is very error-prone when using a bad FTP connection.

Note: If you use the Pre-Installer to get Gallery 2 onto your webserver, all your files and folders will be owned by the webserver user and not by your account on the webserver. This complicates upgrading to future Gallery 2 versions a little bit, but Gallery 2 ships with an easy to use tool that allows you to resolve that problem with a single click.

Download: Download Now!

Installation Instructions - Usage

And here's the whole truth...all steps in detail:

  1. Download the Gallery 2 Pre-Installer to your computer. Get it here
  2. Extract the gallery2-preinstaller-1.0.zip file.
  3. Open the extracted preinstall.php in Wordpad, notepad or another texteditor.
  4. Enter a password at the top of the file.
  5. Upload preinstall.php via FTP or another method to your webserver, e.g. to http://www.yourwebsite.com/preinstall.php
  6. Use your FTP program to change the permissions of the folder where preinstall.php is in to 777 (read+write+execute permission for everybody).
  7. Browse with your webbrowser to the location where you have uploaded preinstall, in our example that would be http://www.yourwebsite.com/preinstall.php
  8. Enter the password that you just added to preinstall.php in the web form.
  9. Click the download button to transfer the latest version of Gallery 2 to your webserver. Depending on your webserver this step can take only a second or up to ~15 minutes.
  10. Click the extract button to extract the Gallery 2 archive directly on the webserver. This step can take a few minutes.
  11. Follow the link to the Gallery 2 installer which will guide you through the storage folder and database setup steps.
  12. For security reasons, don't forget to change the permissions of the folder where preinstall.php is in back to 755 (read+exectute for everyone, read+write+execute for the owner).

Note: In the Gallery installer (The 11 step wizard which you go through once you are finished with the Pre-Installer), it is very important that you choose a Gallery storage folder that is outside of your gallery2 folder. It makes your life a lot easier!

Upgrading

Upgrading a normal installation using the Pre-Installer

  1. With your FTP program, move your gallery folder to e.g. gallery_old.
  2. Use the preinstall.php script to get G2 onto your webserver.
  3. If necessary, use the preinstall.php script to rename your gallery2 folder to e.g. gallery.
  4. Copy config.php and .htaccess to your new gallery folder.
  5. Run the upgrader as usual (browse to your gallery, it will start automatically).

Upgrading a G2 that has been installed with the Pre-Installer

  1. Use the chmod tool of your G2 (http://www.example.com/gallery2/lib/support/index.php?chmod) to prepare your gallery folder for the upgrade (open up the filesystem permissions).
  2. Put the preinstall.php script into the same folder as your Gallery folder is in (not into gallery2/main.php. Put it one folder higher.)
  3. If your Gallery folder is not "gallery2", use the preinstall.php script to rename your old Gallery folder to gallery2
  4. Use the preinstall.php script to get the latest G2 version onto server. (Download)
  5. Use the preinstall.php script to extract the new version over your existing gallery2 folder.
  6. Use preinstall.php to rename gallery2 to your original folder name, if you had a different name.
  7. Delete preinstall.php (leaving it on your server poses a security risk).
  8. Run the upgrader as usual (browse to your gallery, it will start automatically).
  9. Use the chmod tool (lib/support/) to secure your Gallery folder again. Maybe also click "fix Gallery Storage folder" after securing the Gallery folder.

Switching from a G2 that has been installed with the Pre-Installer to a normal installation

  1. Use the chmod tool of your G2 (http://www.example.com/gallery2/lib/support/index.php?chmod) to prepare your gallery folder for the upgrade (open up the filesystem permissions).
  2. Rename your Gallery folder to something like gallery_old
  3. Put your new Gallery folder on the webserver with whatever non-Pre-Installer method (FTP, CVS, ssh, ...) since you want to get rid of a "server-owned" G2.
  4. Copy config.php and .htaccess from your old to your new Gallery folder.
  5. Maybe the new Gallery folder is also a new version of G2, if so, run the upgrader.
  6. Make sure everything is working when using your new folder.
  7. If so, you can now safely delete your old gallery_old folder.

FAQ

Which download method should I choose?

All of them work. If available, choose Curl or wget since they are pretty efficient. Fsockopen and fopen on the other hand are the better job if the download takes a long time on your server and if wget and cURL time out for you.

Which extract method should I choose?

If available, go with any of the zip methods or with the PHP based tar. The tar binary could have some problems with very long paths.

Where is the chmod tool in Gallery 2?

The tool to change file permissions (change mode or short "chmod") is in http://www.example.com/gallery2/lib/support/index.php?chmod. Note: Only G2.1.1 and later have the chmod script built in. Also see: How can I fix the filesystem permissions of the Gallery storage folder?.

How can I upload a theme or module via FTP when I used the preinstaller?

See: G2 FAQ: How can I upload a theme or module via FTP when I used the preinstaller?

The chmod tool does not work, what's wrong?

The chmod tool can only change the filesystem permissions of files and folders that are owned by the webserver. Probably, some or all of your files / folders are owned by your account. If you don't use the Pre-Installer anyway, just forget about the chmod tool. Probably you don't need it. If you are a Pre-Installer user and need it to work, ask your webhost to run 'chown -R www /path/to/your/gallery/' since maybe your webhost accidentally changed the owner when restoring a backup or because they thought that was the right thing to do.

advertisements