I'm looking for a script that can help me to clone or migrate my server, I found this script, think it would work?
Quote
Code
- # explanar.de semi-automatical imscp migration and movement script
- # reference: https://gist.github.com/b13n1u/11094749
- #################### Has to be divided into 2 different .sh-files for old and new server !!! ###########################
- ##################### THIS IS SCRIPT 1 FOR THE OLD SERVER #########################
- clear
- echo "explanar.de semi-automatical imscp migration and movement script"
- echo "---------------------------[ PART 1 ]---------------------------"
- echo "reference: https://gist.github.com/b13n1u/11094749"
- read -p "ready ? [ENTER]" nothing
- clear
- read -p "Please enter MySQL Root-Password: " mysqlroot
- username=$(who -m | awk '{print $1;}')
- sudo mkdir -p /var/www/BACKUP/
- sudo chown -R "$username":"$username" /var/www/BACKUP
- sudo tar cvpzf /var/www/BACKUP/var-www-imscp-backups.tar.gz /var/www/imscp/backups/*
- sudo tar cvpzf /var/www/BACKUP/var-www-virtual.tar.gz /var/www/virtual/*
- sudo tar cvpzf /var/www/BACKUP/var-mail-virtual.tar.gz /var/mail/virtual/*
- sudo tar --exclude='*.pid' cvpzf /var/www/BACKUP/var-lib-mysql.tar.gz /var/lib/mysql/*
- # for security and redundancy: additional mysqldump backup
- sudo mysqldump -p --all-databases -u root --password=$mysqlroot > /var/www/BACKUP/mysqldump2.sql
- echo "Please download all .tar.gz-Backup-Archives from /var/www/BACKUP !"
- echo "You can use e.g. filezilla to connect via ssh."
- read -p "ready ? [ENTER]" nothing
- exit 0
- ##################### THIS IS SCRIPT 2 FOR THE NEW SERVER (Ubuntu 14.04 Minimal) #########################
- clear
- echo "explanar.de semi-automatical imscp migration and movement script"
- echo "---------------------------[ PART 2 ]---------------------------"
- echo "reference: https://gist.github.com/b13n1u/11094749"
- read -p "ready ? [ENTER]" nothing
- username=$(who -m | awk '{print $1;}')
- sudo mkdir -p /var/www/BACKUP
- sudo chown -R "$username":"$username" /var/www/BACKUP
- clear
- echo "Please upload all .tar.gz-Backup-Archives to /var/www/BACKUP !"
- echo "You can use e.g. filezilla to connect via ssh."
- read -p "ready ? [ENTER]" nothing
- clear
- read -p "Please enter Hostname:" newhostname
- sudo su -c 'echo '$newhostname' > /etc/hostname'
- sudo hostname -F /etc/hostname
- clear
- read -p "Please the enter MySQL Root-Password you will use: " mysqlroot
- # Installation neues System
- sudo apt-get update && sudo apt-get upgrade
- sudo apt-get -y install whiptail tasksel
- sudo tasksel install standard
- cd /usr/local/src
- sudo rm -fR imscp*
- sudo wget https://github.com/i-MSCP/imscp/archive/1.2.0.tar.gz
- sudo tar xzf 1.2.0.tar.gz
- cd imscp-1.2.0
- echo "If this is a local install, please change the file"
- echo ""
- echo "/usr/local/src/imscp-1.2.0/engine/setup/imscp-setup-methods.pl"
- echo ""
- echo "from"
- echo "(domain_private_tld => qr /^(?:bogus|test)$/)"
- echo ""
- echo "to"
- echo "(domain_private_tld => qr /^(?:bogus|test|lan)$/)"
- echo ""
- echo "else just hit enter"
- echo ""
- read -p "ready ? [ENTER]" nothing
- sudo perl imscp-autoinstall -d
- sudo mkdir -p /var/www/BACKUP-NEW/
- sudo chown -R "$username":"$username" /var/www/BACKUP-NEW
- sudo tar cvpzf /var/www/BACKUP-NEW/var-lib-mysql.tar.gz /var/lib/mysql/*
- sudo tar cvpzf /var/www/BACKUP-NEW/var-www-virtual.tar.gz /var/www/virtual/*
- sudo tar cvpzf /var/www/BACKUP-NEW/var-mail-virtual.tar.gz /var/mail/virtual/*
- sudo rm -rf /var/www/virtual/* /var/mail/virtual/*
- find /var/lib/mysql -type f ! -name '*.pid' -execdir rm -rf {} +
- clear
- echo "If all uploads of .tar.gz-Backup-Archives to /var/www/BACKUP"
- read -p "are ready, please [ENTER]" nothing
- sudo tar xpvzf /var/www/BACKUP/var-www-imscp-backups.tar.gz -C /var/www/imscp/backups/
- sudo tar xpvzf /var/www/BACKUP/var-www-virtual.tar.gz -C /var/www/virtual/
- sudo tar xpvzf /var/www/BACKUP/var-mail-virtual.tar.gz -C /var/mail/virtual/
- sudo tar xpvzf /var/www/BACKUP/var-lib-mysql.tar.gz -C /var/lib/mysql/
- # delete all newly installed vu****-user
- sudo sed '/vu/d' /etc/shadow
- sudo sed '/vu/d' /etc/group
- sudo sed '/vu/d' /etc/passwd
- # MySQL Befehle
- mysql -u root -p $mysqlroot -h localhost <update.sql
- perl /var/www/imscp/engine/setup/imscp-setup -d
- echo "Is the IP-Address of this server the same as the one of the old server?"
- select yn in "Yes" "No"
- case $yn in
- Yes ) exit;;
- No ) perl /var/www/imscp/engine/setup/imscp-setup --reconfigure ips;;
- esac