This is an old revision of the document!
See also virtualmin_dns
Documentation: https://www.virtualmin.com/documentation/system/migrate
Be sure your new Virtualmin host server is properly configured before migrating any virtual servers to it.
127.0.0.1
Webmin → Networking → Network Configuration → Hostname and DNS Client
http://blog.rimuhosting.com/2011/04/15/migrating-vps-with-virtualmin-multiple-dns-changes/
Lower the TTL of the virtual server DNS well in advance of your migration:
virtualmin modify-dns --all-domains | --domain <domain> --ttl <seconds>
Verify you have the ability to change the name servers at the domain name registrar. If you do not have this access, you will have to coordinate with someone who does.
When you migrate the domain to a new Virtualmin server, you will probably migrate to new DNS servers as well.
You may want to edit the existing virtual server before migrating it to shorten the migration time, avoid migrating junk and minimize potential transfer issues.
Virtualmin → <domain> → Server Configuration → Transfer Virtual Server
Sometimes you have to fix things before the migration will complete. If problems occur, they are usually during the backup stage.
Sometimes you will have problems with sub/alias domains. It can be helpful to make them top level virtual servers, then transfer them separately.
For an alias: Virtualmin → <domain> → Server Configuration → Convert to Sub-Server
Then: Virtualmin → <domain> → Server Configuration → Move Virtual Server → Convert to Parent
Sometimes, you have to 'disassociate' a feature in the Virtualmin configuration, perhaps when the feature was already deleted, but Virtualmin thinks it still exists:
virtualmin disable-feature --domain name | --user name | --all-domains [--disassociate]
Sometimes it helps to reboot the Virtualmin host server, perhaps both.
Make sure the web server restarts after migrating a domain. Sometimes, old bits get carried forward and will keep the web server from starting!
You may need to reboot the host server to check that Apache restarts properly!
This will strip some old PHP settings from the new Virtualmin host server that will keep Apache from starting:
sed -i '/php_admin_value/d' /etc/apache2/sites-available/* && sed -i '/php_value/d' /etc/apache2/sites-available/* systemctl restart apache2.service systemctl status apache2.service
On the new Virtualmin server, check that the default web site has not changed:
Virtualmin → <primary/default domain> → Server Configuration → Website Options → Default website for IP Address
Verify and correct:
To correct or verify the DNS slave server configuration:
Primary DNS server:
virtualmin modify-dns --all-domains --add-all-slaves
Slave DNS server:
rndc retransfer migrated-domain.tld tail -200 /var/log/syslog
Lastly, after you are quite sure the DNS is all correct for the migrated domain, reset the DNS TTL:
virtualmin modify-dns --domain migrated-domain.tld --ttl 14400
or
virtualmin modify-dns --all-domains --ttl 14400
Check that the migrated domain is on the correct hosting plan and that all appropriate features are enabled.
In virtualhost mode, Apache does not specifically support a 'default' site. It will serve the first match alphabetically of the sites in /etc/apache2/sites-enabled
. Virtualmin Pro uses this to configure the default site.
The Virtualmin installer disables the 000-default
site, but you can do so manually:
a2dissite 000-default.conf
In Virtualmin Pro, you can force a site to be the default site:
Virtualmin → <domain> → Server Configuration → Website Options → Default website for IP address?
Some important info below may be out of date
mkdir /root/backups virtualmin backup-domain --dest /root/backups/ --all-domains --all-features --newformat --all-virtualmin
Use rsync
to copy the data to the new server:
rsync -avr ~/backups root@<newserver>:~
This will:
virtualmin restore-domain --source /root/backups/virtualmin.tar.gz --all-virtualmin virtualmin restore-domain --source /root/backups/ --all-domains --all-features