Introduction
Sometimes it may be necessary to replace a package provided by an old repository with the package provided by a new repository. This can happen after installing or uninstalling something (such as CloudLinux) that makes use of a different repository for existing packages on the server.
Procedure
To replace a single package, run the following command, where PACKAGE is replaced with the actual package name.
yum swap -- remove PACKAGE -- install PACKAGE
You can replace all packages from a repository using the following command where REPO is replaced with the repository name.
packages=$(yum list installed|grep @REPO|grep -v "^\s"|cut -d. -f1)
yum swap -- remove $packages -- install $packages
You can find out what repository a package is from by running the following command, where PACKAGE is replaced with the actual package name.
yum list installed|grep PACKAGE|awk '{print $NF}'
This can be done via SSH or the Terminal in WHM.