ubuntu更新提速之apt-fast的几个问题

系统安装、升级讨论
版面规则
我们都知道新人的确很菜,也喜欢抱怨,并且带有浓厚的Windows习惯,但既然在这里询问,我们就应该有责任帮助他们解决问题,而不是直接泼冷水、简单的否定或发表对解决问题没有任何帮助的帖子。乐于分享,以人为本,这正是Ubuntu的精神所在。
回复
头像
wtry
帖子: 923
注册时间: 2009-03-18 9:26

ubuntu更新提速之apt-fast的几个问题

#1

帖子 wtry » 2010-09-05 8:43

apt-fast的思想就是使用将要更新的软件全路径保存在apt-fast.list文件中,然后使用axel下载,由于axel是多线程下载所以速度会快很多…………
这里我指出apt-fast的几个问题。
1.axel在下载时默认使用3个线程,它将下载的文件分成3块下载,这样貌似会快些,实际上在下载一些很小的包时反而很慢,因为如果有一个线程连不上,则就卡在那里了,呵呵………………
2.这个问题比较严重些,axel默认是支持断点续传的,但由于apt-fast脚本使用axel下载的方式不同,所以axel不会续传没有下载玩的软件包,所以在使用apt-fast时切记不要中途终止,如果终止了,在次使用前把下载目录中的.st文件和对应的软件包删除在下载,这些包没有下载玩,但不会继续下载,如果安装会出现错误………………

在这里我像大家推荐使用aria2c替代axel
ariac可以直接续传,而且下载速度也不会比axel慢。线程开的多也不会卡在一个线程上不动…………

# !/bin/sh
# apt-fast v0.03 by Matt Parnell http://www.mattparnell.com, this thing is fully open-source
# if you do anything cool with it, let me know so I can publish or host it for you
# contact me at admin@mattparnell.com

# Special thanks
# Travis/travisn000 - support for complex apt-get commands
# Allan Hoffmeister - aria2c support
# Abhishek Sharma - aria2c with proxy support
# Richard Klien - Autocompletion, Download Size Checking (made for on ubuntu, untested on other distros)
# Patrick Kramer Ruiz - suggestions - see Suggestions.txt
# Sergio Silva - test to see if axel is installed, root detection/sudo autorun

# Use this just like apt-get for faster package downloading.

# Check for proper priveliges
[ "`whoami`" = root ] || exec sudo "$0" "$@"

# Test if the axel is installed
if [ ! -x /usr/bin/axel ]
then echo "axel is not installed, perform this?(y/n)"
read ops
case $ops in
y) if apt-get install axel -y --force-yes
then echo "axel installed"
else echo "unable to install the axel. you are using sudo?" ; exit
fi ;;
n) echo "not possible usage apt-fast" ; exit ;;
esac
fi

# If the user entered arguments contain upgrade, install, or dist-upgrade
if echo "$@" | grep -q "upgrade\|install\|dist-upgrade"; then
echo "Working...";

# Go into the directory apt-get normally puts downloaded packages
cd /var/cache/apt/archives/;

# Have apt-get print the information, including the URI's to the packages
# Strip out the URI's, and download the packages with Axel for speediness
# I found this regex elsewhere, showing how to manually strip package URI's you may need...thanks to whoever wrote it
apt-get -y --print-uris $@ | egrep -o -e "(ht|f)tp://[^\']+" > apt-fast.list && cat apt-fast.list | xargs -l1 aria2c -s 5

# Perform the user's requested action via apt-get
apt-get $@;

echo -e "\nDone! Verify that all packages were installed successfully. If errors are found, run apt-get clean as root and try again using apt-get directly.\n";

else
apt-get $@;
fi



如果有什么不对的地方,还请各位指出………… :em06 :em06
头像
枫叶饭团
帖子: 14683
注册时间: 2010-06-16 1:05
系统: Mac OS X
来自: Tencent
联系:

Re: ubuntu更新提速之apt-fast的几个问题

#2

帖子 枫叶饭团 » 2010-09-05 9:30

我喜欢aria2,特别是我vps上~
头像
Jarson
帖子: 2371
注册时间: 2008-07-21 9:44
来自: 深圳
联系:

Re: ubuntu更新提速之apt-fast的几个问题

#3

帖子 Jarson » 2010-09-05 9:38

hoho,平时都不怎么注意下载工具,一直在用wget
areslp
帖子: 141
注册时间: 2007-05-07 23:55

Re: ubuntu更新提速之apt-fast的几个问题

#4

帖子 areslp » 2010-11-11 3:57

上面脚本还是有不能续传的问题啊,比如第一次没下载完,aria2c会有两个文件一个xx.deb,一个xx.deb.aria2c,但是第二次再执行的时候apt-get -y --print-uris $@这个命令会看到xx.deb,就不会再返回下载链接了,然后apt-get直接拿到一个不完整的xx.deb进行安装。。。
头像
Drdi
帖子: 257
注册时间: 2009-10-02 15:47

Re: ubuntu更新提速之apt-fast的几个问题

#5

帖子 Drdi » 2010-11-11 14:04

装了apt-fast 但是从来没有用过 :em06
爱Linux 也爱Ubuntu
简洁美观的桌面
更爱高效稳定的系统
不是不折腾难受夫斯基不想浪费时间
我和大多数人一样 我是菜菜
我要有菜菜的觉悟
我是Drdi
人在井天
帖子: 1081
注册时间: 2009-04-29 21:22

Re: ubuntu更新提速之apt-fast的几个问题

#6

帖子 人在井天 » 2010-11-19 8:55

areslp 写了:上面脚本还是有不能续传的问题啊,比如第一次没下载完,aria2c会有两个文件一个xx.deb,一个xx.deb.aria2c,但是第二次再执行的时候apt-get -y --print-uris $@这个命令会看到xx.deb,就不会再返回下载链接了,然后apt-get直接拿到一个不完整的xx.deb进行安装。。。
这个问题是可以解决的。
viewtopic.php?f=73&t=304107
回复