国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 系統 > Ubuntu > 正文

在Ubuntu系統上使用apt-fast來加快apt-get下載的教程

2020-10-18 20:41:55
字體:
來源:轉載
供稿:網友

如果你在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 來更改設置。
2015617172852096.jpg (640×366)

2015617172910932.jpg (640×364)

2015617172930421.jpg (640×362)

配置 apt-get

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

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

    Debian: http://www.debian.org/mirror/list
    Ubuntu: https://launchpad.net/ubuntu/+archivemirrors

選擇完那些地理上靠近你的鏡像后,你需按照下面的格式將選擇的鏡像加入到/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

     2015617172956039.jpg (640×409)

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

   

復制代碼
代碼如下:
$ sudo netstat -nap | grep aria2c

    2015617173015162.jpg (640×250)

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

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

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

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

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 沂南县| 老河口市| 东源县| 任丘市| 铜鼓县| 晋中市| 抚顺县| 绿春县| 德清县| 临安市| 合川市| 灵山县| 海南省| 铜梁县| 东乡县| 崇礼县| 防城港市| 大丰市| 西丰县| 米脂县| 漳州市| 平果县| 高阳县| 洛宁县| 吉首市| 宁陕县| 沿河| 许昌县| 大渡口区| 商丘市| 衢州市| 浠水县| 龙山县| 沙河市| 仁布县| 洛阳市| 安吉县| 肇州县| 吉安市| 甘孜县| 乐亭县|