Topic: :TUTORIAL: cPanel account migration to Webmin/Virtualmin VPS

This is a short tutorial on how to setup a fully functional website on a VPS running Debian OS with Virtualmin/Webmin host management system from your full cPanel backup. Webmin is a web-based interface for system administration for Unix, which allows easily setting up services, like Apache, DNS, FTP, hosting accounts and much more. Although not so lightweight, it is a solid free alternative to cPanel. It is mostly advantageous to transfer to a VPS because you receive dedicated resources for your website and would no longer have common shared hosting issues, like getting the website suspended for high CPU usage or mass mailing. Onwards!

1. Preparation

The first thing you will want to make sure of is the size of your shared account. It can be found in the left hand side of your cPanel.

Webmin provides several means of restoring your cPanel backup, including FTP transfer or a local upload. In this tutorial, I will cover a restoration where a backup is uploaded to the VPS directly. Please note, that during the restoration, the archive is being extracted and then restored, therefore you will need atleast TWICE as much free disk space on your VPS as your cPanel backup in order to complete the transfer. You should also note that the operating system with Webmin already takes up ~1.4 GB on the VPS. 

The other thing you will need to do is obtain your VPS root password. In case you haven't received in the hosting24 email, you may reset it via member's area. This is done under List Servers -> Password . After confirming the action, make sure to write the root password down or save it somewhere safe - it is only displayed on the screen once, after you refresh the page it will not be shown anywhere on your account.

The VPS hostname should be in a form of name.domain.com. Think of it as your VPS name, it would be used in the DNS to distinguish your VPS for service like email, FTP etc. Please DO NOT set it as your main domain name as the VPS hostname would NOT be used to served webserver requests unless you specifically configure it to do so.

Lastly, you will need to point your domain to the VPS. This can be done before the transfer process usually since the DNS propagation takes quite some time. If your domain is registered via hosting24, contact our staff to register private nameservers for your domain and point it to your VPS. If you have an externally registered domain, visit your registrar administration panel and register private nameservers and point them to your VPS dedicated IP address (it can be the same IP address if you have a VPSx1 -  I won't go into detail why pointing it to the same IP address causes no real issues):

ns1.domain.com - X.X.X.X
ns2.domain.com - X.X.X.X

When pointing your private nameservers to the VPS, a DNS service must be running on it. Webmin utilizes BIND DNS server, so make sure to start it after you finish your migration. All services can be start via Webmin interface, Servers tab.

Alternatively, an A record can be used for your domain pointing to the VPS IP address.

Next, rebuild your VPS with a Debian 32 bit Webmin/Virtualmin OS template. This can be done via member's area -> List Servers section as well.

2. Generating your backup

If the shared hosting account you wish to transfer is suspended, you will need to contact our staff and request for a link to your full backup. Once again, be wary of the account size and note that we would trim your account of any abusive content before providing the backup.

If your account is active, you would need to generate the full backup via your cPanel -> Backup -> Full Backup section.

You may generate it to your Home directory and later on download it via File Manager or an FTP connection. Alternatively, a speedier approach would be to generate the backup directly to your VPS, using the Secure Copy (SCP) transfer method. These are the details you should enter:

Remote Server (FTP/SCP only):    Your_VPS_dedicated_IP_address
Remote User (FTP/SCP only): root   
Remote Password (FTP/SCP only):    Your root password   
Port (FTP/SCP only):    22
Remote Dir (FTP/SCP only): Anywhere on your VPS, let's say /root

If you chose to download the backup to your local computer, do not worry about uploading it to the VPS yet, it will be used during the migration process, although it is slightly slower that way.

3. Initial Webmin setup

After the backup is generated, you may proceed to setup your Webmin interface. To access your web interface, enter https://your_vps_ip_address:10000 . If for some reason this page does not load, there is a chance that your Webmin service has crashed. To amend this, access your VPS via terminal (SSH). We recommend using a dedicated offline SSH client to connect to your server. The most popular SSH client for windows is PuTTy. You may download PuTTy via this link. If you are using MacOS or Linux, you do not need to download any additional software. You may connect to your Server via the Terminal with this command:

ssh -p 22 root@VPS_IP_address

and enter the following command:

service webmin restart

Once you are in your web interface, proceed with the Post-Installation Wizard:

1. Memory use. The first few steps are pretty self-explanatory. I would recommend leaving these settings off in order to reduce RAM usage.

2. Virus scanning. This tutorial DOES NOT include setting up your mail server. Running clamAV scanner could prove worthwhile, but please note that it may consume up to 100 MB of memory.

3. Spam filtering. Once again, this interests you only if you set up a functioning mail server.

4. Database servers. cPanel uses MySQL. I recommend sticking to it.

5. MySQL password. This is the root MySQL password. The password is already set and can be later retrieved via SSH, so changing the password here is not mandatory.

6. MySQL database size. MySQL can be configured to trade off memory use for performance. Set the value here on how much memory you'd like to sacrifice to MySQL if need be.

7. Nameservers. Set your nameservers in this form:

Primary nameserver:      ns1.domain.com.
Secondary nameservers: ns2.domain.com.

Don't forget the dot at the end and make sure to tick the 'Skip check for resolvability' checkbox before proceeding.

8. Password storage mode. The hashed password mode offers additional security, but you would no longer have the option to retrieve your account password, only reset it. I would still recommend going with the hashed password mode.

The wizard is now complete! The next step for you is to add your IP address to the interface. This is done via Addresses and Networking -> Shared IP address section.

Enter your VPS IP address(es) into the Shared addresses for any servers box and click 'Save'.


4. Migrating the cPanel backup

We're almost done. Navigate to your Virtualmin section Add Server -> Migrate Virtual server.

Source backup file You should either choose Upload to server if you downloaded your cPanel backup to the local computer or Local file or directory if you have generated the cPanel backup via SCP to your VPS. In the latter case, provide the full path of your backup file, e.g. /root/cpmove-usernametar.gz

Backup file type - cPanel backup

Domain name to migrate - your domain name

Username for domain - your cPanel username or any other username to your liking

Password for administrator - the password which will be used to manage your virtualmin Virtual server (equivalent to cPanel hosting account)

New server's IP address - Shared, on non-default IP - select the IP address which you are going to use for this domain

Leave the other settings unchanged and proceed with the migration process.

If it completed without errors - you are all set!

OPTIONAL

In some cases the default virtualmin configuration does not enable serving your website via the dedicated IP address and you would be seeing the default apache 'It Works!' when visiting your IP in the browser. To amend this via web interface, switch over to the Webmin page on the top. Then navigate to Servers -> Apache Webserver. Select Global Configuration -> Edit Config Files. From the dropdown menu choose /etc/apache2/sites-available/default and click Edit Directives in file:. You will want to replace 2 lines in this file:

DocumentRoot /var/www

replace with

/home/your_username/public_html

and

<Directory /var/www/>

replace with

<Directory /home/your_username/public_html/>

click Save and restart the webserver by clicking Apply Changes in the top right corner of the web interface.

The faster method for doing this is via SSH command line:

nano /etc/apache2/sites-available/default

service apache2 restart

Sidenote: in the case where your account was suspended and you migrated your backup, make sure to rename your .htaccess file as it would be replaced with .htaccess.suspend.XXXXXXXX file.

Congratulations. You should now have a fully functional website migrated to a Virtual Private Server with a Webmin/Virtualmin interface !

Additional resources for further server management:

webmin.com/docs.html
tutorials.securesignup.net/vps-hosting/ … ebmin.html
doxfer.webmin.com/Webmin/FileManager
rimuhosting.com/support/settingupemail.jsp