Download limit on YUM / Apt-get

I have seen in many servers yum or apt-get use to hammers all the internet bandwidth connections making other service connections to crawl (for example httpd, ftp). Some times if you are upgrading the OS or installation large dependency sized packages it is possible to restrict the amount of bandwidth(throttling) used to download packages.

 

On yum just edit the /etc/yum.conf and add the following lines(for example if you want to limit the speed to 150 Kilobytes).

 

  • # throttle 150k

 

This will set a maximum download speed of 150 kilobytes per second (remember that this is in kilobytes (k) or megabytes (M))

 

Edit the Dl-Limit (download limit) to setup the rate limit to 150 Kilobytes for apt-get

 

  • # apt-get install “package” -o Acquire::http::Dl-Limit=150 \
    -o Acquire::Queue-mode=access

 

Replace the “package” name with the exact package name.