GIT – Delete / Remove Old Kernels on Fedora, CentOS, Red Hat (RHEL) , YUM Remove Repo (Repository) – YUM Repo (Repository), YUM Query Available Packages From Specific Repository on Fedora, CentOS, Red Hat.

A. YUM Delete / Remove Old Kernels on Fedora, CentOS, Red Hat (RHEL)

This is quick guide howto delete/remove/clean old kernels on Fedora, CentOS, Red Hat (RHEL). I use here two as example, if you want to keep other more or less, then adjust amount of installed kernels as you wish. Normally reason why you maybe want remove kernels is limited space, example on VPS servers and laptop. This is very easy task, you need yum-utils package.

1. Check Installed Kernels

 -q kernel
kernel-2.6.32-279.el6.x86_64
kernel-2.6.32-279.2.1.el6.x86_64
kernel-2.6.32-279.5.2.el6.x86_64
kernel-2.6.32-279.9.1.el6.x86_64

2. Delete / Remove Old Kernels

##  yum utils ##
yum  yum-utils

## Package-cleanup set count as how many old kernels you want left ##
package-cleanup --oldkernels --count=2

3. Make Amount of Installed Kernels Permanent

Edit /etc/yum.conf and set installonly_limit:

installonly_limit=2

B. YUM Remove Repo (Repository) – YUM Disable Repo (Repository)

Quick guide, howto remove and disable YUM repo (repository). Yum itself does not contain any way to remove the repository. YUM repo files is located in /etc/yum.repos.d/ directory.

I use kde.repo file with following content as example on this guide:

[kde]
name=kde
mirrorlist=http://apt.kde-redhat.org/apt/kde-redhat/fedora/mirrors-stable
gpgkey=http://apt.kde-redhat.org/apt/kde-redhat/kde-redhat.RPM-GPG-KEY
enabled=1

Remove YUM Repo (Repository) Permanently

Before moving repository permanently is a good idea to check that is the repository installed using rpm package. As many repos usually are, like RPM-Fusion, Livna, etc.

Search Repository RPM-package with following command:

rpm -qa |grep -i repo-name

Example:

rpm -qa |grep -i rpmfusion
rpmfusion-nonfree-release-13-2.noarch
rpmfusion-free-release-13-2.noarch

## OR ##

rpm -qa |grep -i livna
livna-release-1-1.noarch

If RPM-package found then simply remove whole RPM-package with following command:

rpm -e some-repository-rpm-package

Example:

rpm -e livna-release-1-1.noarch

If RPM-package not found then simply remove repo file with following command:

rm /etc/yum.repos.d/repo-file.repo

## OR just rename it (without repo file extension) ##
mv /etc/yum.repos.d/repo-file.repo /etc/yum.repos.d/repo-file.repo.bak

Example:

rm /etc/yum.repos.d/kde.repo

## OR just rename it (without repo file extension) ##
mv /etc/yum.repos.d/kde.repo /etc/yum.repos.d/kde.repo.bak

Disable YUM Repo (Repository)

Disable YUM Repo

Edit repo file on /etc/yum.repos.d/ as and change enabled to 0

## Change
enabled=1

## To
enabled=0

Example:

# Change
[kde]
name=kde
mirrorlist=http://apt.kde-redhat.org/apt/kde-redhat/fedora/mirrors-stable
gpgkey=http://apt.kde-redhat.org/apt/kde-redhat/kde-redhat.RPM-GPG-KEY
enabled=1

# To
[kde]
name=kde
mirrorlist=http://apt.kde-redhat.org/apt/kde-redhat/fedora/mirrors-stable
gpgkey=http://apt.kde-redhat.org/apt/kde-redhat/kde-redhat.RPM-GPG-KEY
enabled=0

Enable disabled repo quickly with YUM:

yum --enablerepo=some-disabled-repository install some-package

Disable YUM Repo (Repository) using YUM

yum --disablerepo=some-repository install some-package

Example:

yum --disablerepo=kde install some-package

C. YUM Query Available Packages From Specific Repository on Fedora, CentOS, Red Hat

This is a quick tip, howto find, query and list all available packages from a specific Yum repository/repositories on Fedora, CentOS, Red Hat (RHEL). This trick does not show the already installed packages from selected repository.

List All Repositories and Check Repository ID’s

 

$ yum repolist
Loaded plugins: dellsysidplugin2, refresh-packagekit
repo id                                                      repo name                                                                        status         
adobe-linux-i386                                             Adobe Systems Incorporated                                                       enabled:     17
fedora                                                       Fedora 12 - i386                                                                 enabled: 15,366
google                                                       Google - i386                                                                    enabled:      4
livna                                                        rpm.livna.org for 12 - i386                                                      enabled:      3
rpmfusion-free                                               RPM Fusion for Fedora 12 - Free                                                  enabled:    383
rpmfusion-free-updates                                       RPM Fusion for Fedora 12 - Free - Updates                                        enabled:    551
rpmfusion-nonfree                                            RPM Fusion for Fedora 12 - Nonfree                                               enabled:    124
rpmfusion-nonfree-updates                                    RPM Fusion for Fedora 12 - Nonfree - Updates                                     enabled:    228
updates                                                      Fedora 12 - i386 - Updates                                                       enabled:  4,587
repolist: 21,263

Query Available Packages From Selected YUM Repository

Disable all repositories and then enable just selected repo.

$ yum --disablerepo="*" --enablerepo="google" list available
Loaded plugins: dellsysidplugin2, refresh-packagekit
Available Packages
google-chrome-beta.i386                                                          5.0.307.9-39052                                                       google
google-chrome-unstable.i386                                                      5.0.322.2-38810                                                       google
google-desktop-linux.i386                                                        1.2.0-0088                                                            google
picasa.i386
Print Friendly

Comments

comments

Bài viết liên quan