Yum Command Deep Dive (Self, Update)

1. You can have multiple yum repositories. Under the directory /etc/yum.repos.d/, there are multiple files ending with *.repo, or they can be integrated into a single file (but I think separate files are better—you can choose which file to use for updates, and you can see the source of software packages from the yum update command).
2. Installing a yum repository: rpm -ivh *.noarch.rpm, etc. After completion, a repository file is generated.
 
 

  What is yum? (To be honest, I still don’t know how to pronounce this word. Secretly, I pronounce it “yun”.)
yum = Yellow dog Updater, Modified. Its main function is to make adding/removing/updating RPM packages more convenient. It can automatically resolve package dependency issues and easily manage updates for a large number of systems. Why use yum instead of apt? The simplest reason: it comes with Fedora!

yum Features

  • * Can configure multiple repositories simultaneously
    * Simple configuration file (/etc/yum.conf)
    * Automatically resolves dependency issues when adding or removing RPM packages
    * Easy to use
    * Maintains consistency with the RPM database

yum Installation, haha, it comes with Fedora!
#rpm -ivh yum-2.0.4-2.noarch.rpm

IV. yum Configuration
Note: Modify and add repositories in the configuration file to speed up downloads and have more updatable RPM packages available.
Replace the entire content of /etc/yum.conf with
[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=fedora-release
tolerant=1
exactarch=1

[fedora-us-1]
name=Fedora Core 1 — Fedora US mirror
baseurl=ftp://mirrors.kernel.org/fedora.us/fedora/fedora/1/i386/yum/os

[fedora-us-1-updates]
name=Fedora Core 1 updates — Fedora US mirror
baseurl=ftp://mirrors.kernel.org/fedora.us/fedora/fedora/1/i386/yum/updates

[fedora-us-1-stable]
name=Fedora Linux (stable) for Fedora Core 1 — Fedora US mirror
baseurl=ftp://mirrors.kernel.org/fedora.us/fedora/fedora/1/i386/yum/stable

[freshrpms]
name=Fedora Linux $releasever – $basearch – freshrpms
baseurl=http://ayo.freshrpms.net/fedora/linux/$releasever/$basearch/freshrpms

V. yum Usage
Note: When using yum for the first time or when the yum repository is updated, yum will automatically download all required headers and place them in the /var/cache/yum directory. This process may take some time.

Check which RPM packages are available for update
#yum check-update

Install an RPM package, enabling xmms to play mp3
#yum install xmms-mp3

Install mplayer, automatically installing related software at the same time
#yum install mplayer

Remove the licq package, along with packages that depend on it
#yum remove licq
Note: It will also prompt to remove licq-gnome, licq-qt, licq-text, which is very convenient.

System update (updates all upgradable RPM packages, including the kernel)
#yum -y update

Schedule daily automatic system updates
#chkconfig yum on
#service yum start

VI. Detailed yum Commands
*Updating RPM packages

Check for updatable RPM packages
#yum check-update

Update all RPM packages
#yum update

Update specific RPM packages, such as updating kernel and kernel source
#yum update kernel kernel-source

Large-scale version upgrade; unlike yum update, this also upgrades old, obsolete packages
#yum upgrade

*Installing and removing RPM packages

Install an RPM package, like xmms-mp3
#yum install xmms-mp3

Remove an RPM package, including packages that depend on it
#yum remove licq
Note: It will also prompt to remove licq-gnome, licq-qt, licq-text

*Parameters related to the yum cache (/var/cache/yum/)
Clear cached RPM package files
#yum clean packages

Clear cached RPM header files
#yum clean headers

Clear old cached RPM header files
#yum clean oldheaders

Clear old cached RPM header files and package files
#yum clean or #yum clean all
Note: Equivalent to yum clean packages + yum clean oldheaders

*Listing RPM packages

List all RPM packages in the repository that can be installed or updated
#yum list

List specific RPM packages in the repository that can be installed, updated, or are already installed
#yum list mozilla
#yum list mozilla*
Note: You can use wildcards in the RPM package name, such as listing all RPM packages starting with mozilla

List all RPM packages in the repository that can be updated
#yum list updates

List all installed RPM packages
#yum list installed

List installed RPM packages that are not included in the repository
#yum list extras
Note: RPM packages downloaded and installed from other sites

*Displaying RPM package information (info parameter is similar to list)

List information for all RPM packages in the repository that can be installed or updated
#yum info

List information for specific RPM packages in the repository that can be installed, updated, or are already installed
#yum info mozilla
#yum info mozilla*
Note: You can use wildcards in the RPM package name, such as listing info for all RPM packages starting with mozilla

List information for all RPM packages in the repository that can be updated
#yum info updates

List information for all installed RPM packages
#yum info installed

List information for installed RPM packages that are not included in the repository
#yum info extras
Note: Information for RPM packages downloaded and installed from other sites

*Searching for RPM packages
Search for RPM packages matching specific characters
#yum search mozilla
Note: Searches in RPM package name, package description, etc.

Search for RPM packages containing a specific file name
#yum provides realplay

VII. Securely Updating RPM Packages from freshrpms.net
Install the freshrpms.net GPG key
#rpm –import http://freshrpms.net/packages/RPM-GPG-KEY.txt

Edit /etc/yum.conf and add the following information to the end
[freshrpms]
name=Fedora Linux $releasever – $basearch – freshrpms
baseurl=http://ayo.freshrpms.net/fedora/linux/$releasever/$basearch/freshrpms
gpgcheck=1

Note:
Check GPG Key
# rpm -qa gpg-pubkey*

Display Key information
#rpm -qi gpg-pubkey-e42d547b-3960bdf1

Delete Key
#rpm -e gpg-pubkey-e42d547b-3960bdf1

 

Leave a Comment

Your email address will not be published.