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

Teach you how to use CentOS yum

Dec 04, 2020 pm 02:52 PM

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包.
 它能自动解决包的倚赖性问题.
 它能便于管理大量系统的更新问题
Copy after login

yum features

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

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)
Copy after login

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
Copy after login

Installation and deletion of rpm package

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

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
Copy after login

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包
Copy after login

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包的信息
Copy after login

Search rpm package

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

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)
Copy after login

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
Copy after login

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       升级内核;
Copy after login

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
Copy after login

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
Copy after login

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 of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Chat Commands and How to Use Them
1 months ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How do I install and configure MySQL/MariaDB on CentOS? How do I install and configure MySQL/MariaDB on CentOS? Mar 17, 2025 pm 04:35 PM

Article discusses installation, configuration, and troubleshooting of MySQL/MariaDB on CentOS, including system requirements and security measures.(159 characters)

How do I configure log rotation in CentOS? How do I configure log rotation in CentOS? Mar 17, 2025 pm 04:43 PM

The article explains how to configure log rotation in CentOS using logrotate, detailing installation, configuration, and benefits like disk space management and security.

How do I use Logical Volume Management (LVM) in CentOS to manage storage? How do I use Logical Volume Management (LVM) in CentOS to manage storage? Mar 17, 2025 pm 04:51 PM

The article discusses using Logical Volume Management (LVM) in CentOS for efficient storage management, detailing steps for setup, extension, and backup/restore processes, and highlighting LVM's advantages over traditional partitioning.

CentOS Containerization with Docker: Deploying and Managing Applications CentOS Containerization with Docker: Deploying and Managing Applications Apr 03, 2025 am 12:08 AM

Using Docker to containerize, deploy and manage applications on CentOS can be achieved through the following steps: 1. Install Docker, use the yum command to install and start the Docker service. 2. Manage Docker images and containers, obtain images through DockerHub and customize images using Dockerfile. 3. Use DockerCompose to manage multi-container applications and define services through YAML files. 4. Deploy the application, use the dockerpull and dockerrun commands to pull and run the container from DockerHub. 5. Carry out advanced management and deploy complex applications using Docker networks and volumes. Through these steps, you can make full use of D

How do I manage system services with systemd in CentOS? How do I manage system services with systemd in CentOS? Mar 17, 2025 pm 04:38 PM

The article explains how to manage system services using systemd on CentOS, covering starting, stopping, enabling at boot, and troubleshooting services.

How do I monitor system performance in CentOS using tools like top, htop, and vmstat? How do I monitor system performance in CentOS using tools like top, htop, and vmstat? Mar 17, 2025 pm 04:41 PM

The article discusses monitoring CentOS system performance using top, htop, and vmstat, detailing their features, differences, and customization for effective system analysis.

CentOS Backup and Recovery: Ensuring Data Integrity and Availability CentOS Backup and Recovery: Ensuring Data Integrity and Availability Apr 04, 2025 am 12:02 AM

The steps for backup and recovery in CentOS include: 1. Use the tar command to perform basic backup and recovery, such as tar-czvf/backup/home_backup.tar.gz/home backup/home directory; 2. Use rsync for incremental backup and recovery, such as rsync-avz/home//backup/home_backup/ for the first backup. These methods ensure data integrity and availability and are suitable for the needs of different scenarios.

How do I configure automatic updates in CentOS? How do I configure automatic updates in CentOS? Mar 17, 2025 pm 04:40 PM

The article details how to set up automatic updates on CentOS using yum-cron, including installation, configuration, and verification steps. It discusses benefits like improved security and system stability, and how to customize update schedules.

See all articles