Migration of ISPConfig 3 to new server

Since I had to upgrade my servers many times as my host was offering better deals (more CPU/RAM/HDD) for less money I decided to write this tutorial. So lets find out what you have to do to migrate from old server to new server without issues, as I had plenty of issues when I did it for the first/second time!

  1. Install new server with tutorial provided by howtoforge.com, there are plenty of “Perfect Server” tutorials there. Since I’m using Debian, this one was mine.

    NOTICE: If you have multiserver setup do not join this new server to existing multiserver setup. Just install ispconfig as a standalone setup.
    When finished reboot and backup your system:

    cd /
    tar -pczf new_backup.tar.gz /var/vmail /var/log /var/www /etc
    mysqldump -u root -pXXXXXXXX –all-databases –events > /var/www/html/new_db.sql

    Now open sources list, and copy contents of it somewhere:

    nano /etc/apt/sources.list

    We need this for old server in next step.

  2. On old server, open sources.list delete everything inside of it and paste into it all you have from new server:

    nano /etc/apt/sources.list


    Now perform update and keep all configuration when upgrading:

    apt-get update

    apt-get upgrade
    apt-get dist-upgrade

    NOTICE: You need to perform dist-upgrade only if your old server is for example running Debian v6 or v7 and your new is v8. If you don’t do this bad things will happen. Make backup:
    cd /

    tar -pczf old_backup.tar.gz /var/vmail /var/log /var/www /usr/local/ispconfig/interface/lib /usr/local/ispconfig/server/lib
    tar -pczf etc-old_backup.tar.gz /etc
    mysqldump -u root -pXXXXXXXX –all-databases –events > /var/www/html/old_db.sql

    Move backups so you can download it to new server or somewhere else:

    mv old_backup.tar.gz /var/www/html/old_backup.tar.gz

    NOTICE: For Debian v7 and older versions apache web path is /var/www/, starting with v8 path is /var/www/html/

    Open /etc/passwords and /etc/shadow  and copy only webXXX lines from it somewhere to your PC.

    nano /etc/passwords
    nano /etc/shadow

    Open /etc/group and /etc/gshadow  and copy only clientXXX lines from it somewhere to your PC.

    nano /etc/groups
    nano /etc/gshadow

    We need to paste those lines to same files on new server!

    Open /etc/fstab and copy only lines that contain /var/log/ispconfig/…:

    nano /etc/fstab

  3. Go back to new server and download backups from your old server:

    cd /
    wget http://IP.OF.YOUR.OLD.SERVER/old_backup.tar.gz
    wget http://IP.OF.YOUR.OLD.SERVER/old_db.tar.gz

    Extract backup:

    tar xvfz old_backup.tar.gz

    Import database:

    mysql -u root -pXXXXXX < /old_db.sql

    Remove files:
    rm old_backup.tar.gz
    rm old_db.sql

    Paste webXXX lines:

    nano /etc/passwords
    nano /etc/shadow

    Paste clientXXX lines:

    nano /etc/groups
    nano /etc/gshadow

    Paste /var/log/ispconfig/… lines:

    nano /etc/fstab

    Update ISPConfig:

    cd /tmp
    wget http://www.ispconfig.org/downloads/ISPConfig-3-stable.tar.gz
    tar xvfz ISPConfig-3-stable.tar.gz
    cd ispconfig3_install/install
    php -q update.php

     

    Reboot now.

  4. On DNS server change your old server IP address with IP of your new server.
  5. Wait 30 mins to 1 hour… prosper. This depends on your DNS TTL. Mine are 3600 seconds (one hour) so maybe it would be smart to set it even to something like 1 to 100 if possible before migration for faster propagation through Internet.

Have fun and report any issues you encounter!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.