Gentoo Portage树服务器(SYNC服务器)的搭建
http://blog.chinaunix.net/u1/34010/showart_262609.html
Gentoo的一大特色就是它的Emerge,为了保证使用最新的软件,我们必须及时的更新Portage树。通常的方法就是与官方的服务器进行同步,但是对于同一网内有多台Gentoo Linux时,如果每台机子都通过Internet与官方服务器同步Portage树的话,宝贵的带宽资源就被这重复的劳动给浪费了。同时更新的速度也是很慢的。

为了解决这个问题,我们可以在局域网内部设定一个Portage树服务器(也就是SYNC服务器),让服务器每天跟官方服务器同步Portage树,网内其他计算机则与这台服务器同步。SYNC服务器对的要求任跟一般的计算机没有什么区别,你可以把他任何一台计算机作为SYNC服务器。

首先你需要给这台服务器分配一个静态的IP地址,或者在DNS服务器上建立一个固定的域名。

服务器端的配置
修改位于etc下的rsyncd.conf文件,下面是一个例子

# Simple example for enabling your own local rsync server
pid file = /var/run/rsyncd.pid
use chroot = yes
read only = yes
max connections = 5
uid = nobody
gid = nobody

[gentoo-portage]
path = /usr/portage
comment = Gentoo Portage tree
exclude = /distfiles /packages


各种参数可以参考rsync.conf的手册

#man rsyncd.conf


运行rsync服务

# /etc/init.d/rsyncd start

设定rsync服务为自动启动

# rc-update add rsyncd default

客户端的配置
对于网内的其他Gentoo计算机,仅仅只需要修改make.conf 文件里面的SYNC标签,将原有的同步服务器的地址删除,并修改成局域网内部服务器的IP地址(或者域名)。然后就可以通过“emerge --sync”来同步Portage树了。

#SYNC="rsync://your_server_ip/gentoo-portage"
#SYNC="rsync://your_server_name/gentoo-portage"
SYNC="rsync://192.168.0.141/gentoo-portage"


修改完毕后你就可以用emerge --sync 来使客户端与服务器的Portage树进行同步了。