This is the sequel of our previous article titled "how to install packages from a specific repository". As the title says, this guide describes how to remove installed packages from a specific repository from command line in Linux operating systems. In GUI mode, we could do this with couple mouse clicks. Since I mostly prefer CLI mode, I have given the instructions only for CLI mode. Read on.
Remove Installed Packages From A Specific Repository
On RHEL, CentOS, Scientific Linux:
In YUM-based systems such as Red Hat and its clones like CentOS and Scientific Linux, we can remove installed packages from a specific repository using command as root user:
$ yum remove $(yum list installed | grep epel | awk '{ print $1 }')
Sample output:
Loaded plugins: fastestmirror Resolving Dependencies --> Running transaction check ---> Package dnf.noarch 0:0.6.4-2.el7 will be erased ---> Package dnf-conf.noarch 0:0.6.4-2.el7 will be erased ---> Package dnf-plugins-core.noarch 0:0.1.5-3.el7 will be erased ---> Package epel-release.noarch 0:7-9 will be erased ---> Package libcomps.x86_64 0:0.1.6-13.el7 will be erased ---> Package python-dnf.noarch 0:0.6.4-2.el7 will be erased ---> Package python-libcomps.x86_64 0:0.1.6-13.el7 will be erased --> Finished Dependency Resolution Dependencies Resolved ========================================================================================== Package Arch Version Repository Size ========================================================================================== Removing: dnf noarch 0.6.4-2.el7 @epel 652 k dnf-conf noarch 0.6.4-2.el7 @epel 29 k dnf-plugins-core noarch 0.1.5-3.el7 @epel 167 k epel-release noarch 7-9 @epel 24 k libcomps x86_64 0.1.6-13.el7 @epel 202 k python-dnf noarch 0.6.4-2.el7 @epel 1.8 M python-libcomps x86_64 0.1.6-13.el7 @epel 140 k Transaction Summary ========================================================================================== Remove 7 Packages Installed size: 3.0 M Is this ok [y/N]:
The above command will remove all installed packages from EPEL repository along with all dependencies. And also, it will remove the EPEL repository itself.
If you want to remove the packages only, not the dependencies, enter the following command as root user:
$ rpm -e --nodeps `yum list installed | grep epel | awk '{ print $1 }'`
Please be mindful that the above command will not ask any confirmation while removing the packages.
On Fedora:
In Fedora, you can uninstall all packages from a specific repository using the following command as root user:
# dnf repository-packages <repo-id> remove
Example:
# dnf repository-packages zyga-snapcore remove
Sample output:
Last metadata expiration check: 0:05:43 ago on Fri Jun 23 15:37:20 2017. Dependencies resolved. ========================================================================================== Package Arch Version Repository Size ========================================================================================== Removing: lz4 i686 r131-1.fc23 @fedora 322 k snap-confine i686 1.0.40-1.fc23 @updates 80 k snapd i686 2.14-1.fc23 @zyga-snapcore 17 M squashfs-tools i686 4.3-11.fc23 @fedora 405 k Transaction Summary ========================================================================================== Remove 4 Packages Installed size: 18 M Is this ok [y/N]:
Here, zyga-snapcore is the repo id of Copr repository for snapcore owned by zyga.
The above command will remove dependencies installed from other repositories as well. If you want to remove only the packages, not the dependencies, just run:
$ sudo rpm -e --nodeps `dnf list installed | grep zyga-snapcore | awk '{ print $1 }'`
To find out the repository ID, run:
$ dnf repolist
Sample output from Fedora system:
Last metadata expiration check: 0:07:39 ago on Fri Jun 23 15:37:20 2017. repo id repo name status *fedora Fedora 23 - i386 38,811 *updates Fedora 23 - i386 - Updates 18,174 zyga-snapcore Copr repo for snapcore owned by zyga 11
Read the following guide to find out the repository ID in various Linux distributions.
And, that's all. Hope this was useful.
Thanks for stopping by!
Help us to help you:
- Subscribe to our Email Newsletter : Sign Up Now
- Support OSTechNix : Donate Via PayPal
- Download free E-Books and Videos : OSTechNix on TradePub
- Connect with us: Reddit | Facebook | Twitter | LinkedIn | RSS feeds
Have a Good day!!