Linux – Remove installed packages from one repo and reinstall from CentOS

centoslinuxrpm

I have 62 packages from RPMfusion that have overridden the CentOS upstream packages, and now I would like to return to the original CentOS packages.

The only idea I can think of is

BAD_PACKAGES="name1 name2 ..."
echo $BAD_PACKAGES |xargs rpm -e --nodeps
echo $BAD_PACKAGES |xargs yum install

But that would leave the system in a broken state during the process.

Question

What is the safest way to have those packages removed and then reinstalled from CentOS's repo?

Best Answer

You can upgrade to older version by using --oldpackage option of rpm:

rpm -Uvh --oldpackage package-a.1.23.rpm

This is much safer than rpm -e --nodeps. You can upgrade several packages in one command so there will be no broken dependencies.