User Tools

Site Tools


internet:hosting:virtualmin_migrate

This is an old revision of the document!


Virtualmin - Migrate to New Server

Change Hostname

Be sure your new Virtualmin host server is properly configured before migrating any virtual servers to it.

  • Set the short host name
  • Make sure your DNS matches
  • Set the first DNS server as 127.0.0.1

Webmin → Networking → Network Configuration → Hostname and DNS Client

DNS Changes

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>

Domain Name Registrar

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.

If you are using WHMCS and the domain name is at ResellerClub, you can easily change the name servers in WHMCS.

Clean Up Existing Virtual Server

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.

  • Verify the virtual server is on the correct plan
    • Plans are migrated with the virtual server
  • Disable any features not actually in use
  • Delete any unused or redundant data
    • Perhaps their mail was once hosted but is no longer and old mail data remains

Transfer a Virtual Server

Virtualmin → <domain> → Server Configuration → Transfer Virtual Server

Troubleshooting

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.

Verify the Migration

Apache Web Server

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

Default Web Site

:!: 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

DNS

Verify and correct:

  • DNS SPF record
  • Name Server records
  • DNS Slave server

DNS Slave Server

To correct or verify the DNS slave server configuration:

  1. Delete the DNS domain, if it exists, on the slave server
  2. (Re-)Add the newly migrated domain to the slave DNS server
  3. Initiate a domain transfer to populate all DNS records to the slave server

Primary DNS server:

virtualmin modify-dns --all-domains --add-all-slaves

Slave DNS server:

rndc retransfer migrated-domain.tld
tail -200 /var/log/syslog

DNS TTL

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

Hosting Plan and Features

Check that the migrated domain is on the correct hosting plan and that all appropriate features are enabled.

Default Site

:!: 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?


FIXME Some important info below may be out of date

Change IP Address

Swap IP Address

Migrate All Virtual Servers

Backup

mkdir /root/backups
virtualmin backup-domain --dest /root/backups/ --all-domains --all-features --newformat --all-virtualmin

Copy

Use rsync to copy the data to the new server:

rsync -avr ~/backups root@<newserver>:~

Restore

This will:

  1. Restore your original Virtualmin settings
    • Do you want to do this step?
  2. Then restore all of your Virtual Servers
    • This will also recreate the hosting plan on the new Virtualmin server
virtualmin restore-domain --source /root/backups/virtualmin.tar.gz --all-virtualmin
virtualmin restore-domain --source /root/backups/ --all-domains --all-features
internet/hosting/virtualmin_migrate.1554053572.txt.gz · Last modified: 2019/03/31 11:32 by gcooper