Table of Contents

Migrate from one to another ispCP server

This HowTo is probably not complete, if you find something missing, please report this in the forum!

Besides, this HowTo was used for ispCP RC2, so there will be many changes till today and it will not work out of the box. But it shall give you an idea what has to considered for a migration.

We'll call the server from which the ispCP-installation shall be migrated server1 and the one, where the data shall be moved to server2. On server2, the operating system (of course..) and all packages ispCP needs are already installed.

Copy data with rsync

There are some files and directories which have to be copied without deleting existing content and some where existing content has to be deleted. So we create two files on server1:

/root/rsync_list_withoutdelete.txt

/etc/aliases
/etc/aliases.db
/etc/apache2
/etc/bind
/etc/courier
/etc/cron.d
/etc/cron.daily
/etc/cron.hourly
/etc/cron.monthly
/etc/crontab
/etc/crontab.dpkg-old
/etc/cron.weekly
/etc/default
/etc/group
/etc/group-
/etc/init.d
/etc/ispcp
/etc/logrotate.d
/etc/logwatch
/etc/mailman    # only if you use mailman
/etc/mysql
/etc/nagios2    # only if you use nagios
/etc/nagios-plugins # only if you use nagios
/etc/passwd
/etc/passwd-
/etc/php4
/etc/php5
/etc/postfix
/etc/postgrey
/etc/proftpd
/etc/rc0.d
/etc/rc1.d
/etc/rc2.d
/etc/rc3.d
/etc/rc4.d
/etc/rc5.d
/etc/rc6.d
/etc/rcS.d
/etc/rkhunter.conf
/etc/shadow
/etc/shadow-
/etc/sudoers
/etc/syslog-ng

# maybe you want to add some other directories here of programs you have installed

/root/rsync_list_withdelete.txt

/usr/local/bin
/usr/local/src

# only if you use mailman
/var/lib/mailman/archives
/var/lib/mailman/data

/var/lib/postgrey

/var/log/apache2

/var/mail

/var/spool/cron

/var/www

Now, we'll call rsync on server1 like this:

Without deletetion:

server1 # rsync -arv --numeric-ids --files-from=/root/rsync_list_withoutdelete.txt / root@server2:/ | tee "/root/rsync_withoutdelete_`date +%Y-%m-%d_%H-%M`.log"

With deletion:

server1 # rsync -arv --numeric-ids --delete --files-from=/root/rsync_list_withdelete.txt / root@server2:/ | tee "/root/rsync_withdelete_`date +%Y-%m-%d_%H-%M`.log"

By using the tee command you'll get a logfile of which is copied under /root.

Copy the MySQL-Databases

Create a dump on server1 and copy it to server2:

server1 # mysqldump -u root --all-databases --opt -Qc --add-drop-database -p -r /root/mysqldump.sql
server1 # scp /root/mysqldump.sql root@server2:/root

Import the mysqldump on server2:

server2 # mysql -u root -p < /root/mysqldump.sql
server2 # mysql -u root -p
  mysql> FLUSH PRIVILEGES;
  mysql> quit

Manual changes

After mirroring the data you have to do the following changes manually:

# /etc/init.d/ispcp_daemon stop
# mysql -p
mysql> USE ispcp;
mysql> UPDATE server_ips SET ip_number = "server2-ip", ip_domain = "yourserver2domkain", ip_alias = "yourserver2alias" WHERE ip_id = 1;
mysql> UPDATE `domain` SET `domain_status` = 'change' WHERE `domain_status` = 'ok';
mysql> UPDATE `subdomain` SET `subdomain_status` = 'change' WHERE `subdomain_status` = 'ok';
mysql> UPDATE `domain_aliasses` SET `alias_status` = 'change' WHERE `alias_status` = 'ok';
mysql> UPDATE mail_users SET status="toadd" where status="ok";
mysql> quit
# /var/www/ispcp/engine/ispcp-rqst-mngr
# /etc/init.d/ispcp_daemon start