Question

Is there a way to make a backup of package that will be change while yum update? For example when I do yum update lighttpd is there a way to backup and restore lighttpd if yum update will be unsuccessful or it will result in unsuspected errors or bugs?

Was it helpful?

Solution

If you're using RPM before 4.6.0 (it's removed in newer versions), you can use rpm --rollback mechanism like in this old tutorial or in a more complete article with some functionality explanation. The --rollback feature is an automatic solution that was removed since it isn't reliable.

You can have a manual solution, keeping a list of all the packages before the yum update and reinstall needed old rpms possibly using --oldpackage like rpm -Uvh --oldpackage foo-1-1.i386.rpm:

To get a list of all installed packages, sorted by installation time:

rpm -q -a --queryformat '%{INSTALLTIME} %{NAME}-%{VERSION}-%{RELEASE}\n' | sort -n 

(Source)

If you're using Fedora, here is an official guide to upgrade the system using the installer with an example of how to create a list of system current installed packages and how to restore most of old software after an upgrade.

If you want a generic approach to get a list of installed software (not only rpm based), you can follow this article as well.

OTHER TIPS

If you are using a repo. that keeps all old versions around, you can just do "yum downgrade lighttpd" (and with newer yum's "yum history undo"). If you aren't, then you can keep a local copy of the old rpm and use "yum downgrade lighttpd*.rpm" (although that is trickier). It's possible that some problems won't be fixed by this, but those should be very rare and downgrade is unlikely to change anything else as a side effect.

Very recently a plugin "yum-plugin-fs-snapshot" has been created, which will automatically take an FS snapshot (btrfs, or LVM) before doing an upgrade ... thus. you can then just rollback to the snapshot. This is a big change though, so I don't recommend it.

I use etckeeper to track changes of files under /etc. etckeeper puts /etc under version control (it supports multiple version control systems, including Git, Mercurial and Bazaar) and integrates with the package management systems of a number of Linux distros (APT, YUM, Pacman).

If something bad happens during an upgrade or so, I can rollback anything.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top