Server-Migration

This guide is to help those migrating to a new server.

It is designed to help you migrate your DTC with minimal or NO downtime to your webserver and applications. It expects that you're already fairly proficient and comfortable with the command line and your OS in general. Definitely not for beginners, hire a professional.

1. First install dtc as directed. Your control panel will not be visible in your old domain yet because you haven't pointed your dns yet, however you still need to test to see it DTC installed and is working correctly. So you do one of two things: alter your hosts file with a line that reads "<new-server-ip> <your dtc panel domain name>" or use the direct IP method of https://<new-server-ip>/dtcadmin(approve sites) . Once you confirm that you have no errors in your configuration generation page and all is working properly, you can proceed. \\
2. Put all your webapps into maintenance mode (i.e., Moodle, Joomla) so that no changes can be made(which won't reflect after you point your DNS to the new server).

3. Migrate your files:
On your old server:
tar -czvf ~/files.tgz /var/www/sites
scp ~/files.tgz root@<newserver ip>:/root
On your new server:
tar -xzvf ~/files.tgz /var/www
chown -R dtc:dtcgrp /var/www/sites (the install script should do this, but just in case) \\
4. Migrate your cron jobs:
On your old server:
crontab -l (highlight and cut)
On your new server:
crontab -e (paste and save)

5. Backup your Databases:
On your old system: (if someone knows an easier way of doing this please share)
mkdir ~/databases
For each database your will do a:
mysqldump -p <database name> > ~/databases/<database name>
Do not forget the MYSQL and INFORMATION_SCHEMA databases.

6. Transfer your databases:
On the new server:
mkdir ~/databases
On the old server
scp ~/databases/* root@<new server ip>:/root/databases

7. Load up your databases:
On the new server:
For each database you will perform the following:
mysql -p
create <database name>;
exit
mysql -p <database name> < ~/databases/<database name>
* Remember that once you do this the mysql will revert to the password on the old server

8. Sync the passwords on the database:
On the new server:
Locate the password in /etc/mysql/debian.cnf
mysql -p
UPDATE mysql.user SET Password=PASSWORD('<new password>') WHERE User='debian-sys-maint';
FLUSH PRIVILEGES;
exit
run the installation script again

9. Point your DNS to the new server
10. As your new servers DNS begins to replicate start taking your webapps out of maintenance mode. If you can't wait around for that to happen, put them in the /etc/hosts file to point them to the new server so that you can take them out of maintenance mode.
Your done!!!

Courtesy of Francisco Barcenas(fbc<at>webaso.net)

Page last modified on September 17, 2009, at 05:37 PM EST