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:
- 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.
- Ensure that the new server is updated to the latest version before sharing the migration plan report.
- 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.
- Server handlers can be checked and equated on both servers using the following command:
/usr/local/cpanel/bin/rebuild_phpconf –current
- 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.
- 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.
- 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.
- 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
- You can add id_rsa.pub in authorized_keys of opposite servers, which can be produced using the ssh-keygen command.
- Once the connectivity is established, try an SSH connection to the other server to confirm that the connection to the old server is successful.
- 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.
- Below are the steps we can follow to get the data migrated along with the screenshots:
- 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
- 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
- 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
- Once the skeleton backup has been created you can see the files below in the screenshot:
- 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.
- 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:
- 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
- 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
- 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
- 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 - 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.