User Tools

Site Tools


internet:hosting:virtualmin_migrate

This is an old revision of the document!


Virtualmin - Migrate to New Server

DNS Changes

http://blog.rimuhosting.com/2011/04/15/migrating-vps-with-virtualmin-multiple-dns-changes/

Lower the TTL 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]

Verify the Migration

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 → Server Configuration - Website Options → Default website…

Also check:

  • DNS SPF record
  • nameserver records
  • DNS Slave server
  • domain plan and features

If the DNS slave server is not correct, delete any duplicate domain configuration on the slave server, then re-add the newly migrated domain to the slave DNS server:

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

Lastly, reset the DNS TTL after verifying your DNS is all correct.

virtualmin modify-dns --domain yourdomain.tld --ttl 14400

or

virtualmin modify-dns --all-domains --ttl 14400

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

Change Hostname

Webmin → Networking → Network Configuration → Hostname and DNS Client

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.1554051175.txt.gz · Last modified: 2019/03/31 10:52 by gcooper