Gallery Multisite Installation

From DreamHost
Jump to: navigation, search
The instructions provided in this article or section require shell access unless otherwise stated.

You can use the PuTTY client on Windows, or SSH on UNIX and UNIX-like systems such as Linux or Mac OS X.
Your account must be configured for shell access in the Control Panel.
More information may be available on the article's talk page.

The instructions provided in this article or section are considered advanced.

You are expected to be knowledgeable in the UNIX shell.
Support for these instructions is not available from DreamHost tech support.
Server changes performed by DreamHost may break your modifications. You, as the user, are responsible for troubleshooting and resolving issues with your customizations.

This instructions are for installing Gallery2 with a common codebase for multiple sites. The main advantage to this is to be able to upgrade all your Gallery2 sites at once.

The instructions are based on the instructions provided in the Gallery2 documentation.

If you simply want to install Gallery in one site, you'll be better off with the One-Click Install provided by DreamHost which is fully supported by DH's team.


Download and install Gallery2 codebase

  • Download and open
# this is an EXAMPLE, replace the number with the actual version
# of Gallery2 that you are going to install
# !!!!! make sure this is the rigth version !!!!!

# this is an EXAMPLE, replace with the path to the web area of a domain 
# (or, better yet a subdomain) you own which will be used *ONLY* to hold 
# the Gallery2 codebase. This *HAS* to be accessible via web
export G2CODEBASEPATH=${HOME}/www/

cd ${HOME}/soft
tar xvzf gallery-${GALLERYVERSION}-full.tar.gz
  • Move or copy the codebase
if [ -d ${G2CODEBASEPATH} ]
  # the path already exists. Move the contents.
  mv -v ${HOME}/soft/gallery2/* ${G2CODEBASEPATH}
  # the path doesn't exist. Move the directory.
  mv -v ${HOME}/soft/gallery2 ${G2CODEBASEPATH}

Global database

This is optional but recommended. If you are administering multiple gallery2 instances you might want to have only one database and differentiate instances with a table prefix. Create a new database and associate a user/password with it as explained in MySQL. If you prefer, you can create a different database/user/password for each instance.

That's it. Since this installation is only the codebase, you don't need to do anything else globally.

Create a new (multi)site

Gallery2 documentation refer to each instance (or site) as a multisite. This is a Gallery2 instance which will have its own URL and database table prefix (or database), thus Gallery2 users will be different among sites.

To create a new instance (multisite) you must run the install scripts from a browser and do the installation as follows.

  • First, create the domain/subdomain where you want this multisite. For example, if you created the domain and want the new gallery site URL to be http: //, do the following:
# this is an EXAMPLE, replace with the path to the web area of the domain 
# (and optionally path within the domain) where you want your new
# Gallery2 multisite
# This path *MUST BE DIFFERENT* from the one where the codebase
# resides (${G2CODEBASEPATH})
export G2SITEPUBPATH=${HOME}/www/
export G2SITEURL=

# this is an EXAMPLE, replace with the proper path (this should be
# *OUTSIDE* the area visible within the web).
export G2SITEPRIVPATH=${HOME}/data/gallery2/

# Create the directories to hold the multisite public and private data
mkdir -pv ${G2SITEPUBPATH}
mkdir -pv ${G2SITEPRIVPATH}

  • To see the install URL type in your terminal:

if you're brave enough you could do this from inside your terminal shell with:


but you'd rather do it from your favorite browser.

  • Load the URL (which will look something like http: // in your browser.

Step 1: Authenticate

  • Choose your language and click Begin Installation.
  • You have to authenticate yourself to the codebase installer... the only way to do this is to verify that you have access to the physical directory where the codebase is installed. You'll see that the installer shows you a 32 character string and asks you to put it in a file called login.txt in the directory where you installed the codebase (if you already run the installer once and created the login.txt file you won't have to do this.
  • If the string you got from the installer is 0123456789abcdeffedcba9876543210 you can do this (in your terminal):
cat > ${G2CODEBASEPATH}/login.txt <<EOF
or create the ${G2CODEBASEPATH}/login.txt file with your favorite text editor. Put the actual string that you got from the installer and not the example string up here.
  • Now press the Authenticate me button.
  • Press Continue to Step 2.

Step 2: System Checks

This step is System Checks for now, ignore the warning about Output buffering being enabled.

  • Press Continue to Step 3.

Step 3: Installation Type

This is the Installation Type step. This is the IMPORTANT one, that is, this is where you tell the installer that you want to create a new multisite (rather than actually activate a gallery where the codebase is installed).

  • Choose Multisite Installation
  • Fill the installation path with the public directory you just created. To see this path, type in your terminal:
  • Press the Select Directory button.
  • Press Continue to Step 4.

Step 4: Storage Setup

This is the Storage Setup step.

  • DON'T leave the proposed private directory path... in order to increase security, we'll put this outside the area reachable from the web (the Gallery installer can't know that we do, indeed, use a separate directory).
  • Fill the directory path with the private directory you just created. To see this path, type in your terminal:
  • Press the Save button.
  • Press Continue to Step 5.

Step 5: Database Setup

This is the Database Setup step.

  • In Database type choose MySQL (v3.23.34a and newer)
  • In DB Hostname put the hostname you chose when you created the #Global_database. Note that in DreamHost this is never localhost.
  • In DB Username put the username you chose when you created the #Global_database.
  • In DB Password put the password you chose when you created the #Global_database.
  • In DB Name put the database name you chose when you created the #Global_database.
  • In Table Prefix put a prefix specific to this instance (multisite)... you could put something like example_org_pictures_ or maybe something shorter, but that would inequivocally refer to this instance.
  • In Column Prefix you can leave the default value.
  • Press the Save button.
  • Press Continue to Step 6.

Step 6: Admin user Setup

This is the Admin user Setup step.

    • Fill in the fields with the username, password (twice), email address and real name for the administrator of this instance. This will be the username that will have access to configure the gallery instance, create users, etc.
    • Press the Create button.
  • Press Continue to Step 7.

Step 7: Create Config File

This is the Create Config File step. It should run automatically. It creates a file named config.php within ${G2SITEPUBPATH} to hold the data gathered in the previous steps.

  • Press Continue to Step 8.

Step 8: Install Gallery Core

This is the Install Gallery Core step. It should run automatically.

  • Press Continue to Step 9.

Step 9: Install Plugins

This is the Install Plugins step.

  • Select the plugins you want
  • If you want to, press the Activate Selected Modules button. Some of the modules might require configuration later on.
  • Press Continue to Step 10.

Step 10: Check Security

This is the Check Security step. It should run automatically.

  • Press Continue to Step 11.

Step 11: Finish Installation

This is the Finish Installation step. It should run automatically.

There you are.

Login to the new (multi)site

Now load the URL for your new gallery instance (multisite). To see this URL, type in your terminal:

echo ${G2SITEURL}
  • Login with the admin account you just created and start configuring and populating your Gallery.