Main Menu
Home
About
Archive
Woot Alarm
apt-fast
Zen Kernel
Downloads
Satellite
Dish Keys
SURGE
Links
Search
Search Bible
Feed Me!
 

 Subscribe

Add to Google

Add to Pageflakes

Subscribe in Bloglines

Add to My AOL



 







apt-fast and Axel: Roughly 26x Faster apt-get Installations and Upgrades
Monday, 02 June 2008
Updated 8/4/2010

You can find the latest version at http://www.mattparnell.com/linux/apt-fast/

The latest version will always be the one named "apt-fast.sh."
Since I last updated this post, I have started using Archlinux, whose package manager has a system in place that allows any download manager to be used, for example.

Current News:
I updated the "official" apt-fast.sh with permissions checking, and it runs sudo if you are not root, a contribution by Sergio Silva. I also added a thanks section in the script, which thanks people for submitting thier mods, which I have placed here. I really don't use apt-based distros enough anymore to combine them into one, into the main apt-fast script, but maybe someone who cares more can.

I'd suggest adding an option variable that can be set to axel or aria2c by manual edit, after which is what the script will use for downloading. The same could be done if the user chooses aria2c, allowing to choose a proxy or regular connection. A check to see if aria2c is installed would be needed like the one for axel - and have only one of those run depending on what the downloader variable is set to...

The other stuff shouldn't be hard to roll up into one, like the wonderful autocompletion and install script (though they may vary a bit between distros).

Thanks:

Travis/travisn000 - support for complex apt-get commands
Alan Hoffmeister - aria2c support
Abhishek Sharma - aria2c with proxy support
Richard Klien - Autocompletion, Download Size Checking (made for ubuntu, untested on other distros)
Sergio Silva - test to see if axel is installed, root detection/sudo autorun (in current mainline script)
Patrick Ruiz - Suggestions

About apt-fast:

The apt-fast script I have created is a little shellscript that increases the speed of apt-get by many times. You need to have the axel download accelerator installed, which is a simple, short process, but everything else is extremely straight forward. I started out downloading the upgrades for Kubuntu, at 32kb/s. Not terrible, but not that great. When I was done with the script here, I was getting up to ~850kb/s. That is great, huh?

To do this, you first need to download and install the axel download accelerator. It is really a good drop-in replacement for wget, as it is bash based. Once installed, we are ready to setup apt-fast. On K/Ubuntu apt-get install axel should do it.

Then, either find a package somewhere (or install it from a repo if one of them has it), or just download the latest apt-fast source from the link mentioned at the top of this post. Then, just place the script somewhere (/usr/bin or /usr/sbin is ideal), rename it to apt-fast (without the .sh extension), and sudo chmod +x apt-fast.

Once done, just use it like apt-get. To install a single package, make sure your database is up to date (apt-fast update), and run apt-fast install packagenamehere. Watch it download with incredible speed, and install your requested packages. To upgrade or dist-upgrade, do the same thing. Just use apt-fast dist-upgrade or apt-fast upgrade. That's all there is to it!

Should your download stall for any number of reasons, you'll need to do an apt-fast clean.

This is a fully opensource script, of course, so please improve upon it and modify it as you will. If you do something cool with it, or make a useful mod to the code, please pastebin it or put it in a forum somewhere and put a link in the comments below. I'll give you credit and add it to the script here on mattparnell.com.
Comments
Add New RSS
richard  - thank you   |59.41.222.xxx |2009-06-16 18:31:37
I found it this morning, it's fast, help me a lot, thank you very much.
Toby Hyanes  - Don't forget to check for nothing...   |199.246.40.xxx |2009-11-02 09:56:13
With apt-get upgrade/ apt-get dist-upgrade, it's possible that there is nothing
to do. You probably want to check the number of lines in debs.list and exit if
there are no URIs to process.
armand  - problem when unpacking and installing   |196.2.10.xxx |2009-11-04 07:46:36
That's a pretty good Idea but I think needs some improvement! I tried more than
once to get the job done with apt-fast , it downloads well but gives some errors
when unpacking and installing. I hope u will fix it
Matt Parnell  - I use Archlinux now...not ubuntu     |198.209.32.xxx |2009-11-04 15:34:56
I don't use ubuntu anymore...feel free to fix it yourself and post it here in
the comments if you'd like.
hyao  - thanks   |218.28.9.xxx |2009-11-10 07:51:35
very useful and thank you!
Michael  - Source code     |125.160.220.xxx |2010-03-06 00:40:11
Can i know where the source code is? Precious thank
Click     |78.36.131.xxx |2010-03-06 11:48:51
Super. tnx
Matt Parnell  - http://www.mattparnell.com/linux/apt-fast/     |96.15.147.xxx |2010-03-08 13:58:24
http://www.mattparnell.com/linux/apt-fast/ is where the source is. I said so in
the article.
snowy  - would like to see it do more     |123.2.14.xxx |2010-03-12 01:11:40
would like apt-fast to download every package at once
not separately
then i
could say download 20 downloads with 20 parts put together and not have to wait
for all the slow mirrors before all the downloads are done

plus i'd like to be
able to tell what apt-fast does for instance download 1-20 downloads @ 1-20
parts

the best way to show something like this is if you download a copy of
jdownloader and run it with java

id like to see if anyone could build this then
it might just lead to a package manager with java in mined that way apt-get
would be obsolite

the script you wrote replaced my apt-get in ubuntu 10.04
alpha 3
please downt forget that apt-get is old hat and that apt-fast is getting
soooo much better
cool sh by the way would like some work done on it so it can
and will beat any form of package managment on the planet

loved it but it could
be awsome
Matt Parnell  - If you want it, you do it.   |98.134.136.xxx |2010-03-14 13:46:13
I don't use apt based Linux anymore.

I use Archlinux because it's better, at
least in my opinion.

The script is opensource and I appreciate you enjoying it,
but I'm not really working on it anymore.

The PCLinuxOS guys have been the ones
updating it lately.

A gui would be unnecessary, by the way.
Salih Emin  - GUI is necessary     |109.178.169.xxx |2010-03-14 16:35:04
Its a great piece of script. So I've decided to integrate it in my piece of
software 2clickUpdate found at https://launchpad.net/2clickupdate

Its a GUI
script that speeds up the updating of the operating system and programs
installed without bothering you with
Ryan  - Automatic sudo   |24.152.165.xxx |2010-04-10 11:31:42
To have the script automatically sudo itself if you forget to do so, add the
following line at the beginning:

[ "`whoami`" = root ] || sudo
"$0" "$@"

Then if you run apt-fast as a normal user, it
will simply re-run itself with sudo.
Ryan  - Fixed auto-sudo   |24.152.165.xxx |2010-04-10 11:59:15
Oops! Here's the fixed line:

[ "`whoami`" = root ] || exec sudo
"$0" "$@"
Salih Emin  - 2clickUpdate has implemented Axel     |79.103.252.xxx |2010-04-14 06:32:37
As I mentiond in previous comment I was going to integrate axel in
2clickUpdate.

You can read full announcement at
http://cerebrux.comli.com/news/2clickupdate/2010/0
4/2click-update-v5-5-going-lightning-with-axel/

H ope it is usefull to you
people !
Jimmy Chan   |183.178.28.xxx |2010-04-25 01:18:05
First of all, thanks for the wonderful script, Matt.

I normally use the
"-s" flag to simulate the upgrade or install before actually doing so.
However, the current apt-fast doesn't understand this flag. So I replace the
line in the apt-fast script:

if echo "$@" | grep -q
"upgrade\|install\|dist-upgrade"; then

with this line:

if echo
"$@" | grep -v '\-s' | grep -q
"upgrade\|install\|dist-upgrade"; then

such that it will now
pass the "-s" flag to apt-get correctly.

I also add in my
~/.bash_aliases the following two lines. Now I can use apt-get in the old way
with apt-fast actually doing the work. The first line is necessary since apt-get
requires root privilege.

alias sudo='sudo '
alias apt-get='apt-fast'
RTEK1000  - Im brasilian congratulations!!! (eu sou brasileiro   |189.28.224.xxx |2010-06-04 18:29:42
Very good!!! (muito bom!!!)
RTEK1000  - opss brazilian...not brasilian   |189.28.224.xxx |2010-06-04 18:31:27
Spyzer  - Apt-fast with aria2c support   |210.212.48.xxx |2010-07-02 08:19:37
Hi Matt,
Since I am behind a proxy network with authentication, axel somehow
wasn't working for me and so i changed the script to support aria2c download
accelerator/manager (which ofcourse ran for me in my network). I have mailed u
the script, hope u find it to the best.

Bbye!!!
Vince  - Aptitude vs apt-get   |82.247.53.xxx |2010-07-26 16:36:36
aptitude seems better than apt-get
is it possible to update apt-fat to use
aptitude instead of apt-get ?
Write comment
Name:
Email:
 
Website:
Title:
 
:angry::0:confused::cheer:B):evil::silly::dry::lol::kiss::D:pinch:
:(:shock::X:side::):P:unsure::woohoo::huh::whistle:;):s
:!::?::idea::arrow:
 
Please input the anti-spam code that you can read in the image.

3.25 Copyright (C) 2007 Alain Georgette / Copyright (C) 2006 Frantisek Hliva. All rights reserved."

 

© Matt Parnell's Brain: Plugged In!