Changing Standalone G2 into a Multi-Site

Shadow_Wolf
Shadow_Wolf's picture

Joined: 2004-04-03
Posts: 181
Posted: Mon, 2005-09-05 18:21

I have been doing some testing with my integration code and I believe it should work fine with a Multi-Site installation. There currently isn't any documentation to change a Standalone G2 into a multisite. All that it says in the codex is:

Quote:
How to change a standalone G2 into a multisite

(this section needs to be expanded)

Any idea when this will be completed?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-09-05 20:44

wanna write it yourself? :)
seriously, everyone can register at codex.gallery2.org and contribute to existing pages and create new ones.

@topic:
i left this part out because it was low priority and i'd have had to think a little about what was needed for such a migration / change.

first and foremost, you have to know exactly what you want and what you do.
if you just want to use your existing gallery2 directory for more than the existing installation, no changes are needed. you can continue to use your existing installation as is and you can use it as the codebase / installer for new multisites.

I also assume you're using beta 4 or newer. Before beta 4, multisite worked differently. I'll not cover pre beta 4 to post beta 4 multisite upgrades here, this is covered in the README.html.

Only if you really want to separate your existing g2 from the codebase, i.e. either move the codebase to another directory or move the existing installation to a new directory, only then you need to follow the next steps.

- Database:
Of course you can keep your existing database etc.
- URL rewrite module (short urls):
if you use the url rewrite module, deactivate it before you begin with the changes. and delete the existing .htaccess file. You can install / activate the module again once you're finished with the process.
- Storage directory (g2data):
if you want to move the g2data dir into another folder, do it as the first step.
then make sure the permissions for the g2data folder and all its subdirectories and files are still ok (chmod -R 777 g2data or chown -R webserveruser g2data).

A) Keep installation in the folder where it is, but move the gallery2 files away to a more general directory:

1) copy config.php to another folder, just such that you don't forget / lose your database connection information.
2) Move the gallery2 directory to its new place. If you had the g2data directory within the gallery2 directory, a) don't move it with the gallery2 directory and b) consider having it above the webroot for your future installation (only then the image firewall of G2 works (security)).
Make sure the directory where your installation used to be is now empty.
3) Browse to the address of the new home of your gallery2 directory and start the installer gallery2/install/index.php).
4) In the installation type step, choose multisite and enter the filesystem path to the directory where G2 used to be. Create a new (empty) gallery2 directory if needed. chmod 777 etc. as if it was a normal multisite installation.
Advance to the next step
5) In the storage directory step, enter the path to your existing g2data directory. I assume it's already where it should be (as instructed in the prepation for these steps). Advance to the next step.
6) In the database setup step, enter the same old database connection information. If you forgot it, take a look at your backup copy of config.php. Click save.
It should show 3 options: erase, save and "reuse existing database tables". Choose the "Reuse" option!
7) in the Admin user step, click save
8) In the config file step, it should say, that it created the config file successfully.
9) You can stop the installation process at this point. Your multisite should work at this point

A) Keep the codebase in the folder where it is, but move the existing installation into a new directory:

1) Most of the following procedure is exactly like a normal multisite installation. Your codebase is already where it is, because your existing gallery2 is exactly like a codebase.
Browse with your webbrowser to your gallery2/install/index.php page
2) In the installation type step, choose multisite and choose the filesystem path of the new home for your existing gallery2 installation. Create the directory if necessary and chmod it correctly. Advance to the next step.
3) In the storage setup step, enter the correct path to the existing g2data directory, advance to the next step.
4) In the database setup step, enter the database connection information for your existing g2 database. Hit save, hit "Reuse database tables".
5) In the admin user setup step, hit save.
6) In the create config file step, it should say that it successfully created a config file.
7) At this point, you can stop the installation process, your multisite should be running.
8) Delete the config.php and the .htaccess file (if it exists) in your codebase directory (don't delete these files in your new multisite directory).

1) copy config.php to another folder, just such that you don't forget / lose your database connection information. If you use the URL rewrite module, make sure to not lose the .htaccess file and copy it into your multisite home. Or if you feel unsure, deactivate the url rewrite module before you start this change. You can activate again afterwards.
2) Move the gallery2 directory to its new place. If you had the g2data directory within the gallery2 directory, a) don't move it with the gallery2 directory and b) consider having it above the webroot for your future installation (only then the image firewall of G2 works (security)).
Make sure the directory where your installation used to be is now empty.
3) Browse to the address of the new home of your gallery2 directory and start the installer gallery2/install/index.php).
4) In the installation type step, choose multisite and enter the filesystem path to the directory where G2 used to be. Create a new (empty) gallery2 directory if needed. chmod 777 etc. as if it was a normal multisite installation.
Advance to the next step
5) In the storage directory step, enter the path to your existing g2data directory. I assume it's already where it should be (as instructed in the prepation for these steps). Advance to the next step.
6) In the database setup step, enter the same old database connection information. If you forgot it, take a look at your backup copy of config.php. Click save.
It should show 3 options: erase, save and "reuse existing database tables". Choose the "Reuse" option!
7) in the Admin user step, click save
8) In the config file step, it should say, that it created the config file successfully.
9) You can stop the installation process at this point. Your multisite should work at this point

Shadow_Wolf, if this stuff works, I'd be very glad if you could add the instructions to the codex page. If you could clean them up a little, that would be great!

 
dennys
dennys's picture

Joined: 2003-08-24
Posts: 32
Posted: Sat, 2005-09-17 07:34

This is my procedure to migrate standalone G2 to multi-site G2:

Environment:
Virtual host directory: D:\Server\WWW\dennys_web
Gallery directory: D:\Server\WWW\dennys_web\gallery
Gallery data directory: D:\Server\data\g2data\dennys
MySQL database directory: D:\Server\data\MySQL\dennys
And I want to keep all current directory and put code base in D:\Server\WWW\localhost\gallery_codebase

1. Stop Apache2, MySQL
2. Rename these directories:
D:\Server\WWW\dennys_web\gallery -> D:\Server\WWW\dennys_web\gallery_tmp
D:\Server\data\g2data\dennys -> D:\Server\data\g2data\dennys_tmp
D:\Server\data\MySQL\dennys -> D:\Server\data\MySQL\dennys_tmp
3. Create these directories:
D:\Server\WWW\dennys_web\gallery
D:\Server\data\g2data\dennys
D:\Server\data\MySQL\dennys (You can build a new database too, it's the same.)
4. Extract Gallery 2 to D:\Server\WWW\localhost\gallery_codebase
5. Start Apache2, MySQL
6. Connect to http://localhost/gallery_code/ to install a new multi-site G2
Gallery directory: D:\Server\WWW\dennys_web\gallery
Gallery data directory: D:\Server\data\g2data\dennys
Database name: dennys (It is D:\Server\data\MySQL\dennys)
ps: I suggest to not install any module because you should already configure it in the standalone G2. And we'll restore it later.
7. After the new G2 is ready, stop Apache, MySQL
8. Rename these directories:
D:\Server\WWW\dennys_web\gallery -> D:\Server\WWW\dennys_web\gallery_new
D:\Server\data\g2data\dennys -> D:\Server\data\g2data\dennys_new
D:\Server\data\MySQL\dennys -> D:\Server\data\MySQL\dennys_new
9. Rename these directories:
D:\Server\WWW\dennys_web\gallery_tmp -> D:\Server\WWW\dennys_web\gallery
D:\Server\data\g2data\dennys_tmp -> D:\Server\data\g2data\dennys
D:\Server\data\MySQL\dennys_tmp -> D:\Server\data\MySQL\dennys
10. Start Apache2, MySQL and your G2 should become multi-site now.

You can use http://localhost/gallery_code/ to install another new multi-site G2 and you can delete all *_tmp directories.

 
LKRaider
LKRaider's picture

Joined: 2005-12-28
Posts: 1
Posted: Fri, 2005-12-30 12:43

I can confirm that valiant's instructions work.

I followed his directions on my gallery installation and managed to transform it into a multisite gallery without problems. Thanks for the instructions! : )

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-12-30 15:16

thanks for letting us know :)

 
joannekhow
joannekhow's picture

Joined: 2006-06-13
Posts: 2
Posted: Tue, 2006-06-13 17:12

can i confirm that the meaning of multisites is having a domain and a lot of users?

i am actually trying to find an answer to my problem.
I have installed gallery into myblog and i am using lifetype (pLog) as my program. it is running fine for now but i just found out that in order for the rest of my users to use the gallery as well, they have to enable the gallrey in their admin and do the settings of absolute path, embed path and relative path on their own. is there a way where the settings can be "done" and this feature made available to them as soon as they sign up? my 2nd question is, what path should i use for them as i understand using the same paths as mine would result to sharing the gallery. i would like each of the users to have their own gallery. if this posting is the solution then i would gladly follow it.

i am also not literate in programing, so i dunno how i have managed to come so far. :) took me 3 weeks to install lifetype and then gallery and then the plugin. haha

i am using gallery 2.1.1 i
using php (if it means anything)

pls help. i am so desperate. i have also submitted a similar question in embededgallery section in forum. i am sorry if this is considered a double posting. i just saw this after hours of searching.

joanne