This page contains information on how to run a private, local Gentoo rsync mirror.
To help the Gentoo project by providing public mirrors, please see the relevant documentation for source and rsync mirrors.
Setting up the mirror
Many users run Gentoo on several machines and need to sync the Gentoo repository on all of them. Using public mirrors is simply a waste of bandwidth at both ends. Syncing only one machine against a public mirror and all others against that computer would save resources on the public mirrors and save users' bandwidth.
The same holds true for organizations who would like to control the rsync mirror their servers and workstations sync against. Of course, they usually also want to save on bandwidth and traffic costs.
Select which machine is going to be the local rsync mirror and set it up. Choose a computer that can handle the CPU and disk load that an rsync operation requires. The local mirror also needs to be available whenever any of the other computers syncs its Portage tree. Besides, it should have a static IP address or a name that always resolves to the server. Configuring a DHCP and/or a DNS server is beyond the scope of this guide.
Setting up the server
There is no extra package to install as the required software is already on the computer. Setting up your own local rsync mirror is just a matter of configuring the rsyncd daemon to make the /usr/portage directory available for syncing. Create the following /etc/rsyncd.conf configuration file:
pid file = /var/run/rsyncd.pid max connections = 5 use chroot = yes uid = nobody gid = nobody # Optional: restrict access to some Gentoo boxes hosts allow = 192.168.0.1 192.168.0.2 192.168.1.0/24 hosts deny = * [gentoo-portage] path=/usr/portage comment=Gentoo Portage exclude=distfiles/ packages/
hosts allow and
hosts deny options are not needed. By default, all clients will be allowed to connect to the mirror. The order in which the options are written is not relevant. The server will always check the
hosts allow option first and grant the connection if the connecting host matches any of the listed patterns. The server will then check the
hosts deny option and refuse the connection if any match is found. Any host that does not match anything will be granted a connection. Please read the man page (man rsyncd.conf) for more information.
Now, start the rsync daemon with the following command as the root user:
rc-update add rsyncd default
systemctl start rsyncd.service
systemctl enable rsyncd.service
Testing the server
It is time to test the rsync mirror. It is not necessary to test from another machine but it would be a good idea to do so. If the server is not known by hostname from all computers, use its associated IP address instead.
gentoo-portage Gentoo Portage
The content of /usr/portage should be visible on the mirror.
The rsync mirror is now set up. Running emerge --sync on this system will keep the server up-to-date. If cron or similar facilities to sync regularly, remember to keep it down to a sensible frequency like once or twice a day.
Please note that most public mirror administrators consider syncing more than once or twice a day an abuse. If the abuse limit is reached most mirrors will ban the abusers IP address from their server(s).
Configuring the clients
Now, make the other computers use the own local rsync mirror instead of a public one using the repos.conf file.