October 13, 2011

Limiting download speeds in Apt in Ubuntu

While trying to download some software on Ubuntu at work I thought I needed to limit the speed apt downloads files so that I don’t eat my peers bandwidth. So I started searching around using Google (of course) and came across various thread which suggested using trickle and wondersharper for usermode bandwidth shaping. But then I hit upon this brilliant post which showed how you can setup apt-get to download speed as a configuration. Here is what you need to do.

Create a file named 76download in /etc/apt/apt.conf.d/ and add this to it :

  Queue-mode "access";
    Dl-Limit "65";
The Dl-Limit value specifies your download speed in kbps.
Try it out :-)
Original source with some more info : http://linux.derkeiler.com/Mailing-Lists/Debian/2008-02/msg01872.html