There are a variety of ways to transfer content from one server to another. One of the most popular and versatile methods to use is rsync, a utility for Unix-like operating systems that maintains multiple copies of the same file on different computer systems. The rsync command allows a user to execute commands locally on one server, and connect to another to transfer files, download files, or even mirror files using a few basic flags.
Rsync is similar to rcp except that rsync uses an update protocol that significantly increases the transfer speed when the file already exists on the destination computer.
A distribution package for rsync is included in CentOS6, so installing rsync on this operating systems is a simple command.
Installing rsync on CentOS6
In order to install rsync, you’ll need an active Linux server, as well as an SSH client such as PuTTY (for Windows) or Terminal (Mac). We recommend a GoDaddy Virtual Private Server if you’re just getting started, or a full dedicated server if you’re ready to take total control.
[requirements difficulty="1" time="5"]
Open a terminal window with an account that has root privileges, and log into root on the server. Enter the following command from the command line:Install rsync
#yum -y install rsync
The above yum command uses the -y option to automatically answer 'yes' to all questions during the installation process.
- Once rsync has been installed, you should receive the following message:
The following command uses rsync and ssh to transfer a file between the host computer and a destination computer:
#rsync -v -e ssh test.txt localhost:~
This command will prompt you to enter the password for your user account on the destination computer. The output from this command should be similar to the following screenshot:
Once you’ve complete installing rsync, you can use it to connect to and transfer files on any server which you would normally access via shell. Check out this article on how to move content from one server to another using your newly installed tool.