I've got a batch machines to update this week, but I'm not quite confident with our established procedure. It basically runs like so for each machine:
- Mount a shared directory particular to the OS version/bitness, ie:
mount -t cifs //server/share/rhel5.3-64/ /mnt/updates/
yum update --downloadonly --downloaddir=/mnt/updates/
yum update /mnt/updates/*.rpm
We use the mount to reduce the amount of network bandwidth we use up, but since each machine might have wildly different package sets installed there will be packages included in the 'update' command that are not even present on the system, as well as there being multiple older versions of certain packages.
Is this a problem? Will yum skip/remove any unnecessary/obsolete packages before applying the changes?
edit
After reading @aaron-copley's response I decided to do a bit of testing. I logged onto the server, mounted the share, ran yum update --downloadonly --downloaddir=/mnt/updates/
, unmounted the share, did a yum clean all
, remounted, and re-ran the command. Nothing downloaded. [yay]
I deleted an rpm, ran the command again, and only that one package downloaded. [also yay]
I mounted the share on another box running the same RHEL version, ran yum update --downloadonly --downloaddir=/mnt/updates/
, and even though it's marked 221 packages for download, it's only downloading the 30 that were not already in the share. [super yay]
As a bonus, yum also lists the packages that are already downloaded in bold.
Yum will only replace installed packages when used with
update
. You are correct though, you may not be downloading packages necessary for another system.What you could do, is use a tool like
mrepo
to build and maintain a local repository of all Red Hat errata. This system would be sync to RHN and maintain all packages on the local network. Each system then points to this host internally for updates to reduce WAN bandwidth consumption. You also wouldn't have to mess with mounts, you could use Yum over HTTP.mrepo: Yum/Apt repository mirroring (fka yam)
Yum only install newer version of packages. You could use
createrepo
package for creating repository with updates and fill config file /etc/yum.repos.d/company-updates.repo with content:The procedure simplifies:
Btw, next step to optimize is to use autofs with cifs for automount /mnt/updates/ when a yum attempts to access this folder.