Home >Operation and Maintenance >CentOS >Teach you how to use CentOS yum

Teach you how to use CentOS yum

藏色散人
藏色散人forward
2020-12-04 14:52:332447browse

The following column will introduce you to the detailed use of CentOS yum from the centos basic tutorial column. I hope it will be useful to friends who need it. help!

Teach you how to use CentOS yum

##CentOS Detailed usage of yum

What is yum

yum = Yellow dog Updater, Modified
 主要功能是更方便的添加/删除/更新RPM包.
 它能自动解决包的倚赖性问题.
 它能便于管理大量系统的更新问题

yum features

可以同时配置多个资源库(Repository)
 简洁的配置文件(/etc/yum.conf
 自动解决增加或删除rpm包时遇到的倚赖性问题
 使用方便
 保持与RPM数据库的一致性

yum installation

CentOS自带(yum-*.noarch.rpm)
 #rpm -ivh yum-*.noarch.rpm
 在第一次启用yum之前首先需要导入系统的RPM-GPG-KEY:
 #rpm --import /usr/share/doc/centos-release-3(4)/RPM-GPG-KEY-CentOS-3(4)

yum command Note: When you use yum for the first time or when the yum resource library is updated, yum will automatically download all required headers and place them in /var/cache/yum directory, it may take a long time.

Update of rpm package

检查可更新的rpm包
 #yum check-update
 更新所有的rpm包
 #yum update
 更新指定的rpm包,如更新kernel和kernel source
 #yum update kernel kernel-source
 大规模的版本升级,与yum update不同的是,连旧的淘汰的包也升级
 #yum upgrade

Installation and deletion of rpm package

安装rpm包,如xmms-mp3
 #yum install xmms-mp3
 删除rpm包,包括与该包有倚赖性的包
 #yum remove licq
 注:同时会提示删除licq-gnome,licq-qt,licq-text

Related parameters of yum temporary storage (/var/cache/yum/)

清除暂存中rpm包文件
 #yum clean packages
 清除暂存中rpm头文件
 #yum clearn headers
 清除暂存中旧的rpm头文件
 #yum clean oldheaders
 清除暂存中旧的rpm头文件和包文件
 #yum clearn 或#yum clearn all
 注:相当于yum clean packages + yum clean oldheaders

Package list

列出资源库中所有可以安装或更新的rpm包
 #yum list
 列出资源库中特定的可以安装或更新以及已经安装的rpm包
 #yum list mozilla#yum list mozilla*
 注:可以在rpm包名中使用匹配符,如列出所有以mozilla开头的rpm包
 列出资源库中所有可以更新的rpm包
 #yum list updates
 列出已经安装的所有的rpm包
 #yum list installed
 列出已经安装的但是不包含在资源库中的rpm包
 #yum list extras
 注:通过其它网站下载安装的rpm包

rpm package information display (info parameter is the same as list)

列出资源库中所有可以安装或更新的rpm包的信息
 #yum info
 列出资源库中特定的可以安装或更新以及已经安装的rpm包的信息
 #yum info mozilla#yum info mozilla*
 注:可以在rpm包名中使用匹配符,如列出所有以mozilla开头的rpm包的信息
 列出资源库中所有可以更新的rpm包的信息
 #yum info updates
 列出已经安装的所有的rpm包的信息
 #yum info installed
 列出已经安装的但是不包含在资源库中的rpm包的信息
 #yum info extras
 注:通过其它网站下载安装的rpm包的信息

Search rpm package

搜索匹配特定字符的rpm包
 #yum search mozilla
 注:在rpm包名,包描述等中搜索
 搜索有包含特定文件名的rpm包
 #yum provides realplay

Add resource library

例如:增加rpm.livna.org作为资源库
 安装Livna.org rpms GPG key
 #rpm --import http://rpm.livna.org/RPM-LIVNA-GPG-KEY
 检查GPG Key
 # rpm -qa gpg-pubkey*
 显示Key信息
 #rpm -qi gpg-pubkey-a109b1ec-3f6e28d5
 (注:如果要删除Key,使用#rpm -e gpg-pubkey-a109b1ec-3f6e28d5)

Commonly used commands in yum

# yum install xxx            安装xxx软件
# yum info xxx                查看xxx软件的信息
# yum remove xxx        删除软件包
# yum list                        列出软件包
# yum clean                    清除缓冲和就的包
# yum provides xxx        以xxx为关键字搜索包(提供的信息为关键字)
# yum search xxx           搜索软件包(以名字为关键字)
# yum groupupdate xxx
# yum grouplist xxx
# yum groupremove xxx

These three are a group upgrade list and delete operations. . For example, "Mysql Database" is a group that will operate all related software packages at the same time;

# yum update                系统升级
# yum list available        列出所有升级源上的包;
# yum list updates         列出所有升级源上的可以更新包;
# yum list installed         列出已经安装的包;
# yun update kernel       升级内核;

Yum commonly used sources

1) Automatically select the fastest source

Since some mirrors in yum are very slow, if yum selects this mirror, yum will be very slow at this time. For this, you can download the fastestmirror plug-in, which will automatically select the fastest mirror:

#yum install yum-fastestmirror

Configuration file: (generally do not need to be touched)/etc/yum/pluginconf.d/fastestmirror.conf

The speed test record file of your yum mirror:/var/cache/yum/timedhosts. txt

(2) Use the graphical interface yum

If you find the command line yum inconvenient, you can use the graphical yumex, which seems more convenient because you can freely choose the software Warehouse:

#yum install yumex

Then you can see the yum extender in the system tools. In fact, the "Add/Remove Programs" that comes with the system can also implement graphical software installation, but it does not have some of the functions of yumex.

The above is the detailed content of Teach you how to use CentOS yum. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:csdn.net. If there is any infringement, please contact admin@php.cn delete