Gentoo rsynd install tutorial
Publish date 29/11/2010
This is a tutorial to install rsyncd on Gentoo.
rsyncd version: 3.0.7
gentoo kernel: 2.6.30-gentoo-r4As Gentoo compiles everything it can takes some time. You might want to use screen, so you don't have to leave a console open.
To install on gentoo just emerge the necessary packages.
You might want to sync the emerge database first:Then emergeemerge --sync
emerge net-misc/rsync
As emerge compiles and installs everything, you only need to configure.
You should find the config-file in: /etc/rsyncd.conf.
You might need to create the /etc/rsyncd.secret file.
This holds the usernames and passwords.
Password-file
You can simply edit the password file with:The format is very simple:nano /etc/rsyncd.secret
You don't have to use users from the system, Actually it is even better if they are totally different users.backup_user:password
As it is a password file make sure it is only readable by root!
You can adapt the permissions it with the following command:ls -la /etc/rsyncd.secret -rw------- 1 root root 22 Nov 19 17:53 /etc/rsyncd.secret
chmod 600 /etc/rsyncd.secret
rsyncd-conf file
There are a lot of option you can set in the config-file.
Here is a short example:
# This line is required by the /etc/init.d/rsyncd script pid file = /var/run/rsyncd.pid uid = root gid = root use chroot = yes motd file = /usr/local/etc/rsync.motd log file = /var/log/rsyncd.log pid file = /var/log/rsyncd.pid lock file = /var/log/rsyncd.lock transfer logging = true # Simple example for enabling your own local rsync server #[gentoo-portage] # path = /usr/portage # comment = Gentoo Portage tree # exclude = /distfiles /packages [backup] path = /var/share/backup/ read only = no list = yes auth users = backup_user secrets file = /etc/rsyncd.secret comment = Rsync backup module hosts allow = 192.168.1.0/24There are 2 main section. The general section and 1 for each "share".
In the general section, you shouldn't change anything.
It config the user of the daemon and the loging, process-id-file, ...Gentoo sets standard a share for portage. If you don't use it, you can comment it out, like I did.
The important part of the example is the following part:
Most of the settings explain themselves.
[backup] path = /var/share/backup/ read only = no list = yes auth users = backup_user secrets file = /etc/rsyncd.secret comment = Rsync backup module hosts allow = 192.168.1.0/24
[backup]: is the name of the share. You can have several shares, but not with the same name.
path = /var/share/backup/: Is the directory on where all the files will be on the server.
read only = no: if the share/module needs to be read only. Because we want to backup to server, it is no in our case.
list: if it should be listed when clients ask for a list of available shares.
auth users = backup_user: Which users can access the share. User should be in "secrets file".
secrets file = /etc/rsyncd.secret: The location of the secrets file.
comment = Rsync backup module: A comment that explains what the share is about.
hosts allow = 192.168.1.0/24: which host(range) are allowed access.Now we need to start the server:
#(Start the daemon now) /etc/init.d/rsyncd start #(Add the daemon to your default run-level) rc-update add rsyncd default
Now we have setup the server side. On the client side we only need rsync installed.
Client side
Linux
On a linux-machine it is easy to start the backup.
Of course we need to install rsync first:
on gentoo:On Ubuntu, Debian, ...sudo emerge net-misc/rsync
sudo apt-get install rsync
The simple command to start the backup:
The first time it can last a while, because everything needs to be copied.rsync -a /home/username/ rsync://backup_user@192.168.1.1/backup/
But after that it goes really fast :-)If you want to see what happens you can add -v.
rsync -va /home/username/ rsync://backup_user@192.168.1.1/backup/
You can also backup just a part. For example:
rsync -a /home/username/Documents rsync://backup_user@192.168.1.1/backup/Documents
You probably want to automate the backup task with a script.
Consider the option --password-file=pass.txt.
This allows to use a password, without storing it in your script. You still store it in a file on the client, so it isn't exactly save.
Windows
There are several windows version.
DeltaCopy, QtdSync, Syncrify and RsyncBackup (client only).
Try them and see what works best for you.