I was updating a slightly out of date server with
yum update and ran into memory issues. It appears that yum requires enough free RAM to download each package.
Updating single packages was not a problem, as most individual packages fit in memory by themselves. However, updating all packages in one operation was not possible, because yum appears to download all the packages into RAM first, at the same time. This meant that the first several dozen packages would download, but at some point they would stop downloading and every subsequent package would give memory errors, even though the individual packages were very small. The total download size was larger than the amount of free RAM even after stopping all services.
My solution was to go through manually and pick out the largest packages and update them first. This let me get the remaining packages to total less than the amount of free RAM. But there has to be a better way.
Why can't yum download each file individually and save them to disk? When updating large numbers of packages, the requirement that all the downloads must fit into RAM at the same time is kind of silly. It could download them to disk first, and then it would have more than enough RAM to install the individual packages. Updating all, if done properly, should use no more memory than updating the largest single package. In other terms, if three dependency-free packages need A, B, and C amounts of RAM to be updated, the memory usage of yum should be max(A,B,C) and NOT A+B+C.
Is there a way to do this, or is this just a shortcoming of yum?
Others have told me that
yum doesn't download to RAM. I'm not quite sure, then, why it only downloads packages until RAM is full and then stops. The download location for yum is not on a RAM disk, and there is plenty of free disk space. The question still remains.