House Multi

Fedora - Blogger - Code Programming - Database - Design

Showing posts with label yum. Show all posts

YUM Remove Repo (Repository)


Quick guide, howto remove and disable YUM repo (repository). Yum command 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 root 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

Basic Yum Commands and how to use them

   

    Basic Yum Commands and how to use them

 

This is not an exhaustive list of all yum commands but it is a list of the basic/common/important ones. For a complete list see the yum man page.
   yum list [available|installed|extras|updates|obsoletes|all|recent] [pkgspec] 
This command lets you list packages in any repository enabled on your system or installed. It also lets you list specific types of packages as well as refine your list with a package specification of any of the package's name, arch, version, release, epoch.
   yum list
By default 'yum list' without any options will list all packages in all the repositories and all the packages installed on your system. Note: 'yum list all' and 'yum list' give the same output.
   yum list available
Lists all the packages available to be installed in any enabled repository on your system.
   yum list installed
This is equivalent to rpm -qa. It lists all the packages installed on the system.
   yum list extras
This command lists any installed package which no longer appears in any of your enabled repositories. Useful for finding packages which linger between upgrades or things installed not from a repo.
   yum list obsoletes
This command lists any obsoleting relationships between any available package and any installed package.
   yum list updates
This command lists any package in an enabled repository which is an update for any installed package.
   yum list recent
This command lists any package added to any enabled repository in the last seven(7) days.
   yum list pkgspec
This command allows you to refine your listing for particular packages.
Examples of pkgspecs:
      yum list zsh 
      yum list joe\* 
      yum list \*.i386 
      yum list dovecot-1.0.15 
   yum install/remove/update
....
   yum check-update
Exactly like yum list updates but returns an exit code of 100 if there are updates available. Handy for shell scripting.
   yum grouplist
   yum groupinfo
   yum groupinstall
   yum groupupdate
   yum groupremove
Please see the YumGroups page on this wiki for information about the above commands.
   yum info
This displays more information about any package installed or available. It takes the same arguments as yum list but it is best run with a specific package name or glob. Example:
     $ yum info yum
     Installed Packages
     Name       : yum
     Arch       : noarch
     Version    : 3.2.20
     Release    : 3.fc10
     Size       : 2.5 M
     Repo       : installed
     Summary    : RPM installer/updater
     URL        : http://yum.baseurl.org/
     License    : GPLv2+
     Description: Yum is a utility that can check for and automatically download and
                : install updated RPM packages. Dependencies are obtained and downloaded
                : automatically prompting the user as necessary.
  yum search
This allows you to search for information from the various metadata available about packages. It can accept multiple arguments. It will output the packages which match the most terms first followed by the next highest number of matches, etc. Specifically yum search looks at the following fields: name, summary, description, url. If you're searching for what package provides a certain command try yum provides instead.
Search example:
$ yum search python rsync ssh
========================= Matched: python, rsync, ssh ==========================
rdiff-backup.i386 : Convenient and transparent local/remote incremental
                  : mirror/backup

============================ Matched: python, rsync ============================
cobbler.noarch : Boot server configurator

============================= Matched: python, ssh =============================
denyhosts.noarch : A script to help thwart ssh server attacks
pexpect.noarch : Pure Python Expect-like module
python-paramiko.noarch : A SSH2 protocol library for python
python-twisted-conch.i386 : Twisted SSHv2 implementation

============================= Matched: rsync, ssh ==============================
duplicity.i386 : Encrypted bandwidth-efficient backup using rsync algorithm
pssh.noarch : Parallel SSH tools
   yum provides/yum whatprovides
This command searches for which packages provide the requested dependency of file. This also takes wildcards for files. Examples:
$ yum provides MTA
2:postfix-2.5.5-1.fc10.i386 : Postfix Mail Transport Agent
Matched from:
Other       : MTA

exim-4.69-7.fc10.i386 : The exim mail transfer agent
Matched from:
Other       : MTA

sendmail-8.14.3-1.fc10.i386 : A widely used Mail Transport Agent (MTA)
Matched from:
Other       : Provides-match: MTA


$ yum provides \*bin/ls
coreutils-6.12-17.fc10.i386 : The GNU core utilities: a set of tools commonly
                            : used in shell scripts
Matched from:
Filename    : /bin/ls

   yum shell
....
   yum makecache
Is used to download and make usable all the metadata for the currently enabled yum repos. This is useful if you want to make sure the cache is fully current with all metadata before continuing.
   yum clean
During its normal use yum creates a cache of metadata and packages. This cache can take up a lot of space. The yum clean command allows you to clean up these files. All the files yum clean will act on are normally stored in /var/cache/yum.
Example commands and what they do:
        yum clean packages
This cleans up any cached packages in any enabled repository cache directory.
        yum clean metadata
This cleans up any xml metadata that may have been cached from any enabled repository.
        yum clean dbcache
Yum will create or download some sqlite database files as part of its normal operation. This command clean up the cached copies of those from any enabled repository cache.
        yum clean all
Clean all cached files from any enabled repository. Useful to run from time to time to make sure there is nothing using unnecessary space.

YUM Autocomplete on Fedora, CentOS, Red Hat


This is quick tip, howto use Bash auto complete (autocomplete) with YUM (example) on Fedora, CentOS, Red Hat (RHEL).
Autocomplete feature is familiar to many who have used the Debian based Linux, like Debian and Ubuntu. For some reason, this feature is not automatically activated/installed on Red Hat -based Linux distros, like Fedora, CentOS and Red Hat (RHEL). Actually auto completion works with any Bash programs, but I think it’s very useful example with YUM and also with RPM.

1. Install bash-completion

1.1 Change to root

su -
## OR ##
sudo -i

1.2 Install bash-completion package with YUM

yum install bash-completion

1.3 Logout console

Then logout console or close command line and log back in.

2. Autocomplete usage

[TAB] = press tab/tabulator

2.1 YUM commands

Example 1
[root ~]$ yum in[TAB][TAB]
info     install
 
[root ~]$ yum ins[TAB]  ## and you get "yum install"
Example 2
[root ~]$ yum s[TAB][TAB]
search  shell
 
[root ~]$ yum se[TAB]  ## and you get "yum search"

2.2 YUM packages

Example 1
[root ~]$ yum install fire[TAB][TAB]
firebird-classic.i686      firebird.i686              firecontrol.i686
firebird-devel.i686        firebird-libfbembed.i686   firehol.noarch
firebird-doc.i686          firebird-superserver.i686  firewalk.i686
 
[root ~]$ yum install fireh[TAB]  ## and you get "yum install firehol.noarch"
Example 2
[root ~]$ yum remove ge[TAB][TAB]
gedit.i686           geoclue-devel.i686   geronimo-jms.noarch  gettext.i686
gegl.i686            geoclue.i686         geronimo-jta.noarch  gettext-libs.i686
genisoimage.i686     GeoIP.i686           gettext-devel.i686
 
[root ~]$ yum remove gen[TAB]  ## and you get "yum remove genisoimage.i686"