How do I speed up my apt-get or apt command to download packages from multiple repos on a Ubuntu Linux 16.04 or 14.04 LTS server or Ubuntu 17.04 desktop system? How do I use apt-fast command on a Debian Linux server?

You need to use apt-fast shell script wrapper. It should speed up apt-get command/apt command and aptitude command by downloading packages with multiple connections per package. All packages are downloaded simultaneously in parallel. It uses aria2c as default download accelerator.

Install software-properties-common for PPA

You need to install the following package in order to use PPA on Ubuntu server:
$ sudo apt-get install software-properties-common

Install apt-fast tool

Type the following command on Ubuntu Linux 14.04 and later versions:
$ sudo add-apt-repository ppa:saiarcot895/myppa
Sample outputs:

Fig.01: installing repository

Fig.01: installing repository

Update your repo:
$ sudo apt-get update
$ sudo apt update
Sample outputs:
Fig.02: refreshing repository

Fig.02: refreshing repository

Install apt-fast shell wrapper:
$ sudo apt-get -y install apt-fast
$ sudo apt -y install apt-fast
Sample outputs:

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:
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 xenial/universe amd64 libssh2-1 amd64 1.5.0-2 [70.3 kB]
Get:2 xenial/main amd64 apt-fast all 1.8.3~137+git7b72bb7-0ubuntu1~ppa3~xenial1 [34.4 kB]
Get:3 xenial/main amd64 libc-ares2 amd64 1.10.0-3 [33.9 kB]
Get:4 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

Configure apt-fast

You will be prompted as follows (a value between 5 and 16 must be entered):

Fig.03: Set maximum number of connections

Fig.03: Set maximum number of connections

Fig.04: Yes suppress apt-fast download confirmation

Fig.04: Yes suppress apt-fast download confirmation

You can edit settings directly too:
$ sudo vi /etc/apt-fast.conf

Please note that this tool is not for slow network connections; it is for fast network connections. If you have a slow connection to the Internet, you are not going to benefit by this tool.

A note about Ubuntu Linux version 17.04 “zesty” and Debian Linux

Type the following command to install the same on Ubuntu 17.04 or Debian Linux based system:
$ cd /tmp
$ wget
$ more vokNn
$ sudo bash vokNn

How do I use apt-fast command?

The syntax is:
apt-fast command
apt-fast [options] command

To retrieve new lists of packages using apt-fast

sudo apt-fast update

To perform an upgrade using apt-fast

sudo apt-fast upgrade
To perform distribution upgrade (release or force kernel upgrade), enter:
$ sudo apt-fast dist-upgrade

To install new packages

The syntax is:
sudo apt-fast install pkg
For example, install nginx package, enter:
$ sudo apt-fast install nginx
Sample outputs:

Fig.05: Install new packages

Fig.05: Install new packages

To remove packages

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

To remove packages and its config files too

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

To remove automatically all unused packages, enter:
$ sudo apt-fast autoremove

To Download source archives

$ sudo apt-fast source pkgNameHere

To erase downloaded archive files

$ sudo apt-fast clean
To erase old downloaded archive files
$ sudo apt-fast autoclean

To verify that there are no broken dependencies

$ sudo apt-fast check

To download the binary package into the current directory

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

Sample outputs:

[#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.

To download and display the changelog for the given package

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


🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 7 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
7 comments… add one
  • Andy F. Jul 26, 2016 @ 11:19

    Anyone test this with dsh?

  • dave taht Jul 26, 2016 @ 20:06

    While this is a good way to get a bit more performance, it is also a way to mess up your link for yourself and others, if you have “bufferbloat”. There are compelling congestion control related reasons as to why we limit the number of simultaneous open full rate tcp flows to bare minimums. In the original http 1.1 standard, it was 2 flows. In the case of doing apt-get system updates, which are a task that is usually not time critical, I imagine that more than 4 is actually counter productive.

  • faria Jul 26, 2016 @ 20:36

    This doesn’t work.

    A normal server reject more than 1 request from the same IP. So this is useless and doesn’t work

  • yuanli Jul 26, 2016 @ 23:43

    Thanks for the tip.
    BTW, the syntax for installing new packages should be
    “sudo apt-fast install pkg”

  • Denis Franco de Oliveira Mar 9, 2017 @ 2:32

    Remember you can disable the annoying “[NOTICE]” lines by putting “log-level=warn” at “~/.aria2/input.conf”

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum