Local rsync mirror

From Gentoo Linux Wiki
Jump to: navigation, search
Gentoo.png
Gentoo has an official article on:


rsync is a method of synchronizing one machine against another to ensure the files are consistent and updated when necessary. This is not the same as a cp function as files will be skipped if they are determined to be current. Local rsync'ing is much faster than synchronizing every machine against official Gentoo rsync mirrors, and it will reduce the load on those mirrors.

Contents

[edit] Installing

To preapre the server we need the rsync tool. It should be in the system by default, but if it is not then you will need to emerge it:

emerge -av rsync

[edit] Configuring

The file used to configure Rsync is /etc/rsyncd.conf. It should have the settings required to setup your own local Rsync for the Portage tree. Find the lines in the example below and uncomment them:

File: /etc/rsyncd.conf
[gentoo-portage]
       path = /usr/portage
       comment = Gentoo Portage tree
       exclude = /distfiles /packages

Now you will need to start the server:

/etc/init.d/rsyncd start

To have rsync start at boot:

rc-update add rsyncd default

[edit] Configuring client

The local rsync server should be working, but before you will start syncing you will need to edit /etc/make.conf on your client machines by adding or changing the SYNC variable:

File: /etc/make.conf
SYNC="rsync://192.168.1.2/gentoo-portage"

Change 192.168.1.2 to the proper IP address of your server. Additionally, you can only specify one mirror to synchronize against.

[edit] Opening rsync port on firewalled systems (iptables)

rsync handles communications through TCP port 873. If you are firewalled you will need to open the port by adding following line to your firewall script:

iptables -A INPUT -i eth0 -p tcp --dport 873 -j ACCEPT

Not so obviously, change eth0 to the proper device that connects to your network.

[edit] External links

Personal tools