How to Migrate cPanel VPS to VPS Servers

June 20, 2024 / Virtual Server

This guide illustrates how to migrate cPanel VPS to VPS servers. Migrating from cPanel VPS to VPS servers offers enhanced scalability, performance, and customisation options for your website or application.

Let us begin:

  1. Before initiating the migration, check the compatibility of PHP, Apache, and MySQL versions on both servers. Once confirmed, share these versions with the client in the migration plan report and ask them to confirm with their developer if they are compatible with their websites and applications.
  2. Ensure that the new server is updated to the latest version before sharing the migration plan report.
  3. Before continuing with the migration, copy the EasyApache profile from the old server to the new server. Confirm that the new server is a clean server with no data. If data exists on the new server, do not copy the EasyApache profile.
  4. Server handlers can be checked and equated on both servers using the following command:
    /usr/local/cpanel/bin/rebuild_phpconf –current
  5. Ensure that the values for ‘max_execution_time’, ‘max_input_time’, ‘max_input_vars’, ‘memory_limit’, ‘post_max_size’, and ‘upload_max_filesize’ are identical for all PHP versions on the new server as they are set on the old server.
  6. Moreover, ensure that the System PHP-FPM settings for Max Requests, Max Children, and Process Idle Timeout values are the same on the new server as they are on the old server.
  7. Once this is done, check that the disk size on the new server is enough to accommodate the data from the old server once confirmed; you can then proceed with the migration.
  8. To proceed with the migration, establish connectivity between both servers. Confirm that you let the IP addresses of both servers in CSF (ConfigServer Security & Firewall) and allow SSH key verification.
    in /root/.ssh/ authorized_keys
  9. You can add id_rsa.pub in authorized_keys of opposite servers, which can be produced using the ssh-keygen command.
  10. Once the connectivity is established, try an SSH connection to the other server to confirm that the connection to the old server is successful.
  11. Once this has been done we can proceed with the migration through the skip home dir method as the data size we migrate from VPS to VPS has huge data to get it migrated.
  12. Below are the steps we can follow to get the data migrated along with the screenshots:
    1. Create a folder named Migration under home on the old server where we can create a skeleton backup. To do the same we can fire the below command:
      mkdir /home/Migration
    2. To create a list of users on the server we can fire the below command:
      cd /home/Migration
      cat /etc/trueuserowners | awk '{print $1}' | cut -d: -f 1 > Migration.txt
    3. Then to create a skeleton backup of all the users present on the server we can fire the below command:
      for i in `cat Migration.txt`;do /scripts/pkgacct --skiphomedir $i; mv
       /home/cpmove-$i.tar.gz /home/Migration/;done
    4. Once the skeleton backup has been created you can see the files below in the screenshot:
      Migration
    5. Once this has been done log in to the new server on which you want to migrate the data and copy the above-generated backup on a new server via the below command:
      rsync -vrplogDtH  -e "ssh -p 19174"
      [email protected]:/home/Migration/* /home/

      The above command will copy all the files under the/home directory.

  13. You can restore the skeleton backup on a new server via the below command:
    for i in `cat /home/Migration.txt`; do /scripts/restorepkg $i ; done
  14. Once the skeleton backup has been restored you can check and confirm that all users have been restored on the new server via the below command:
    cat /etc/trueuserdomains
  15. Once this has been checked and confirmed you can pull all the data from the old server to a new server via the below command:
    for i in `cat /home/Migration.txt`; do rsync -rpvlogDtH  -e "ssh -p 19174"
    [email protected]:/home/$i /home/ ; done
  16. Once the data has been restored you can add the below entry on your local machine:
    C:\\Windows\System32\drivers\etc hosts file
    Add below entry:
    For example-
    213.123.456.78 example.com www. example.com
  17. Once added try browsing the website and confirm if it is working fine.

In this manner, you can migrate cPanel VPS to VPS servers. However, if you encounter any issues, feel free to contact our support team, they are available for you 24X7.

Spread the love