linux yum command

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

RPM-based package management, can be automatically downloaded from the specified server RPM package and installed, it can automatically handle dependency relationship, and install all of the software packages rely on, again and again without cumbersome downloads and installation.

yum provides search, install, remove one, or all of a set of packages command, and command concise and easy to remember.

yum Syntax

yum [options] [command] [package /en.]
  • options: options, options -h (help), - y (When the installation process prompts you to select all of the "yes"), - q (not displayed during the installation process) and so on.
  • command: operations to be carried out.
  • Object package operation.

yum common commands

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

Example 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
……(省略)

Example 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!

Example 3

Features use yum to find software to pam beginning with the name of what?

[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 domestic yum source, both speed and software version, are very good.

The yum source is set to 163 yum, install and update software packages can enhance the speed, while avoiding some of the common version of the software can not be found.

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 repo files into /etc/yum.repos.d/ (please make the appropriate backup before proceeding)

  • CentOS5 :
  • CentOS6 :

Run the following command to generate the cache

yum clean all
yum makecache

In addition to NetEase, there are other good yum domestic sources, such as USTC and Sohu.

USTC yum source Installation view: centos

sohu the yum source installation methods View: centos