Before we install any packages we should ensure that the correct use-flags will be used so that all required functionality is made available and unnecessary functionality is not included. At the time of writing the rsnapshot package has no use-flags and its only dependency, rsync, is already present on a default Gentoo installation. The use-flags used when merging rsync are shown below for your convenience. As usual feel free to add and remove use-flags at will although the minimum set which are required for using this guide in its entirety are shown below.
Once you are confident that the correct use-flags are set for the app-backup/rsnapshot package, and any dependencies it may require, you can proceed with the installation by issuing the emerge command shown below.
The default configuration provided with the rsnapshot application is only really suitable for backing up a single machine which is always available. This is caused by several design decisions most notably the decision to place all snapshots under the same directory with subdirectories for each rotation with those containing subdirectories for each machine. This makes it impossible to store the backups of each machine on a different volume and causes problems when a single machine is unavailable but all the others were as a roll-back of the entire backup is the only option.
In our opinion a preferable mode of operation would be to store all the backups by machine name then by rotation. This way backups can be allocated their own volumes and should a single machine be unavailable all other backups will proceed as normal. Thankfully the rsnapshot application is surprisingly flexible and can be easily configured to operate in the way we desire as shown in this guide.
Before we can begin creating our configuration we shall need to create a directory to group the rsnapshot related files. We shall also need to copy the default configuration so that we have a template which we can customise to suit our needs rather than having to create a complete configuration from scratch.
We can now modify the base configuration file as shown in the example below. As you can see we have changed very few of the default settings. The no_create_root entry configures rsnapshot to create the root snapshot directory if it does not exist whilst most other entries simply enable the Linux versions of certain commands rather than the internal Perl routines which would otherwise be used. The remaining modifications disable any backup intervals and remove any backup points as both of these will be specified in their own files later.
config_version 1.2
snapshot_root /.snapshots/
#no_create_root 1
no_create_root 0
#cmd_cp /bin/cp
cmd_cp /bin/cp
#cmd_ssh /usr/bin/ssh
cmd_ssh /usr/bin/ssh
#cmd_du /usr/bin/du
cmd_du /usr/bin/du
#cmd_rsnapshot_diff /usr/local/bin/rsnapshot-diff
cmd_rsnapshot_diff /usr/bin/rsnapshot-diff
interval hourly 6
interval daily 7
interval weekly 4
#interval monthly 3
# LOCALHOST
backup /home/ localhost/
backup /etc/ localhost/
backup /usr/local/ localhost/
If you wish to use rsnapshot to make backups of remote machines then you will also need to ensure that the required client software is installed. Luckily the rsnapshot application does not require any software which is not already present on a default Gentoo Linux installation.
As mentioned above however the rsnapshot application makes extensive use of the rsync application. Besides this the only other direct requirement of rsnapshot making remote backups is sshd. On a standard Gentoo Linux installation both of these packages should usually be installed and correctly configured as part of the default distribution. For your convenience the use-flags they were merged with for this guide are shown below.