debian创建apt-proxy代理
时间:2006-04-11 来源:me09
![]() |
|||
|
国内有好几个 Debian 包的镜像,让你可以更快的下载 Debian。
http://rays.swhss.com.cn/mirror/debian/ 由新华 Linux 公司维护的镜像,每天更新 ftp://ftp.linuxforum.net/debian/ 由中国 Linux 论坛维护的镜像,每天更新 http://debian.cn99.com/debian/ CN99 的镜像,每天更新http://mirror.vmmatrix.net/debian/ http://mirror.vmmatrix.net/debian/
个人感觉cn99速度不如其他几个快.可能是访问量大或本公司网络造成的吧!
然后下载安装代理软件apt-proxy
apt-get install apt-proxy
安装完成后默认的配置就可以启动代理功能,而且效果也比较稳定!
启动之后系统会产生一个守护进程twistd!
ps -ax
/usr/bin/python2.3 /usr/bin/twistd --pidfile=/var/run/apt-proxy//apt-proxy.pid --rundir=/var/run/apt-prox
为了使自己能够获得比较好的代理速度,小编我选用了一个国内的mirror;
;; Backend servers, in order of preference
82 backends =
83 http://ftp.us.debian.org/debian
84 http://ftp.de.debian.org/debian
85 http://ftp2.de.debian.org/debian
86 ftp://ftp.uk.debian.org/debian
87 http://rays.swhss.com.cn/mirror/debian
88
89
90 [debian-non-US]
91 ;; Debian debian-non-US archive
92 ;timeout will be the global value
93 backends =
94 http://ftp.uk.debian.org/debian-non-US
95 http://ftp.de.debian.org/debian-non-US
96 ftp://ftp.uk.debian.org/debian
97 http://rays.swhss.com.cn/mirror/debian-non-US
98
99 [security]
100 ;; Debian security archive
101 backends =
102 http://security.debian.org/debian-security
103 http://ftp2.de.debian.org/debian-security
104 http://debian.cn99.com/debian-security
105 http://rays.swhss.com.cn/mirror/debian-security
如此之后重起/etc/init.d/apt-proxy restart
导入刚才所做的配置!
然后修改客户机的sources.list文件如下格式!
vim /etc/apt/sources.list
deb http://apt-proxy-server-IP:9999/debian/ unstable main
deb-src http://apt-proxy-server-IP:9999/debian/ unstable main
apt-proxy默认是使用9999 端口,当然我们也可以修改为别的端口!大家知道
debian共有3个版本stable unstable testing,至于选择那一个随个人喜好和情况而定.但是有一点要说明,低版本升级的高版本容易,要想再换回低版本就没那么简单!
小编使用的unstable
好了运行一下apt-get update
看是否可以连接的上!
如果有问题!你可以查看系统日志来确定并修复故障
tail -f /var/log/apt-proxy.log
如果实在找不到原因可以把先前写的首选镜象站点给换成别的镜象站点,这是因为此时这个站点可能在进行更新同步的某些组件暂时不可用!
在这里建议大家把我们的apt-cache的更新时间调的稍微大一点一面由于更新频繁影响使用!
集体是把apt-proxy 的配置文件的min_refresh_delay = 1h
修改为min_refresh_delay = 23h
好了就先写到这里吧!祝好运!