http://www.chmhome.com/knowledge/bsd/20070621/18152.html
懵懵懂懂安装完Freebsd6.1后,遇到的第一个问题就是portsnap。由于国内的portsnap网站有问题,而国外的慢过蜗牛。所以,先解决这个问题。先看看portsnap fetch的过程。
f61# portsnap fetch
Looking up portsnap.hshh.org mirrors... none found.
Fetching public key... done.
Fetching snapshot tag... done.
Fetching snapshot metadata... done.
Fetching snapshot generated at Fri Jan 5 08:50:10 CST 2007:
cd80c9188c4689955708c000503946928056130f0a13bb100% of 45 MB 126 kBps 00m00s
Extracting snapshot... snap/7a43e8b6faeb315b2922b5ed95a66740bc47d98a5489bf7efdacaf85323074cc.gz: Premature end of gzip compressed data: Input/output error
tar: Premature end of gzip compressed data: Input/output error
f61# portsnap fetch
Looking up portsnap.cn.freebsd.org mirrors... none found.
Fetching public key... done.
Fetching snapshot tag... done.
Fetching snapshot metadata... done.
Fetching snapshot generated at Fri Jan 5 08:50:10 CST 2007:
cd80c9188c4689955708c000503946928056130f0a13bb100% of 24 MB 118 kBps 00m00s
Extracting snapshot... snap/2bdf9d30e8ff6785909a5586a15fb836735e80eed7324e6fe772a83a7e26300d.gz: Premature end of gzip compressed data: Input/output error
tar: Premature end of gzip compressed data: Input/output error
f61# portsnap fetch
Looking up portsnap.freebsd.org mirrors... using portsnap1.FreeBSD.org
Fetching public key... done.
Fetching snapshot tag... done.
Fetching snapshot metadata... done.
Fetching snapshot generated at Fri Jan 5 08:50:10 CST 2007:
cd80c9188c4689955708c000503946928056130f0a13bb100% of 45 MB 5444 Bps 00m00s
Extracting snapshot... done.
Verifying snapshot integrity... done.
Fetching snapshot tag... done.
Fetching snapshot metadata... done.
Updating from Fri Jan 5 08:50:10 CST 2007 to Sat Jan 6 03:58:25 CST 2007.
Fetching 4 metadata patches... done.
Applying metadata patches... done.
Fetching 0 metadata files... done.
Fetching 102 patches.....10....20....30....40....50....60....70....80....90....100. done.
Applying patches... done.
Fetching 9 new ports or files... done.
太恐怖了。
看看/usr/sbin/portsnap这个shell文件。就会知道一些环境变量的信息。其他的自个慢慢看吧。
安装axel。由于使用fetch,所以会慢点。
whereis axel
cd /usr/ports/ftp/axel
make install clean
修改/usr/sbin/portsnap,只需要修改一行。
fetch -r http://${SERVERNAME}/s/${SNAPSHOTHASH}.tgz || return 1
修改为
/usr/local/bin/axel http://${SERVERNAME}/s/${SNAPSHOTHASH}.tgz || return 1
其他的文件下载还是用fetch,很小嘛!如果不让axel显示,加上-q参数。-a参数会好看点。
执行portsnap fetch ,我的测试是fetch小于10K,还经常断线(使用-r参数);axel大于100K。
[100%] .......... .......... .......... .......... .......... [ 150.5KB/s]
[100%] ....
Downloaded 45.7 megabytes in 5:10 seconds. (150.46 KB/s)
这里小弟没有测试过cron这个参数。
关于axel的代理是这样
fb61# cat /etc/axelrc
http_proxy = http://192.168.0.4:8080/
ftp_proxy = http://192.168.0.4:8080/
安装ports的时候也需要改些地方。举个例子我要安装links。whereis links找到 /usr/ports/chinese/links这个目录,查看Makefile ---> /../../www/links/Makefile ---> .include <bsd.port.post.mk> ---> /usr/ports/Mk/bsd.port.mk 。其中发现这句话:
# These variables are typically set in /etc/make.conf to indicate
# the user's preferred location to fetch files from. You should
# rarely need to set these.
接着看下去,事情就好办了。修改/etc/make.conf
FETCH_CMD=/usr/local/bin/axel
DISABLE_SIZE=YES
参考:http://fanqiang.chinaunix.net/system/bsd/2006-05-18/4176.shtml 《FreeBSD在安装ports时缩短下载时间》。
pkg_add -r 可以用wget axel不???
/usr/sbin/pkg_add 可不是shellscript
置顶精华里面早就有,还是我亲自加上去的
=================================================================================================