Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Linux yum command


May 22, 2021 Linux


Table of contents


Linux yum command

Yum (Yellow Dog Updater, Modified) is a Shell front-end package manager in Fedora and RedHat and SUSE.

Based on RPM package management, RPM package can be automatically downloaded and installed from the specified server, dependency can be automatically processed, and all dependent software packages can be installed at once, without the need for cumbersome download and installation.

yum provides commands to find, install, delete one, one, or even all packages, and the commands are concise and well-remembered.

yum syntax

yum [options] [command] [package ...]
  • Options: Optional, options include -h (help), -y (when the installation process prompts you to select all "yes"), -q (does not show the installation process), and so on.
  • Command: What to do.
  • The object of the package operation.

Yum commonly uses commands

  • 1. List all updateable software inventory commands: yum check-update
  • 2. Update all software commands: yum update
  • 3. Install only the specified software commands: yum install slt;package_name and gt;
  • 4. Update only the specified software commands: yum update slt;package_name.
  • 5. List all installable software inventory commands: yum list
  • 6. Remove package command: yum remove slt;package_name.
  • 7. Find Package Command: yum search slt;keyword>
  • 8. Clear cache command:
    • yum clean packages: Clear packages from the cache directory
    • yum clean headers: Clear the headers under the cache directory
    • yum clean oldheaders: Clear the old headers under the cache directory
    • yum clean, yum clean all (= yum clean packages; yum clean oldheaders): Clear the packages under the cache directory and the old headers

Instance 1

Install pam-devel

[root@www ~]# yum install pam-devel
Setting up Install Process
Parsing package install arguments
Resolving Dependencies  <==先检查软件的属性相依问题 --> Running transaction check
---> Package pam-devel.i386 0:0.99.6.2-4.el5 set to be updated
--> Processing Dependency: pam = 0.99.6.2-4.el5 for package: pam-devel
--> Running transaction check
---> Package pam.i386 0:0.99.6.2-4.el5 set to be updated
filelists.xml.gz          100% |=========================| 1.6 MB    00:05
filelists.xml.gz          100% |=========================| 138 kB    00:00
-> Finished Dependency Resolution
……(省略)

Instance 2

Remove pam-devel

[root@www ~]# yum remove pam-devel
Setting up Remove Process
Resolving Dependencies  <==同样的,先解决属性相依的问题 --> Running transaction check
---> Package pam-devel.i386 0:0.99.6.2-4.el5 set to be erased
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================
 Package                 Arch       Version          Repository        Size
=============================================================================
Removing:
 pam-devel               i386       0.99.6.2-4.el5   installed         495 k

Transaction Summary
=============================================================================
Install      0 Package(s)
Update       0 Package(s)
Remove       1 Package(s)  <==还好,并没有属性相依的问题,单纯移除一个软件  Is this ok [y/N]: y Downloading Packages: Running rpm_check_debug Running Transaction Test Finished Transaction Test Transaction Test Succeeded Running Transaction   Erasing   : pam-devel                    ######################### [1/1]  Removed: pam-devel.i386 0:0.99.6.2-4.el5 Complete! 

Instance 3

Use the capabilities of yum to find out what software names start with pam?

[root@www ~]# yum list pam*
Installed Packages
pam.i386                  0.99.6.2-3.27.el5      installed
pam_ccreds.i386           3-5                    installed
pam_krb5.i386             2.2.14-1               installed
pam_passwdqc.i386         1.0.2-1.2.2            installed
pam_pkcs11.i386           0.5.3-23               installed
pam_smb.i386              1.1.7-7.2.1            installed
Available Packages <==底下则是『可升级』的或『未安装』的 pam.i386                  0.99.6.2-4.el5         base pam-devel.i386            0.99.6.2-4.el5         base pam_krb5.i386             2.2.14-10              base 

Domestic yum source

NetEase (163) yum source is one of the best yum sources in China, whether it is speed or software version, is very good.

Setting the yum source to 163 yum speeds package installation and updates while avoiding the inability to find some common software versions.

Installation steps

First backup / etc / yum.repos.d / CentOS-Base.repo

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup

Download the corresponding version of the repo file, put in /etc/yum.repos.d/(please do the appropriate backup before operation)

  • CentOS5 :http://mirrors.163.com/.help/CentOS5-Base-163.repo
  • CentOS6 :http://mirrors.163.com/.help/CentOS6-Base-163.repo

Run the following command to generate the cache

yum clean all
yum makecache

In addition to NetEase, there are other good yum sources in China, such as China University of Science and 2006 and Sohu.

The yum source of the Chinese University of Science and 20,000, the installation method https://lug.ustc.edu.cn/wiki/mirrors/help/centos

Sohu's yum source installation method view: http://mirrors.sohu.com/help/centos.html