How To Setup Backup Server in FreeBSD and CentOS
Introduction:
Each organization has important files. These files are the bread and butter for the company. What if a file corruption happens? Can these files be retrieved? Well there is a solution and this is to have a backup system. Today backup storage appliance cause thousands and some company find investing to this amount impractical. What is presented in this paper is a backup solution that will cater the issue with a minimal cost using opensource software.
Purpose:
Create a backup solution that is low cost and flexible.
Installation:
SERVER SIDE:
Operating System: CentOS Linux 5.x
Make sure xinetd and rsync is available, if not type
# rpm –qa | grep rsync
# rpm –qa | grep xinetd
# yum -y install rsync xinetd
Add xinetd service to system
# chkconfig –add xinetd
Make sure xinetd running on init 3 and 5
# chkconfig –list xinetd
Enable rsync
# vi /etc/xinetd.d/rsync
Change disable = yes into disable = no
Create username and password for rsync client to use
# vi /etc/rsyncd.secrets
adminname:hispassword
CLIENT SIDE:
Operating System: FreeBSD 8.0
During installation select rsync package
Configuration:
SERVER SIDE:
Create configuration and shares for rsync daemon
# vi /etc/rsyncd.conf
motd file=/etc/motdmax connections = 15
log file = /var/log/rsync.log
timeout = 300
read only = yes
list = yes
hosts allow = 192.168.0.0/24
uid=root
gid=root
[rsync-<directoryname1>]
path = /home/<directoryname1>
comment = <directoryname1> data shared files
[rsync-<directoryname2>]
path = /opt2/<directoryname2>
comment = <directoryname2> shared files
Secure /etc/rsyncd.*
# chown root.root /etc/rsyncd.*
# chmod 600 /etc/rsyncd.*
Restart xinetd
# service xinetd restart
Make sure rsync now running
# chkconfig –list
Open port 873 tcp and udp on firewall to allow client access
CLIENT SIDE:
Create a script that will be ran in cron.
rsync01.sh:
#!/bin/sh
/usr/local/bin/rsync -aHv 192.168.0.4::rsync-<directoryname1> /u01/RSYNC-FILES-U01/<directoryname1>
rsync02.sh:
#!/bin/sh
/usr/local/bin/rsync -aHv 192.168.0.4::rsync-<directoryname2> /u02/RSYNC-FILES-U02/<directoryname2>
Add this entry to cron
# | min | hour | day | month | day of week | command |
# RSYNC BACKUP
0 22 * * * sh /u01/SYSADMIN/SCRIPTS/rsync01.sh && sh /u01/SYSADMIN/SCRIPTS/rsyn
c02.sh
Source / references
http://gd.tuwien.ac.at/utils/admin-tools/rsync/rsyncd.conf.html