How To Set Up A Gallery2 Multisite On An ISPConfig Server

Channel: Linux
Abstract: . Define path /var/www/web100/web/gallery/ as the path for the new multisite and pressI create a new website web100/web/ with a gallery directory in i
How To Set Up A Gallery2 Multisite On An ISPConfig Server 

Version 1.0
Author: <hans [at] bb-hosting [dot] org>

Introduction:

Gallery2 is a web based software product that lets you manage your photos on your own website. With this guide, I show you how to setup a MULTISITE for Gallery2.

Definition:

multisite - A multisite installation is a lightweight G2 installation which depends on the single codebase.

A multisite has only 6(7) files (main.php, index.php, embed.php, upgrade/index.php, lib/support/index.php + config.php (, .htaccess)).

A G2 multisite setup has a single codebase installation and an unlimited number of multisites.

Advantages

The primary advantage of multisites over normal G2 installations is saving the disk space that is required for each gallery2 folder (50-100 MB depending on the cluster size of the HDD partition). Only a single real gallery2 folder is required (codebase), multisites only use a few kilobytes per installation (plus the photos that they contain).

You only have to upgrade a single codebase. Once the codebase is replaced with a new G2 version, just visit the multisites and each multisite will automatically start it's upgrade process. Each multisite has to be upgraded independently, but you have to replace the underlying codebase only once.

The multisite installations don't share users, album/photos, or anything else from the user's point of view.

Multisites are completely separate and share only the same codebase.

In this how to, I will use just as an example:

- Gallery2 version 2.1.2
- Website for Gallery codebase: http://gallery.hostingcompany.tld/
- Website for Gallery multisite: http://www.mywebsite.tld/gallery/
- Web for Gallery2 multisite: web100
- MySQL database: web100_db1
- MySQL username: web100_u1
- MySQL password: mysqlpassword
- The used Linux distribution is Debian

I assume that you've setup the Gallery2 codebase already, according my Howto:
"Howto setup the Gallery2 codebase on an ISPConfig server".

With this Howto, I create a new website web100/web/ with a gallery directory in it.
Of course you can also add a MySQL database to your excisting site and add a gallery directory there.

Create a website for the Gallery2 multisite:

In ISPConfig, create a website via 「New site」 in the main menu. On the tab called 「Basis」 use gallery for the hostname and hostingcompany.tld for the domain name.

Enable MySQL and PHP scripts for this website but disable PHP Safe Mode.

Create a Administator user for the website:

In ISPConfig, create an Administrator user, so you can upload/download the website later via FTP:

In the main menu select 「ISP Manager」, select your new website called www.mywebsite.tld in the structure tree and press the tab 「User and Email」. Press 「new」 and define a new user and its email address. Give this user administrator rights and press 「Save」.

Create a MySQL database for the website:

Click on the tab called 「Options」 and create a new database for the website. ISPConfig will show you:

Database name: web100_db1
Database user: web100_u1
Database password: mypassword

Then you define a password for the database user and press 「Save」.

Note: Do not proceed if you did not setup the Gallery2 codebase!

The Gallery 2 installer program (multisite):

Now it’s time to setup gallery2 for one of our websites, which make use of the Gallery2 codebase. First, create a folder within web100/web/ for the gallery. This must be writeable by the web server again:

Logon into your server as root and give the following commands:

cd /var/www/web100/web

mkdir gallery

chown -R www-data:www-data gallery

In your browser point to http://gallery.myhostingcompany.tld/install where you find the Gallery2 installer program.

Within the installer program make the steps 1, 2 & 3.

At step 4 within the Gallery installer, you choose 「Multisite installation」 instead of 「Standard Installation」.

Define path /var/www/web100/web/gallery/ as the path for the new multisite and press 「Select directory」:

If your multisite directory setup is successful, it will be confirmed: Press 「Continue to Step 4>>」.

Before we press 「Save」 at step 4  within the Gallery Installer, first we have to create a directory for gallery to store photos. This must be writeable by the web server:

So, enter the next commands in your /var/www/web100/web/gallery/ directory:

mkdir g2data

chown -R www-data:www-data g2data

Now, in your browser again, you can press 「Save」 to complete step 4.

If you've setup the storage directory successfully, it will be confirmed. Press 「Continue to step 5 >>」 to set up your database.

Step 5 within the Gallery2 installer guides you to set up your database for the multisite correctly.

To setup your database, please enter:

- MySQL databasename, which is web100_db1
- MySQL user password
- MySQL username, which is web100_u1

After entering the required information, press 「Save」.

If you’ve successfully setup the Gallery2 database, it will be confirmed. Press 「Continue to step 6>>」.

Define the Administrator for your Gallery2 website. If you've setup the administrator correctly, press  「Continue to step 7>>」.

Step 7 within the Gallery2 installer guides you to create a config file. We've done this already during the code-base setup, so simply press 「Continue to step 8>>」.

Step 8 within the Gallery2 installer guides you to setup the codebase. We've done this already during the code-base setup, so simply press 「Continue to step 9>>」.

On the next screen, you can select what you want to have installed:

Click on 「Activate Selected Modules」 to proceed and to activate the selected items. A security check is shown.

On the server give the following commands for security reasons:

chmod 755 /var/www/web100/web

chmod 644 /var/www/web1/web/config.php

After chmod the mentiones files, in your browser press 「Check Again」.

Now everything will look save.

Click on 「Continue to step 11」.

Now you are finished.

In your browser, you can point to URL http://mywebsite.tld/gallery/. Use your Gallery2 administrator account to upload your photos.

More information about Gallery2: http://gallery.menalto.com/

Ref From: howtoforge

Related articles