I'm sure many of you miss an option to limit the donwload-rate in apt-get, it's quite useful if you share bandwidth, ... so I decided to write a mini-HOWTO about it.
Download bandwidth limiting can be accomplished using trickle (an user-space bandwidth shaper) with the http and ftp file retrieval "plug-ins" of apt.
First of all you have to install trickle, then you have to make apt-get use trickle for downloads, for example with the http method :
dpkg-divert --local --rename /usr/lib/apt/methods/http
echo '#!/bin/sh' > /usr/lib/apt/methods/http
echo '/usr/bin/trickle -s -d 25 /usr/lib/apt/methods/http.distrib' >> usr/lib/apt/methods/http
chmod 755 /usr/lib/apt/methods/http
Repeat this process for the ftp method (if you have any ftp repository) replacing http for ftp.
The "-d 25" sets the rate-limit to 25KB/s. You may want to remove the -s/-d switches and configure trickled.
If you want to remove it:
dpkg-divert --local --remove /usr/lib/apt/methods/http