Linux中國

如何在 Ubuntu Linux 16.04 LTS 中使用多個連接加速 apt-get/apt

安裝 apt-fast 工具

在 Ubuntu Linux 14.04 或者之後的版本嘗試下面的命令:

$ sudo add-apt-repository ppa:saiarcot895/myppa

示例輸出:

更新你的倉庫:

$ sudo apt-get update

或者

$ sudo apt update

安裝 apt-fast

$ sudo apt-get -y install apt-fast

或者

$ sudo apt -y install apt-fast

示例輸出:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
  aria2 libc-ares2 libssh2-1
Suggested packages:
  aptitude
The following NEW packages will be installed:
  apt-fast aria2 libc-ares2 libssh2-1
0 upgraded, 4 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,282 kB of archives.
After this operation, 4,786 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://01.archive.ubuntu.com/ubuntu xenial/universe amd64 libssh2-1 amd64 1.5.0-2 [70.3 kB]
Get:2 http://ppa.launchpad.net/saiarcot895/myppa/ubuntu xenial/main amd64 apt-fast all 1.8.3~137+git7b72bb7-0ubuntu1~ppa3~xenial1 [34.4 kB]
Get:3 http://01.archive.ubuntu.com/ubuntu xenial/main amd64 libc-ares2 amd64 1.10.0-3 [33.9 kB]
Get:4 http://01.archive.ubuntu.com/ubuntu xenial/universe amd64 aria2 amd64 1.19.0-1build1 [1,143 kB]
54% [4 aria2 486 kB/1,143 kB 42%]                                    20.4 kB/s 32s

配置 apt-fast

你將會得到下面的提示(必須輸入一個5到16的數值):

並且

你也可以直接編輯設置:

$ sudo vi /etc/apt-fast.conf

請注意這個工具並不是給慢速網路連接的,它是給快速網路連接的。如果你的網速慢,那麼你將無法從這個工具中得到好處。

我該怎麼使用 apt-fast 命令?

語法是:

apt-fast command
apt-fast [options] command

使用 apt-fast 取回新的包列表

sudo apt-fast update

使用 apt-fast 執行升級

sudo apt-fast upgrade

執行發行版升級(發布或者強制內核升級),輸入:

$ sudo apt-fast dist-upgrade

安裝新的包

語法是:

sudo apt-fast install pkg

比如要安裝 nginx,輸入:

$ sudo apt-fast install nginx

示例輸出:

刪除包

$ sudo apt-fast remove pkg
$ sudo apt-fast remove nginx

刪除包和它的配置文件

$ sudo apt-fast purge pkg
$ sudo apt-fast purge nginx

刪除所有未使用的包

$ sudo apt-fast autoremove

下載源碼包

$ sudo apt-fast source pkgNameHere

清理下載的文件

$ sudo apt-fast clean

清理舊的下載文件

$ sudo apt-fast autoclean

驗證沒有破壞的依賴

$ sudo apt-fast check

下載二進位包到當前目錄

$ sudo apt-fast download pkgNameHere
$ sudo apt-fast download nginx

示例輸出:

[#7bee0c 0B/0B CN:1 DL:0B]
07/26 15:35:42 [NOTICE] Verification finished successfully. file=/home/vivek/nginx_1.10.0-0ubuntu0.16.04.2_all.deb
07/26 15:35:42 [NOTICE] Download complete: /home/vivek/nginx_1.10.0-0ubuntu0.16.04.2_all.deb
Download Results:
gid   |stat|avg speed  |path/URI
======+====+===========+=======================================================
7bee0c|OK  |        n/a|/home/vivek/nginx_1.10.0-0ubuntu0.16.04.2_all.deb
Status Legend:
(OK):download completed.

下載並顯示指定包的 changelog

$ sudo apt-fast changelog pkgNameHere
$ sudo apt-fast changelog nginx

via: http://www.cyberciti.biz/faq/how-to-speed-up-apt-get-apt-command-ubuntu-linux/

作者:VIVEK GITE 譯者:geekpi 校對: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中國

    捐贈 Let's Encrypt,共建安全的互聯網

    隨著 Mozilla、蘋果和谷歌對沃通和 StartCom 這兩家 CA 公司處罰落定,很多使用這兩家 CA 所簽發證書的網站紛紛尋求新的證書籤發商。有一個非盈利組織可以為大家提供了免費、可靠和安全的 SSL 證書服務,這就是 Let's Encrypt 項目。現在,它需要您的幫助
    Linux中國

    關於Linux防火牆iptables的面試問答

    Nishita Agarwal是Tecmint的用戶,她將分享關於她剛剛經歷的一家公司(印度的一家私人公司Pune)的面試經驗。在面試中她被問及許多不同的問題,但她是iptables方面的專家,因此她想分享這些關於iptables的問題和相應的答案給那些以後可能會進行相關面試的人。 所有的問題和相應的答案都基於Nishita Agarwal的記憶並經過了重寫。 嗨,朋友!我叫Nishita Agarwal。我已經取得了理學學士學位,我的專業集中在UNIX和它的變種(BSD,Linux)。它們一直深深的吸引著我。我在存儲方面有1年多的經驗。我正在尋求職業上的變化,並將供職於印度的P
    Linux中國

    Lets Encrypt 已被所有主流瀏覽器所信任

    旨在讓每個網站都能使用 HTTPS 加密的非贏利組織 Lets Encrypt 已經得了 IdenTrust的交叉簽名,這意味著其證書現在已經可以被所有主流的瀏覽器所信任。從這個裡程碑事件開始,訪問者訪問使用了Lets Encrypt 證書的網站不再需要特別配置就可以得到 HTTPS 安全保護了。 Lets Encrypt 的兩個中級證書 ...