HOWTO_Local_Rsync_Mirror
Contents |
Official Gentoo Linux rsync Mirrors Policy and Guide
The Official Gentoo Linux rsync Mirrors Guide provides official documentation on how to setup local LAN mirrors and official public mirrors. Please assume that information in that document is more accurate and more correct than the information in this document.
Introduction
If you have a couple of gentoo boxes on a LAN, be a good gentoo netizen and setup a local rsync mirror. You can sync the server box across the net and then sync all your other machines faster across the LAN. This not only allows gentoo to grow faster by not abusing mirrors, but there's a good chance your LAN is faster than your internet connection.
All you need is rsync to be installed and a configured rsyncd.conf. Every gentoo box has rsync installed because it's part of the base system.
Edit Files
You will need to create the directory named rsync in /etc.
mkdir /etc/rsync
Create a file in your new directory and put the following contents in it. Be sure to modify to your likings!
| File: /etc/rsync/rsyncd.conf |
# Distributed under the terms of the GNU General Public License v2 # $Header: /var/cvsroot/gentoo-x86/net-misc/rsync/files/rsyncd.conf,v 1.3 2004/07/15 00:11:37 agriffis Exp $ # Minimal configuration file for rsync daemon # See rsync(1) and rsyncd.conf(5) man pages for help # This line is required by the /etc/init.d/rsyncd script pid file = /var/run/rsyncd.pid uid = nobody gid = nobody use chroot = yes read only = yes #limit access to private LANs hosts allow=192.168.0.0/255.255.0.0 10.0.0.0/255.0.0.0 172.16.0.0/255.240.0.0 hosts deny=* max connections = 5 #motd file = /etc/rsync/rsyncd.motd #This will give you a separate log file #log file = /var/log/rsync.log #This will log every file transferred - up to 85,000+ per user, per sync #transfer logging = yes log format = %t %a %m %f %b syslog facility = local3 timeout = 300 [gentoo-portage] #modern versions of portage use this entry path = /usr/portage comment = Gentoo Linux Portage tree mirror exclude = distfiles/ packages/ |
If you want a motd message then uncomment the motd line in rsyncd.conf
| File: /etc/rsync/rsyncd.motd |
Welcome to My Local Rsync Mirror!! |
By default the configuration file is called /etc/rsyncd.conf, so if you want to keep all the conf in /etc/rsync/ (that i believe it's cleaner) just edit
| File: /etc/conf.d/rsyncd |
RSYNC_OPTS="--config /etc/rsync/rsyncd.conf --address 192.168.x.y" |
Then start rsyncd, and make it start at boot.
/etc/init.d/rsyncd start rc-update add rsyncd default
Now you have a local server up and running. You must point your client boxes to this new server. Edit /etc/make.conf on the client boxes and change the SYNC option to your new server. The SYNC section should look like this :
| File: /etc/make.conf |
#SYNC="rsync://rsync.gentoo.org/gentoo-portage" SYNC="rsync://YourMirrorHere.com/gentoo-portage" |
Replace YourMirrorHere.com with your server's Name or IP address.
Then kick back and admire your work, knowing your client boxes can sync faster over the LAN and that you're saving Gentoo/yourself a lot of bandwidth!!
Notes
If you want to run your rsync daemon through a firewall, be sure to open port 873 on tcp.
iptables -A INPUT -p tcp -m state --state NEW -m tcp --dport 873 -j ACCEPT
Let me say again, most of this info is taken from the Official Howto BUT modified for LOCAL use. The gentoo-rsync-mirror ebuild is currently outdated and designed for OFFICIAL PUBLIC mirrors only.
Using XINETD instead of adding rsyncd to start at boot.
If your rsync daemon is not going to see heavy use (I sync two other gentoo boxes with mine), there is not much use in always having the process running. Instead I choose to let xinetd start it when called upon. If you go this route skip starting rsyncd '/etc/init.d/rsyncd start', as well as starting it at boot 'rc-update add rsyncd default', xinetd is going to take care of all of this for us.
1. You need to emerge rsync with xinetd support: 'USE="xinetd" emerge -Dva rsync'
2. Open /etc/xinetd.d/rsyncd with your favorite editor
(be sure to change 'disable = no', & 'server_args = --config /etc/rsync/rsyncd.conf --address 192.168.x.y --daemon')
service rsync
{
socket_type = stream
protocol = tcp
wait = no
user = root
server = /usr/bin/rsync
server_args = --config /etc/rsync/rsyncd.conf --address 192.168.x.y --daemon
disable = no
}
3. By default, the only_from parameter in /etc/xinetd.conf is "localhost". You can add your
machine hostnames or IPs there or comment it out (otherwise your rsync connections WILL
be rejected by xinetd).
4. Start xinetd: '/etc/init.d/xinetd start'
5. Start xinetd at boot: 'rc-update add xinetd default'
Origin
- Posted by flybynite, Jun 01, 2004
- Original Gentoo Forums Post
See Also
Concerns or Compliments? Please use the Discussion section.
Created by NickStallman.net, Luxury Homes Australia
Real estate agents should be using interactive floor plans and real estate agent tools.
