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. Update the new server 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. Use the following command to check and compare server handlers on both servers:
    /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’ match across all PHP versions on the new and old servers.
  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. After confirming that the disk size on the new server is sufficient to accommodate data from the old server, 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. Add id_rsa.pub to the authorized_keys file on both servers, which you can generate using the ssh-keygen command.
  10. After establishing connectivity, test the SSH connection to verify successful access to the old server.
  11. Once the setup is complete, proceed with the migration using the skip home dir method, as the VPS-to-VPS data transfer involves large data.
  12. Follow the steps below to migrate the data, including 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. After creating the skeleton backup, review the files shown in the screenshot below:
      Migration
    5. After completing the backup, log in to the new server and copy the generated backup using the command below:
      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. After restoring the skeleton backup, check and confirm that all users have been successfully migrated to the new server using the command below:
    cat /etc/trueuserdomains
  15. Once verified, transfer all data from the old server to the new server using the command below:
    for i in `cat /home/Migration.txt`; do rsync -rpvlogDtH  -e "ssh -p 19174"
    [email protected]:/home/$i /home/ ; done
  16. After restoring the data, add the following entry to 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