As subscribers to my YouTube channel know, I test a lot of Linux distributions. Typically, the first thing I do after installing a distro is running updates. This can be a very time-consuming affair, depending on both download speeds and the volume of packages to be downloaded and installed. Recently, I learned a method to substantially increase those update speeds…a method with which I’ll share with you today.

In Ubuntu (and Debian as well), apt and aptitude are the tools used to update and install packages. We’re going to install a tool called apt-fast, which is a shellscript wrapper for apt that speeds up downloading of packages. Using an internal tool called aria2, apt-fast can download portions of a file from multiple mirrors simultaneously, much like the way BitTorrent works. Apt-fast works on any Ubuntu or Debian-based distribution, so those running Linux Mint, Zorin, and many other distributions are covered.
To install apt-fast in Ubuntu-based distributions (14.04 and higher), open a terminal and add the following lines one at a time.

sudo add-apt-repository ppa:saiarcot895/myppa
sudo apt-get update
sudo apt-get install apt-fast

For Debian-based distros:

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

During installation, you’ll be asked to select a default package manager (I use apt-get) and the maximum number of mirrors used (I use five).
Once installed, apt-fast will need to be configured, and to do that you’ll need to know the fastest download mirrors for your location. The easiest method I’ve found for speed testing mirrors is a tool called netselect. Debian users will conveniently find it in the repos (sudo apt-get install netselect-apt), while Ubuntu users can download the .deb package from https://packages.debian.org/jessie/amd64/netselect/download.
To find the five fastes mirrors, Ubuntu users should open a terminal and add the following:

sudo netselect -v -s5 -t10 `wget -q -O- https://launchpad.net/ubuntu/+archivemirrors | grep -P -B8 “statusUP|statusSIX” | grep -o -P “(f|ht)tp.*\”” | tr ‘”\n’ ‘ ‘`

To find the fastest Debian Mirror:

sudo netselect-apt

Armed with this information, you can now edit the apt-fast.conf file, which is located at /etc/apt-fast.conf. You’ll need to edit the file with a text editor using elevated privileges (open a terminal and type “sudo gedit” if gedit is your text editor). Look for the following line (I found it at line 39 of the file):

#MIRRORS=( )

In between the parenthesis, add the addresses of the mirrors listed by netselect, separating the mirrors by a coma and space. Also, remove the pound (#) sign from in front of the word “MIRROR.” When finished, the line will look something like this:

MIRRORS=( ‘http://fr.archive.ubuntu.com/ubuntu,http://bouyguestelecom.ubuntu.lafibre.info/ubuntu,http://mirror.ovh.net/ubuntu,http://ubuntu-archive.mirrors.proxad.net/ubuntu’ )

Save the file, and apt-fast is configured and ready for use.

How to Use apt-fast

The command line usage of apt-fast is the same as apt-get. So, to perform a full update and upgrade, add the following lines to the terminal:

sudo apt-fast update
sudo apt-fast upgrade

To install a package:

sudo apt-fast packagename

So how much faster is apt-fast? Well, there’s a lot of variables involved, so its hard to say. For myself, I have a pretty good internet connection, and with apt-fast configured to use five mirrors, the speed increase was astounding. If you have a slower connection or lack multiple local mirrors, download gains might be minimal at best.

I hope this tutorial helps out the Ubuntu and Debian users out there.  Feel free to leave comments and questions below.