Rsync is a very easy way to transfer large amounts of files between servers with low resource usage which also makes for a great backup target due to its speed and flexibility. Here's a small write-up on how to set up a basic rsyncd server:
First, install the required packages:
[archy@mirror01~]$ sudo yum -y --refresh install rsync rsync-daemon
Create the rsync root directory, I'll place all my sub-modules (folders) in '/var/rsync'
[archy@mirror01 ~]$ mkdir -p /var/rsync/{rpms,backup}
Setting the SELinux boolean and file context:
[archy@mirror01 ~]$ sudo semanage boolean -m -1 rsync_full_access
[archy@mirror01 ~]$ sudo semanage fcontext -a -t 'public_content_t' '/var/rsync(/.*)?'
[archy@mirror01 ~]$ sudo restorecon -Rv /var/rsync
Creating /etc/rsyncd.conf:
[archy@mirror01 ~]$ sudo vim /etc/rsyncd.conf
pid file = /var/run/rsyncd.pid
log file = /var/log/rsyncd.log
lock file = /var/run/rsyncd.lock
address = 0.0.0.0
port = 873
[rpms]
comment = share for rpms
path = /var/rsync/rpms
read_only = false
write_only= false
timeout = 300
[backup]
comment = backup share
path = /var/rsync/backup
read only = false
write only = true
timeout = 300
Restart enable and restart the rsyncd service:
[archy@mirror01 ~]$ sudo systemctl enable rsyncd.service
[archy@mirror01 ~]$ sudo systemctl restart rsyncd.service
Keep in mind that this is a very basic setup for shares using rsync. For more options, see rsyncd.conf(5).
Feel free to comment and / or suggest a topic.
Comments
Post a Comment