关于apt命令下载的想法
-
- 帖子: 1081
- 注册时间: 2009-04-29 21:22
关于apt命令下载的想法
apt命令从源里面下载软件,似乎是调用wget进行下载的,但是,wget命令比较慢,而aria2c之类的命令下载的速度则是很快的,如何让apt命令调用aria2c命令进行下载?
-
- 帖子: 1081
- 注册时间: 2009-04-29 21:22
Re: 关于apt命令下载的想法
找到一个资料:
代码: 全选
Apt-fast 是一个用 axel 来加速 apt-get 软件安装的脚本
安装
sudo add-apt-repository ppa:tldm217/tahutek.net
sudo apt-get update
sudo apt-get install apt-fast
现在你可以用 apt-fast 命令来替代 apt-get 了,比如
sudo apt-fast update
sudo apt-fast install firefox
通过这个工具在安装软件时,因为用到了 axel 的多线程下载功能,所以在下载软件包时会比普通的 apt-get 要快上好几倍。当然这也取决于网络,如果下载来自于 PPA 源的软件包的话可能改善不大 ,我这边从 PPA 源下载东西速度一直很慢,所以通常我都是借助代理来下载的。
-
- 帖子: 1081
- 注册时间: 2009-04-29 21:22
Re: 关于apt命令下载的想法
另外在网上找到一脚本,没怎么看明白:
代码: 全选
# !/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 axel -a
# 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
- trigger
- 帖子: 1604
- 注册时间: 2006-10-25 18:08
Re: 关于apt命令下载的想法
try apt-proz
楼主真是一派胡言,真可谓:“两个黄鹂鸣翠柳,不知所云;一行白鹭上青天,不知所止“。本来不想和你辩论,今天气愤不过,和你理论一番。我国宪法写得清清楚楚:“一夜夫妻百日恩,七楼以上才有电梯”。这个想必你知道,既然知道,你就不能断章取义,就算是天气预报,它还有不准的时候呢!!!再者说了,那中国银行也不是你一家开的。人家马拉多纳都结婚了,你还拿着粮票顶什么用呢。真是滑天下之大稽。前些日子,全国人大刚刚开过会,郑重声明:“中国不搞多party制,存栏母猪给补贴”。多好的事呢,楞让你这号人给搅混了。