Ask Your Question
2

How to make yum consume less traffic

asked 2013-09-07 02:25:47 -0500

dfr gravatar image

updated 2013-09-07 21:05:19 -0500

FranciscoD_ gravatar image

Every time i want to install something or just query some packages it downloads updates/primary_db which weights about 10! Mbytes. Ok, it's not every time but on every boot it downloads it again when i run yum. Is there way to make it not download it or at least download it less often ?

edit retag flag offensive close merge delete

3 Answers

Sort by ยป oldest newest most voted
5

answered 2013-09-07 03:38:46 -0500

jamielinux gravatar image

updated 2013-09-07 03:44:37 -0500

The files that are being downloaded by yum are known as metadata and are essential for yum to function.

The simplest option for you would be to use the --cacheonly or -C (upper-case) option when querying yum, which prevents yum from downloading any metadata, packages or anything else. For example:

yum -C search browser

If you are installing a package that hasn't already been downloaded into the yum cache, you can't use the option above (because yum will complain that the package is not available). You could instead increase the amount of time that yum will wait before updating the metadata. See man yum.conf for the metadata_expire option. The default is 6 hours. You can set this to a higher value, for example 2 days:

metadata_expire=2d
edit flag offensive delete link more
1

answered 2013-09-07 03:43:11 -0500

ztank1013 gravatar image

Actually it is quite easy, just edit /etc/yum.conf file and add a line like this:

throttle=100k

or this:

throttle=10%

for full details on throttle and bandwidth parameters for yum, from a terminal window, run the command:

man yum.conf

this is an excerpt from it

throttle

Enable bandwidth throttling for downloads. This option
can be expressed as a absolute data rate  in  bytes/sec.  An  SI
prefix  (k,  M or G) may be appended to the bandwidth value (eg.
`5.5k' is 5.5 kilobytes/sec, `2M' is 2 Megabytes/sec).
Alternatively, this option can specify the percentage  of  total
bandwidth  to use (eg. `60%'). In this case the bandwidth option
should be used to specify the maximum available bandwidth.
Set to `0' to disable bandwidth throttling. This is the default.

bandwidth

Use to specify the maximum available network bandwidth
in  bytes/second.   Used  with  the  throttle option (above). If
throttle is a percentage and bandwidth  is  `0'  then  bandwidth
throttling  will be disabled. If throttle is expressed as a data
rate (bytes/sec) then this option is ignored. Default is `0' (no
bandwidth throttling).
edit flag offensive delete link more

Comments

@jamielinux Hey! I accept to be down voted but please add a comment to let me understand what is your point! ;)

ztank1013 gravatar imageztank1013 ( 2013-09-07 03:56:00 -0500 )edit

@ztank1013 Sorry! Your answer was actually a good answer, but for a different question. So that's why I downvoted.

jamielinux gravatar imagejamielinux ( 2013-09-07 05:30:21 -0500 )edit

So, this will just make it download the same thing, but slower, correct ? I not sure if this is useful, same amount of traffic will be still consumed isn't it ?

dfr gravatar imagedfr ( 2013-09-07 06:00:32 -0500 )edit

@dfr Yes, same amount of traffic but less congestion...

ztank1013 gravatar imageztank1013 ( 2013-09-07 08:10:31 -0500 )edit

This may not answer the original question directly, but the information is still very useful to someone in a limited bandwidth situation. +1 for addressing needs beyond what was explicitly asked for, and providing insight related to the root problem.

randomuser gravatar imagerandomuser ( 2013-09-08 00:10:16 -0500 )edit
1

answered 2013-09-07 03:33:11 -0500

sunset06 gravatar image

If you are behind a firewall and happy to not be informed of the most recent updates, you can modify yum's metadata_expire= config so that new metadata will only be downloaded if more than this time has passed.

I think the default might be 90m (minutes). Because I am currently on an expensive mobile 3G network, and don't like to wait, I set mine to 13d (days):

  gedit /etc/yum.conf:
in section [main]:
metadata_expire=13d
edit flag offensive delete link more

Question Tools

Stats

Asked: 2013-09-07 02:25:47 -0500

Seen: 887 times

Last updated: Sep 07 '13