在Ubuntu系统上使用apt-fast来加快apt-get下载的教程

2025-11-03 02:36:28阅读量:4 字体:

假如你在Debian或Ubuntu系统上经常感觉到apt-get 或 aptitude包安装速度过慢,那么这里就有几种改善这一情况的方法。你有没有考虑过改变正被使用的默认镜像站点?你有没有排除因特网连接的上游带宽成为瓶颈的可能?

假如不是这些原因,你可以尝试第三个选择:使用apt-fast工具。apt-fast实际上是一个围绕apt-get和aptitude所写的shell脚本容器,它能加速包的下载速度。apt-fast本质上采用aria2下载工具,这款工具能够以“块”的方式从多个镜像并行下载一个文件(就像BitTorrent下载)。

在Debian或Ubuntu上安装apt-fast

下面是在基于Debian的Linux上安装apt-fast的步骤

Debian


复制代码代码如下: $ sudo apt-get install aria2

$ wget https://github.com/ilikenwf/apt-fast/archive/master.zip

$ unzip master.zip

$ cd apt-fast-master

$ sudo cp apt-fast /usr/bin

$ sudo cp apt-fast.conf /etc

$ sudo cp ./man/apt-fast.8 /usr/share/man/man8

$ sudo gzip /usr/share/man/man8/apt-fast.8

$ sudo cp ./man/apt-fast.conf.5 /usr/share/man/man5

$ sudo gzip /usr/share/man/man5/apt-fast.conf.5

Ubuntu 14.04 以及更高版本


复制代码代码如下:$ sudo add-apt-repository ppa:saiarcot895/myppa

$ sudo apt-get update

$ sudo apt-get install apt-fast

Ubuntu 11.04 到 Ubuntu 13.10


复制代码代码如下:$ sudo add-apt-repository ppa:apt-fast/stable

$ sudo apt-get update

$ sudo apt-get install apt-fast

在安装期间,你需要选择一个默认的软件包管理器 (e.g., apt-get. aptitude ),还需要设置其余选项。但是你可以随时通过编辑配置文件 /etc/apt-fast/conf 来更改设置。

在Ubuntu系统上使用apt-fast来加快apt-get下载的教程

apt-fast有多快?

为了比较apt-fast和apt-get,我尝试在两个相同的Ubuntu实例上使用两种方法安装几个软件包。下面的图表展示了所有软件包安装的时间(单位为秒)。

正如你所见到的,apt-fast确实比apt-get快(e.g. 快3--4秒),特别是安装庞大软件包的时候。

当然,安装性能的提高程度还依赖你上游因特网连通性。以我为例,我有富足的带宽来支持我的上游连接。这也是为什么我看到并行下载带来了成功的提高。

推荐阅读