Recently did a full server migration with ISPConfig installed. Luckily it was within the same distro but an updated version of CentOS-4.5, had to add centos-4.5 support to ispconfig conf file prior to the install. I also made sure that I was installing the same version of ISPConfig on the new server, and upgrading to the latest once the migration was complete and the server stable.
These are just notes I took down for later reference, just in case it happens again!!
Preparation:
In preparation for the migration, create A records to point to the new server IP, for all domains to do temporary redirection:
{newhost.domain.tld} : xx.xx.xx.xx
www1.{domain.tld} : xx.xx.xx.xx
Migration notes and Custom implementation:
-
Secured ssh and changed port first.
Converted root filesystem to lvm.
Had to add centos-4.5 support to conf file prior to ispconfig install.
Merge /etc/passwd, /etc/shadow, /etc/group
/etc/sysconfig/network set with fqdn, also added to hosts file.
Migrated Sendmail conf, access, local-host-names, virtusertable and mail data.
/etc/aliases moved over.
proftpd.conf and proftpd_ispconfig.conf
named.conf and pri.*
my.cnf moved over.
httpd.conf and Vhosts_ispconfig.conf moved over.
php.ini moved over.
eaccelerator moved over (make sure to recreate the cache folder).
mrtg installed and conf and init files moved over.
rsync /var/www/*
rsync /var/spool/mail/*
rsync /var/spool/squirrelmail/*
rsync /var/lib/squirrelmail/prefs/*
import databases or rsync /var/lib/mysql/*
disable ispconfig service monitoring prior to running the below script:
file pre_sync.sh :
#!/bin/bash
/sbin/service httpd stop
/sbin/service mysqld stop
/sbin/service sendmail stop
/sbin/service mrtg stop
/usr/bin/rsync -azR --progress -e '/usr/bin/ssh -i ~/.ssh/rsync_key -p 22' --delete {oldhost.domain.tld}:"/var/www /var/spool/mail /var/spool/cron /var/lib/mysql /var/spool/squirrelmail /var/lib/squirrelmail/prefs" /
/sbin/service mrtg start
/sbin/service sendmail start
/sbin/service mysqld start
/sbin/service httpd start
/roots/scripts moved over.
crontab items moved over.
ssh authorized_keys moved over for rsync backups.
php5 (libc-client-devel, pcre-devel-6.6-1) and mod_fastcgi installed for dev site.
Installed Squirrelmail and added /mail alias to squirrelmail.conf
added php type to php.conf, so it is available by default:
AddType application/x-httpd-php .php .php3 .php4 .php5
REMOVE if existing / DO NOT ADD... Conflicts with AddType.
<Files *.php>
SetOutputFilter PHP
SetInputFilter PHP
</Files>
"an unknown filter was not added: PHP"
Change the line in the file /home/admispconfig/ispconfig/lib/config.inc.php:
$go_info["server"]["apache2_php"] = 'both';
to:
$go_info["server"]["apache2_php"] = 'addtype';
Change a site setting in ispconfig and save it back for the new setting to be written.
Log in to ISPConfig and go to Management -> Server -> Settings and change the IP address(es) there.Then go to the DNS Manager and also changes the IP addresses in the DNS records, if necessary.
trac installed with admin and account plugins.
awstats installed and moved over /etc/awstats/awstats.{domain}.conf and /etc/httpd/conf.d/awstats.conf .
/root/ispconfig/scripts/shell/webalizer.php customized to accommodate local conf.
ispconfig phpmyadmin and tools link moved over.
Setup snapshot backups
Setup spamassassin training -- enabled shell for web1_{admin} to run /var/www/web1/scripts/SAtrain.sh
Moved custom procmail filters:
In /root/ispconfig/isp/conf/procmailrc.master
Add:
INCLUDERC={PMDIR}/.custom.rc
Check .procmailrc for:
INCLUDERC=/var/www/web1/user/web1_{admin}/.custom.rc
Current .custom.rc file for web1_{admin}:
# Returned mails
:0:
* ^Subject.*Returned mail: see transcript for details
mail/Return
:0:
* ^From.*MAILER-DAEMON@
mail/Return
# Delivery Warnings
:0:
* ^Subject.*(Warning: could not send message for past 4 hours|Delivery Status Notification)
mail/Delivery
# Spam
:0:
* ^Subject.*(\[SPAM\])
mail/Spam
/home/u4/{user}/html linked to /var/www/www.{domain.tld}/web for flashcards to work -- needs fixing by developer.
Proxy default site to {domain.tld} for IP xx.xx.xx.xx in /var/www/sharedip/.htaccess
RewriteEngine on
RewriteCond %{HTTP_HOST} ^xx\.xx\.xx\.xx$ [NC]
RewriteRule ^(.*)$ http://www.{domain.tld}/$1 [P,L]
Final move:
-
Updated A records:
mail.{domain.tld}: xx.xx.xx.xx
www.{domain.tld} : xx.xx.xx.xx
run the post_sync.sh to rsync file, database and mail. Import databases or rsync /var/lib/mysql/* leaving out mysql and ispconfig database:
file post_sync.sh :
#!/bin/bash
/sbin/service httpd stop
/sbin/service mysqld stop
/sbin/service sendmail stop
/sbin/service mrtg stop
/usr/bin/rsync -azR --progress -e '/usr/bin/ssh -i ~/.ssh/rsync_key -p 22' --exclude-from=/root/scripts/migrate/exclude.txt --delete {oldhost.domain.tld}:"/var/www /var/spool/mail /var/spool/cron /var/lib/mysql /var/spool/squirrelmail /var/lib/squirrelmail/prefs" /
/sbin/service mrtg start
/sbin/service sendmail start
/sbin/service mysqld start
/sbin/service httpd start
file exclude.txt :
/var/lib/mysql/ispconfigdb
/var/lib/mysql/mysql*
mailertable setup for relaying mail to {oldhost.domain.tld} on {newhost.domain.tld}
Setup IP rewrite rules for forwarding to www1 on old server.
Pointed remote backups to rsync from new host.