Migrating your website using rsync to a new server

Moving a website having large number of files from one server to another can be a can be a daunting task. If you are not using any version control like Git then you need to first download the whole application on your local computer and then upload to the designation server.
This is a time consuming process considering the number of files. So in this post I am going to tell you a much faster approach to tackle this problem using a utility called ‘rsync’.
Install Rsync
Run this command to check if it is already installed on your machine,
If you see something like then it is already installed on your machine

You need to install it if it the output is blank.

To install Rsync on your machine

Now to communicate between your old VPS and new VPS we need to have Rsync installed on your old VPS as well. So log into your old VPS and check if Rsync is installed on it, if not then follow above step to install it.
Rysnc needs to be able log into your new server from your old server to transfer files. Run below command to generate a key, if you do not have one generated already.

Lets transfer the key from your old server to new one through below command
Now you are ready to start transfer of files from your old VPS to new VPS, log into your old VPS and enter below command
in the above command
my-project = is the directory that you want to transfer
190.201.303.404 = destination VPS IP address
/var/www/html/my-project = path where you want to store the files on destination server.
You can use –progress option to see the progress.