If you feel that package installation by apt-get or aptitude is often too slow on your Debian or Ubuntu system, there are several ways to improve the situation. Have you considered switching default mirror sites being used? Have you checked the upstream bandwidth of your Internet connection to see if that is the bottleneck?
Nothing else, you can try this third option: use apt-fast tool. apt-fast is actually a shell script wrapper written around apt-get and aptitude, which can accelerate package download speed. Internally, apt-fast uses aria2 download utility which can download a file in "chunked" forms from multiple mirrors simultaneously (like in BitTorrent download).
Install apt-fast on Debian or Ubuntu
Here are the steps to install apt-fast on Debian-based Linux.
Debian
$ 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 and higher
$ sudo apt-get update
$ sudo apt-get install apt-fast
Ubuntu 11.04 to 13.10
$ sudo apt-get update
$ sudo apt-get install apt-fast
During installation on Ubuntu, you will be asked to choose a default package manager (e.g., apt-get, aptitude), and other settings. You can always change the settings later by editing a configuration file /etc/apt-fast.conf.
Configure apt-fast
After installation, you need to configure a list of mirrors used by apt-fast in /etc/apt-fast.conf.
You can find a list of Debian/Ubuntu mirrors to choose from at the following URLs.
After choosing mirrors which are geographically close to your location, add those chosen mirrors to /etc/apt-fast.conf in the following format.
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/')
As shown above, individual mirrors for a particular archive should be separated by commas. It is recommended that you include the default mirror site specified in /etc/apt/sources.list in the MIRRORS string.
Install a Package with apt-fast
Now you are ready to test the power of apt-fast. Here is the command-line usage of 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 }
To install a package with apt-fast:
To download a package in the current directory without installing it:
As mentioned earlier, parallel downloading of apt-fast is done by aria2. You can verify parallel downloads from multiple mirrors as follows.
Note that apt-fast does not make "apt-get update" faster. Parallel downloading gets triggered only for "install", "upgrade", "dist-upgrade" and "build-dep" operations. For other operations, apt-fast simply falls back to the default package manager apt-get or aptitude.
How Fast is apt-fast?
To compare apt-fast and apt-get, I tried installing several packages using two methods on two identical Ubuntu instances. The following graph shows total package installation time (in seconds).
As you can see, apt-fast is substantially faster (e.g., 3--4 times faster) than apt-get, especially when a bulky package is installed.
Be aware that performance improvement will of course vary, depending on your upstream Internet connectivity. In my case, I had ample spare bandwidth to leverage in my upstream connection, and that's why I see dramatic improvement by using parallel download.
Subscribe to Xmodulo
Do you want to receive Linux FAQs, detailed tutorials and tips published at Xmodulo? Enter your email address below, and we will deliver our Linux posts straight to your email box, for free. Delivery powered by Google Feedburner.
Support Xmodulo
Did you find this tutorial helpful? Then please be generous and support Xmodulo!









Subscribe to Xmodulo
Support Xmodulo
Even by itself, apt-get is still a heck of a lot faster than yum.
pacman is still better.
I guess it's hard to be positive if it ain't Arch. :(
"pacman is still better."
that's funny. i had a good laugh, thanks arch guys!
agreed but i gave up on arch since nvidia optimus (bumblebee) stopped working.
btw is there any encrypted debian repo? my problem is not with speed but network
A long time ago, I opened a feature request bug report for what "apt-fast" does.
/etc/apt/sources.list can be populated with multiple archives, added by hand after using apt-spy to find the nearest/fastest archives. So long as "ftp.debian.org" is the last entry in the sources.list, it will be used only if the other archives haven't updated to the latest package yet. Otherwise, apt will use the first entry in the list that has the package available.
This also works with different archives, such as deb-multimedia.org, where packages are unique to the archive. Apt will launch as many downloads in parallel as their are unique packages available on different archives. So one will be pulling from the top of my sources.list entries, and one from deb-multimedia.org, and one from the google chrome archive.
But if I'm running an update that wants to download, say, 30 packages, and all 30 have been replicated amongst the 5 main-stream Debian archive entries in my sources.list. Apt now will launch only one download at a time, pulling all 30 packages from the same archive, the first one on my list.
Effectively, apt _ignores_ duplicate entries.
What I wanted in my feature request was for apt to pull from all 5 "duplicate" entries at once. Not what aria is doing, pulling pieces of the same package from different places, just distribute the downloading of different packages from duplicate archive sites.
So of those 30 packages in my example, the first 5 of those packages will be pulled in parallel, one from each of the 5 entries in sources.list. When one completes, the next package that is desired will be pulled from that archive, and so on until all 30 are retrieved.
One of those 5 archives might provide only one big package, while another might provide a dozen smaller packages, but regardless the bottleneck becomes my own download speed and the load for file serving is distributed amongst the servers.
This uses no new configuration what so ever. Apt already keeps records of what files are available in what archive in sources.list.
Thanks for listening.
I'm still stuck in RPM hell ( yum & zypper ).
I've tried Apt for RPM on Suse and Redhat, but it's horribly unstable. :(
I tried this, but didn't help me get stuff even 1 bit/s faster...
Perhaps because my connection is 1 Mbit/s (up from 284 Kbit/s a couple months ago) with no problems maxing out on good old aptitude/apt-get. Until 2 years ago I had a 50 Mbit/s connection. Patience can be learned rather quickly ;)
Try iftop to see if aptitude/apt-get really maxes out your connection. If not, then maybe there's still room for improvement in the mirror sites you chosen.
apt-fast.config file is read-only. how to save the changes made in the MIRRORS?
I'm a beginner, so any comment is most welcome.
$ sudo chmod +w /path/to/file
apt speeds up more if you look in your /etc/apt/sources.list.d/ folder, and take all the 1 line repos, comment them out, and put them in your main /etc/apt/sources.list file.
Yum might be slower when installing stuff. However updates with yum are many times faster than with apt due to deltarpms. :)
The true way to speed up a massive use of apt-get is:
# mount / -o remount,nobarrier
And revert the flag back after.
The real bottleneck of apt-get aren't in download but in the several fsync(s) it does during packages install.
That's AWESOME! Downloading and installing, both work in turbo speed! You should get Nobel for that :D
Wow! This is absolutely amazing ... I just did an apt-get upgrade with apt-fast configured, and the download time was literally just a few seconds, including a kernel update =)