exercise lab for mirroring ========================== boot linux and login as root. 1. install rsync client create a /home/rsync/server/ directory: mkdir -p /home/rsync/server/ cd !$ get the rsync distribution from ftp://ceenet.ceu.hu/pub/mirror/rsync-2.3.1.tar.gz : ftp -vdn ceenet.ceu.hu << eof > user ftp password > cd /pub/mirror/ > get rsync-2.3.1.tar.gz > quit > eof and unpack it in this directory: tar xfvz rsync-2.3.1.tar.gz cd rsync-2.3.1 configure and build it (default installation location is /usr/local/ , but for simplicity of this exercise we're changing it to /usr/) : ./configure --prefix=/usr make and install (this basically copies the program binary to /usr/bin/ ): make install you can check that it works now: /usr/bin/rsync --version and the rsync client is already installed. 2. configure the rsync server with your preferred editor, create a simple configuration file for the server: /etc/rsyncd.conf first define some general options in this file: log file = /var/log/rsyncd.log transfer logging = yes then define a collection that you want to make available for mirroring. In our exercise we will use /home/rsync/server/ as and example. Add these lines to /etc/rsyncd.conf : [example] comment = Rsync 2.3.1 build tree path = /home/rsync/server/ read only = yes list = yes uid = nobody gid = nobody save the newly created /etc/rsyncd.conf file, exit editor and try to run rsync in the daemon mode: rsync --daemon check if it started all right by looking at the log file: tail /var/log/rsyncd.log check that it is running by running rsync in client mode and connecting with it to the just started server at localhost: rsync rsync://localhost/ in response you should get the list of available packages (only the 'example' package in our exercise) run rsync with --help option: rsync --help and read what the following options mean: --recursive --links --safe-links --perms --times --delete --partial --compress --stats --progress now run rsync to create a mirror copy of /home/rsync/server/ in /home/rsync/client/ : rsync --times --perms --verbose --compress --recursive \ --stats --delete --partial --links --safe-links \ rsync://localhost/example/ /home/rsync/client/ check the log file /var/log/rsyncd.log for any messages: tail /var/log/rsyncd.log check the contents of newly created mirror directory: ls -R /home/rsync/client/ run the same rsync command for the second time to see that no files are transferred now: rsync --times --perms --verbose --compress --recursive \ --stats --delete --partial --links --safe-links \ rsync://localhost/example/ /home/rsync/client/ now delete /home/rsync/server/rsync-2.3.1.tar.gz : \rm /home/rsync/server/rsync-2.3.1.tar.gz check that the file is still in /home/rsync/client/ : ls -l /home/rsync/client/rsync-2.3.1.tar.gz edit /home/rsync/server/rsync-2.3.1/README file and make some changes to it (for example, remove the last line). run the same rsync command once more: rsync --times --perms --verbose --compress --recursive \ --stats --delete --partial --links --safe-links \ rsync://localhost/example/ /home/rsync/client/ and check that /home/rsync/client/rsync-2.3.1.tar.gz got deleted: ls -l /home/rsync/client/rsync-2.3.1.tar.gz and that /home/rsync/client/rsync-2.3.1/README has the same change you made to /home/rsync/server/rsync-2.3.1/README now, that you know how rsync works, you can use it to download some real-life files, like: rsync --progress --verbose --partial --stats \ rsync://ftp.gnupg.org/gnupg/gnupg-0.9.10.tar.gz \ /home/rsync or: rsync --progress --verbose --partial --stats \ rsync://www.apache.org/apache-dist/apache_1.3.9.tar.gz \ /home/rsync note that with the '--partial' option, you may break the transfer at any time (e.g. with ^C) and run it again, and it will only be transferring the remaining part of the file. END