要给hadoop集群安装软件,发现从163下载还是比较的慢,直接 导致我批量安装部署软件等待时间过长,本想搭建本地的Debian源,后来发现,我主要就是为了apt-get安装些软件,如果下载debian源,光 64位的,就达到66G之多,最后找到这个个软件,还可直接给centos缓存,非常不错。
这软件的作用就是当服务器上没有那软件的缓存,第一次安装会从163源下载,下一次就直接从缓存里面取。所以,当大量机器要安装相同软件时就方便了,还可缓存sf.net。
下载
搭建debian缓存服务器软件安装
make;
将软件移到 /usr/local/ 目录
将build/in.acng和build/in.acng 做软链接到/usr/local/sbin 修改配置文件acng.conf,红色字体专为centos用;
参考 http://blog.ossxp.com/tag/apt-cacher-ng/
配置文件:
CacheDir: /var/cache/apt-cacher-ng
LogDir: /var/log/apt-cacher-ng
Port:80
PidFile: /var/run/apt-cacher-ng/apt-cacher-ng.pid
Remap-debrep: file:deb_mirror*.gz /debian ; file:backends_debian
Remap-uburep: file:ubuntu_mirrors /ubuntu ; file:backends_ubuntu
Remap-centosrep: file:centos_mirrors.list /centos ; file:backends_centos
#Remap-cygwin: file:cygwin_mirrors /cygwin # ; file:backends_cygwin # incomplete, please create this file or specify preferred mirrors here
Remap-sfnet: file:sfnet_mirrors # ; file:backends_sfnet # incomplete, please create this file or specify preferred mirrors here
VfilePattern = (^|.*?/)(Index|Packages\.bz2|Packages\.gz|Packages|Release|Release\.gpg|Sources\.bz2|Sources\.gz|Sources|release|index\.db-.*\.gz|Contents-[^/]*\.gz|pkglist[^/]*\.bz2|rclist[^/]*\.bz2|/meta-release[^/]*|Translation[^/]*\.bz2|repodata/.*|mirrorlist\?.*)$
ReportPage: acng-report.html
ExTreshold: 4
上面红色字体部分是给centos做源缓存用的。
启动
apt-cacher-ng -c /usr/local/apt-cacher-ng/conf/
Debian机器源修改
deb http://192.168.200.180:3142/mirrors.163.com/debian squeeze main non-free contrib
deb-src http://192.168.200.180:3142/mirrors.163.com/debian squeeze main non-free contrib
deb http://192.168.200.180:3142/security.debian.org/ squeeze/updates main contrib
deb-src http://192.168.200.180:3142/security.debian.org/ squeeze/updates main contrib
Centos机器源修改
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrors.163.com/?release=$releasever&arch=$basearch&repo=os
baseurl=http://192.168.200.180/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=http://192.168.200.180/centos/devel/RPM-GPG-KEY-CentOS-5
#released updates
[update]
name=CentOS-$releasever - Updates
#mirrorlist=http://192.168.200.180/?release=$releasever&arch=$basearch&repo=updates
baseurl=http://192.168.200.180/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=http://192.168.200.180/centos/devel/RPM-GPG-KEY-CentOS-5
#packages used/produced in the build but not released
[addons]
name=CentOS-$releasever - Addons
#mirrorlist=http://192.168.200.180/mirrors.163.com/?release=$releasever&arch=$basearch&repo=addons
baseurl=http://192.168.200.180/centos/$releasever/addons/$basearch/
gpgcheck=1
gpgkey=http://192.168.200.180/centos/devel/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
#mirrorlist=http://mirrors.163.com/?release=$releasever&arch=$basearch&repo=extras
baseurl=http://192.168.200.180/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=http://192.168.200.180/centos/devel/RPM-GPG-KEY-CentOS-5
#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
#mirrorlist=http://mirrors.163.com/?release=$releasever&arch=$basearch&repo=centosplus
baseurl=http://192.168.200.180/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=1
gpgkey=http://192.168.200.180/centos/devel/RPM-GPG-KEY-CentOS-5
#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib
#mirrorlist=http://mirrors.163.com/?release=$releasever&arch=$basearch&repo=contrib
baseurl=http://192.168.200.180/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://192.168.200.180/centos/devel/RPM-GPG-KEY-CentOS-5
默认端口是3142,当然,你可以修改配置文件使用80端口,就如Centos机器源配置文件里面一样不用加端口了。