Linux中國

極速蝸牛:apt-fast

在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 來更改設置。

配置 apt-get

安裝完成後,你需要在/etc/apt-fast.conf里配置apt-fast使用的一系列鏡像。

你可以在下面的URL中找到一系列Debian/Ubuntu鏡像。

選擇完那些地理上靠近你的鏡像後,你需按照下面的格式將選擇的鏡像加入到/etc/apt-fast.conf。

$ sudo vi /etc/apt-fast.conf

Debian:

MIRRORS=('http://ftp.us.debian.org/debian/,http://carroll.aset.psu.edu/pub/linux/distributions/debian/,http://debian.gtisc.gatech.edu/debian/,http://debian.lcs.mit.edu/debian/,http://mirror.cc.columbia.edu/debian/')

Ubuntu/Mint:

MIRRORS=('http://us.archive.ubuntu.com/ubuntu,http://mirror.cc.columbia.edu/pub/linux/ubuntu/archive/,http://mirror.cc.vt.edu/pub2/ubuntu/,http://mirror.umd.edu/ubuntu/,http://mirrors.mit.edu/ubuntu/')

如上面所示,對於一個特定檔案的個別鏡像,需要用逗號分割開來。你需要在/etc/apt/sources.list的MIRRORS字元串中包含默認的鏡像指定站點。

使用apt-fast安裝一個包

現在你就可以測試apt-fast的強大了。下面是使用apt-fast的示例:

apt-fast [apt-get options and arguments]
apt-fast [aptitude options and arguments]
apt-fast { { install | upgrade | dist-upgrade | build-dep | download  | source  } [ -y | --yes | --assume-yes | --assume-no ]   ... | clean }

使用apt-fast安裝包:

 $ sudo apt-fast install texlive-full

在當前目錄下載軟體包,但不安裝:

 $ sudo apt-fast download texlive-full

如前面所示,apt-fast的並行下載是通過aria2完成的。你可以看到如下圖般從多個鏡像並行下載。

$ sudo netstat -nap | grep aria2c

請注意,apt-fast並沒有加速"apt-get update"。並行下載只在"install", "upgrade", "dist-upgrage"和"build-dep"操作中觸發。其餘的操作,apt-fast就會簡單地回到默認的包管理器apt-get或aptitude。

apt-fast有多快?

為了比較apt-fast和apt-get,我嘗試在兩個相同的Ubuntu實例上使用兩種方法安裝幾個軟體包。下面的圖表展示了所有軟體包安裝的時間(單位為秒)。

正如你所見到的,apt-fast確實比apt-get快(e.g. 快3--4秒),特別是安裝龐大軟體包的時候。

當然,安裝性能的提高程度還依賴你上游網際網路連通性。以我為例,我有富足的帶寬來支持我的上游連接。這也是為什麼我看到並行下載帶來了成功的提高。

via: http://xmodulo.com/speed-slow-apt-get-install-debian-ubuntu.html

作者:Dan Nanni 譯者:su-kaiyao 校對:wxy

本文由 LCTT 原創翻譯,Linux中國 榮譽推出


本文轉載來自 Linux 中國: https://github.com/Linux-CN/archive

對這篇文章感覺如何?

太棒了
0
不錯
0
愛死了
0
不太好
0
感覺很糟
0
雨落清風。心向陽

    You may also like

    Leave a reply

    您的電子郵箱地址不會被公開。 必填項已用 * 標註

    此站點使用Akismet來減少垃圾評論。了解我們如何處理您的評論數據

    More in:Linux中國

    Linux中國

    DevOps 將去向何方?

    微軟、谷歌、亞馬遜、IBM 和甲骨文如今都在關注云上的 DevOps。這些大公司正在給企業提供 IT 自動化的服務。然而,DevOps 仍然在持續的演進中。DevSecOps、AIOps 和 NoOps 正在成為下一個流行詞。