Linux: detailed usage of Yum (Add/delete/update RPM package)

Source: Internet
Author: User
Tags gpg
Document directory
  • RPM package update
  • Installation and deletion of RPM packages
  • Parameters related to Yum temporary storage (/var/Cache/Yum /)
  • Package list
  • RPM package information display (the info parameter is the same as the list)
  • Search for RPM packages

 

What is yum?
  • Yum = yellow dog Updater, modified
  • The main function is to conveniently Add/delete/update RPM packages.
  • It automatically solves the dependency problem of the package.
  • It facilitates management of a large number of system update Problems
Yum features
  • Multiple resource libraries can be configured simultaneously (repository)
  • Simple configuration file (/etc/yum. conf
  • Automatically solves the dependency problem when RPM packages are added or deleted.
  • Easy to use
  • Maintain consistency with the RPM Database
Install yum
  • Built-in centos (Yum-*. noarch. rpm)
#rpm -ivh yum-*.noarch.rpm
  • Before you enable yum for the first time, you first need to import the system's RPM-GPG-KEY:
#rpm --import /usr/share/doc/centos-release-3(4)/RPM-GPG-KEY-CentOS-3(4)
Yum command
  • Note: When the yum or yum resource library is updated for the first time, yum will automatically download all the required headers and place them in the/var/Cache/Yum Directory, which may take a long time.
RPM package update
  • Check the updatable RPM package
#yum check-update
  • Update all RPM packages
#yum update
  • Update the specified RPM package, such as updating the kernel and kernel source
#yum update kernel kernel-source
  • For large-scale version upgrades, unlike Yum update, the old obsolete package is also upgraded.
#yum upgrade
Installation and deletion of RPM packages
  • Install RPM packages like xmms-mp3
#yum install xmms-mp3
  • Delete an RPM package, including packages that depend on the package
#yum remove licq
  • Note: You will also be prompted to delete licq-gnome, licq-QT, and licq-text.
Parameters related to Yum temporary storage (/var/Cache/Yum /)
  • Clear temporary RPM package files
#yum clean packages
  • Clear temporary RPM header files
#yum clearn headers
  • Clear the existing RPM header file
#yum clean oldheaders
  • Clear existing RPM header files and package files
# Yum clearn or # Yum clearn all
  • Note: equivalent to Yum clean packages + Yum clean oldheaders
Package list
  • List all RPM packages that can be installed or updated in the resource library
#yum list
  • List specific rpm packages that can be installed, updated, and installed in the resource library
#yum list mozilla
#yum list mozilla*
  • Note: Match characters can be used in RPM package names, for example, to list all RPM packages starting with Mozilla
  • List all updates to the RPM package in the resource library
#yum list updates
  • List all installed RPM packages
#yum list installed
  • List RPM packages installed but not included in the resource library
#yum list extras
  • Note: download and install the RPM package from other websites
RPM package information display (the info parameter is the same as the list)
  • Lists information about all RPM packages that can be installed or updated in the resource library.
#yum info
  • Lists the specific information of RPM packages that can be installed or updated and installed in the resource library.
#yum info mozilla
#yum info mozilla*
  • Note: Match characters can be used in RPM package names, such as listing all RPM packages starting with Mozilla
  • Lists information about all the RPM packages that can be updated in the resource library.
#yum info updates
  • Lists information about all installed RPM packages.
#yum info installed
  • Lists the installed RPM packages that are not included in the resource library.
#yum info extras
  • Note: Download the installed RPM package information from other websites.
Search for RPM packages
  • Search for RPM packages matching specific characters
#yum search mozilla
  • Note: Search for RPM package names and package descriptions
  • Search for RPM packages with specific file names
#yum provides realplay
Add Resource Library
  • For example, add rpm.livna.org as the resource library.
  • Install livna.org RPMs GPG key
#rpm --import http://rpm.livna.org/RPM-LIVNA-GPG-KEY
  • Check GPG key
# rpm -qa gpg-pubkey*
  • Show key information
#rpm -qi gpg-pubkey-a109b1ec-3f6e28d5
  • (Note: If you want to delete the key, use the # rpm-e gpg-pubkey-a109b1ec-3f6e28d5)

Add Yum Source

Add the yum source, which can be stored in the/etc/yum. Repos. d/directory. A source file with the suffix "Repo" is ready. The system itself has two files, both of which are foreign sources and are relatively slow. You can back them up and use the domestic sources for updates.

Differences between these sources

Use the update source of HKUST only: 2658 packages

Use freshrpms separately, which is 514 packages.

Separate rpmforge, Which is 4471 packets

If I use three sources (excluding rpmforge), there are 2822 packages, of which 1784 are DVDs. Freshrpms is 164, and others are downloaded from HKUST.

It can be seen that Yum is still very smart, and automatic local is the fastest,

I just added another rpmforge source, which is so powerful that 3979 more packages will be added. This is not all. It's nothing else. It's his bag.

The number of packages that can be updated on my machine is 6668.

Rpmforge, this is awesome. I studied how to install XP on PXE yesterday and needed to install cabextract. I searched everywhere for this package and did not find it. Finally, I found a source code package on the Cu and compiled and installed it, it took me half a day to get it done. I didn't think of it. Now I can get it done with yum.

Rpmforge, this source package is basically unique,

Another point is worth noting: RHMS, a RedHat mail solution, downloads all the RPM packages needed to the local device, and then installs them through yum. Very convenient.

6. Various Sources

MV/etc/yum. Repos. d/CentOS-Base.repo/etc/yum. Repos. d/CentOS-Base.repo.save

MV/etc/yum. Repos. d/CentOS-Media.repo/etc/yum. Repos. d/CentOS-Media.repo.save

1: Use a local optical drive

Mkdir/mnt/DVD

Mount/dev/CDROM/mnt/DVD

Create the dvdiso. Repo file and add the following content.

VI/etc/yum. Repos. d/dvdiso. Repo

[Dvdiso]

Name = DVD ISO

Baseurl = file: // MNT/DVD

Enabled = 1

Gpgcheck = 0

2: Use the source of HKUST

Create USTC. Repo File

######################

[Base]

CentOS-5-Base

Repo = OS

Baseurl = http://centos.ustc.edu.cn/centos/5.2/ OS /?basearch/

Gpgcheck = 1

Gpgkey = http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

[Update]

CentOS-5-Updates

Baseurl = http://centos.ustc.edu.cn/centos/5.2/updates/?basearch/

Gpgcheck = 1

Gpgkey = http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

[Addons]

CentOS-5-Addons

Baseurl = http://centos.ustc.edu.cn/centos/5.2/addons/?basearch/

Gpgcheck = 1

Gpgkey = http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

[Extras]

Name = CentOS-5-extras

Baseurl = http://centos.ustc.edu.cn/centos/5.2/extras/?basearch/

Gpgcheck = 1

Gpgkey = http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

[Centosplus]

CentOS-5-plus

Baseurl = http://centos.ustc.edu.cn/centos/5.2/centosplus/?basearch/

Gpgcheck = 1

Enabled = 0

Gpgkey = http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

[Contrib]

Name = CentOS-5-contrib

Baseurl = http://centos.ustc.edu.cn/centos/5.2/contrib/?basearch/

Gpgcheck = 1

Enabled = 0

Gpgkey = http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

###################

Rpm -- import http://centos.ustc.edu.cn/centos/5.2/ OS /i386/RPM-GPG-KEY-CentOS-5

Use freshrpms Source

Create freshrpms. Repo File

[Freshrpms]

Name = Fedora Linux $ releasever-$ basearch-freshrpms

Baseurl = http://ayo.freshrpms.net/fedora/linux/?releasever/?basearch/freshrpms

Gpgcheck = 1

Rpm -- import http://freshrpms.net/packages/RPM-GPG-KEY.txt

Use rpmforge as a source

Wget http://dag.wieers.com/rpm/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm

Rpm-uvh rpmforge-release-0.3.6-1.el5.rf.i386.rpm

The following source can install Webmin and create/etc/yum. Repos. d/doylenet. Repo

[Doylenet]

Name = doylenet custom repository for centos

Base url = http://files.doylenet.net/linux/yum/centos/5/i386/doylenet/

Gpgcheck = 1

Gpgkey = http://files.doylenet.net/linux/yum/centos/RPM-GPG-KEY-rdoyle

Enabled = 1

Yum install Webmin

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.