云计算百科
云计算领域专业知识百科平台

Linux yum 命令4757

Linux yum 命令

yum( Yellow dog Updater, Modified)是一个在 Fedora 和 RedHat 以及 SUSE 中的 Shell 前端软件包管理器。

基于 RPM 包管理,能够从指定的服务器自动下载 RPM 包并且安装,可以自动处理依赖性关系,并且一次安装所有依赖的软件包,无须繁琐地一次次下载、安装。

yum 提供了查找、安装、删除某一个、一组甚至全部软件包的命令,而且命令简洁而又好记。

yum 语法

yum [options] [command] [package …]

  • options:可选,选项包括-h(帮助),-y(当安装过程提示选择全部为 "yes"),-q(不显示安装的过程)等等。
  • command:要进行的操作。
  • package:安装的包名。

yum常用命令

  • 1. 列出所有可更新的软件清单命令:yum check-update

  • 2. 更新所有软件命令:yum update

  • 3. 仅安装指定的软件命令:yum install <package_name>

  • 4. 仅更新指定的软件命令:yum update <package_name>

  • 5. 列出所有可安裝的软件清单命令:yum list

  • 6. 删除软件包命令:yum remove <package_name>

  • 7. 查找软件包命令:yum search <keyword>

  • https://avg.163.com/topic/detail/10733218
    https://avg.163.com/topic/detail/10733216
    https://avg.163.com/topic/detail/10733213
    https://avg.163.com/topic/detail/10733209
    https://avg.163.com/topic/detail/10733207
    https://avg.163.com/topic/detail/10733204
    https://avg.163.com/topic/detail/10733201
    https://avg.163.com/topic/detail/10733198
    https://avg.163.com/topic/detail/10733196
    https://avg.163.com/topic/detail/10733194
    https://avg.163.com/topic/detail/10733191
    https://avg.163.com/topic/detail/10733189
    https://avg.163.com/topic/detail/10733188
    https://avg.163.com/topic/detail/10733184
    https://avg.163.com/topic/detail/10733181
    https://avg.163.com/topic/detail/10733178
    https://avg.163.com/topic/detail/10733177
    https://avg.163.com/topic/detail/10733175
    https://avg.163.com/topic/detail/10733172
    https://avg.163.com/topic/detail/10733169
    https://avg.163.com/topic/detail/10733167
    https://avg.163.com/topic/detail/10733165
    https://avg.163.com/topic/detail/10733164
    https://avg.163.com/topic/detail/10733161
    https://avg.163.com/topic/detail/10733160
    https://avg.163.com/topic/detail/10733154
    https://avg.163.com/topic/detail/10733148
    https://avg.163.com/topic/detail/10733147
    https://avg.163.com/topic/detail/10733145
    https://avg.163.com/topic/detail/10733144
    https://avg.163.com/topic/detail/10733142
    https://avg.163.com/topic/detail/10733141
    https://avg.163.com/topic/detail/10733138
    https://avg.163.com/topic/detail/10733136
    https://avg.163.com/topic/detail/10733135
    https://avg.163.com/topic/detail/10733130
    https://avg.163.com/topic/detail/10733129
    https://avg.163.com/topic/detail/10733127
    https://avg.163.com/topic/detail/10733123
    https://avg.163.com/topic/detail/10733121
    https://avg.163.com/topic/detail/10733117
    https://avg.163.com/topic/detail/10733116
    https://avg.163.com/topic/detail/10733115
    https://avg.163.com/topic/detail/10733114
    https://avg.163.com/topic/detail/10733111
    https://avg.163.com/topic/detail/10733109
    https://avg.163.com/topic/detail/10733108
    https://avg.163.com/topic/detail/10733105
    https://avg.163.com/topic/detail/10733100
    https://avg.163.com/topic/detail/10733098
    https://avg.163.com/topic/detail/10733096
    https://avg.163.com/topic/detail/10733094
    https://avg.163.com/topic/detail/10733090
    https://avg.163.com/topic/detail/10733091
    https://avg.163.com/topic/detail/10733088
    https://avg.163.com/topic/detail/10733083
    https://avg.163.com/topic/detail/10733080
    https://avg.163.com/topic/detail/10733078
    https://avg.163.com/topic/detail/10733075
    https://avg.163.com/topic/detail/10733073
    https://avg.163.com/topic/detail/10733074
    https://avg.163.com/topic/detail/10733071
    https://avg.163.com/topic/detail/10733063
    https://avg.163.com/topic/detail/10733060
    https://avg.163.com/topic/detail/10733058
    https://avg.163.com/topic/detail/10733047
    https://avg.163.com/topic/detail/10733055
    https://avg.163.com/topic/detail/10733053
    https://avg.163.com/topic/detail/10733048
    https://avg.163.com/topic/detail/10733046
    https://avg.163.com/topic/detail/10733044
    https://avg.163.com/topic/detail/10733043
    https://avg.163.com/topic/detail/10733036
    https://avg.163.com/topic/detail/10733037
    https://avg.163.com/topic/detail/10733031
    https://avg.163.com/topic/detail/10733030
    https://avg.163.com/topic/detail/10733029
    https://avg.163.com/topic/detail/10733028
    https://avg.163.com/topic/detail/10733027
    https://avg.163.com/topic/detail/10733023
    https://avg.163.com/topic/detail/10733025
    https://avg.163.com/topic/detail/10733024
    https://avg.163.com/topic/detail/10733021
    https://avg.163.com/topic/detail/10733020
    https://avg.163.com/topic/detail/10733016
    https://avg.163.com/topic/detail/10733014
    https://avg.163.com/topic/detail/10733012
    https://avg.163.com/topic/detail/10733006
    https://avg.163.com/topic/detail/10733008
    https://avg.163.com/topic/detail/10733010
    https://avg.163.com/topic/detail/10733005
    https://avg.163.com/topic/detail/10733000
    https://avg.163.com/topic/detail/10732998
    https://avg.163.com/topic/detail/10732995
    https://avg.163.com/topic/detail/10732992
    https://avg.163.com/topic/detail/10732990
    https://avg.163.com/topic/detail/10732989
    https://avg.163.com/topic/detail/10732987
    https://avg.163.com/topic/detail/10732984
    https://avg.163.com/topic/detail/10732981
    https://avg.163.com/topic/detail/10732980
    https://avg.163.com/topic/detail/10732978
    https://avg.163.com/topic/detail/10732977
    https://avg.163.com/topic/detail/10732976
    https://avg.163.com/topic/detail/10732974
    https://avg.163.com/topic/detail/10732972
    https://avg.163.com/topic/detail/10732971
    https://avg.163.com/topic/detail/10732970
    https://avg.163.com/topic/detail/10732969
    https://avg.163.com/topic/detail/10732967
    https://avg.163.com/topic/detail/10732966
    https://avg.163.com/topic/detail/10732959
    https://avg.163.com/topic/detail/10732961
    https://avg.163.com/topic/detail/10732960
    https://avg.163.com/topic/detail/10732957
    https://avg.163.com/topic/detail/10732956
    https://avg.163.com/topic/detail/10732953
    https://avg.163.com/topic/detail/10732949
    https://avg.163.com/topic/detail/10732948
    https://avg.163.com/topic/detail/10732944
    https://avg.163.com/topic/detail/10732946
    https://avg.163.com/topic/detail/10732941
    https://avg.163.com/topic/detail/10732939
    https://avg.163.com/topic/detail/10732938
    https://avg.163.com/topic/detail/10732937
    https://avg.163.com/topic/detail/10732936
    https://avg.163.com/topic/detail/10732933
    https://avg.163.com/topic/detail/10732930
    https://avg.163.com/topic/detail/10732929
    https://avg.163.com/topic/detail/10732927
    https://avg.163.com/topic/detail/10732925
    https://avg.163.com/topic/detail/10732924
    https://avg.163.com/topic/detail/10732922
    https://avg.163.com/topic/detail/10732920
    https://avg.163.com/topic/detail/10732918
    https://avg.163.com/topic/detail/10732916
    https://avg.163.com/topic/detail/10732914
    https://avg.163.com/topic/detail/10732913
    https://avg.163.com/topic/detail/10732912
    https://avg.163.com/topic/detail/10732910
    https://avg.163.com/topic/detail/10732907
    https://avg.163.com/topic/detail/10732906
    https://avg.163.com/topic/detail/10732905
    https://avg.163.com/topic/detail/10732904
    https://avg.163.com/topic/detail/10732902
    https://avg.163.com/topic/detail/10732901
    https://avg.163.com/topic/detail/10732900
    https://avg.163.com/topic/detail/10732898
    https://avg.163.com/topic/detail/10732899
    https://avg.163.com/topic/detail/10732896
    https://avg.163.com/topic/detail/10732893
    https://avg.163.com/topic/detail/10732892
    https://avg.163.com/topic/detail/10732889
    https://avg.163.com/topic/detail/10732888
    https://avg.163.com/topic/detail/10732884
    https://avg.163.com/topic/detail/10732881
    https://avg.163.com/topic/detail/10732880
    https://avg.163.com/topic/detail/10732877
    https://avg.163.com/topic/detail/10732875
    https://avg.163.com/topic/detail/10732872
    https://avg.163.com/topic/detail/10732871
    https://avg.163.com/topic/detail/10732869
    https://avg.163.com/topic/detail/10732868
    https://avg.163.com/topic/detail/10732866
    https://avg.163.com/topic/detail/10732862
    https://avg.163.com/topic/detail/10732863
    https://avg.163.com/topic/detail/10732861
    https://avg.163.com/topic/detail/10732857
    https://avg.163.com/topic/detail/10732855
    https://avg.163.com/topic/detail/10732852
    https://avg.163.com/topic/detail/10732850
    https://avg.163.com/topic/detail/10732849
    https://avg.163.com/topic/detail/10732848
    https://avg.163.com/topic/detail/10732846
    https://avg.163.com/topic/detail/10732844
    https://avg.163.com/topic/detail/10732841
    https://avg.163.com/topic/detail/10732838
    https://avg.163.com/topic/detail/10732836
    https://avg.163.com/topic/detail/10732833
    https://avg.163.com/topic/detail/10732831
    https://avg.163.com/topic/detail/10732828
    https://avg.163.com/topic/detail/10732825
    https://avg.163.com/topic/detail/10732818
    https://avg.163.com/topic/detail/10732817
    https://avg.163.com/topic/detail/10732814
    https://avg.163.com/topic/detail/10732806
    https://avg.163.com/topic/detail/10732803
    https://avg.163.com/topic/detail/10732793
    https://avg.163.com/topic/detail/10732791
    https://avg.163.com/topic/detail/10732788
    https://avg.163.com/topic/detail/10732789
    https://avg.163.com/topic/detail/10732787
    https://avg.163.com/topic/detail/10732782
    https://avg.163.com/topic/detail/10732783
    https://avg.163.com/topic/detail/10732777
    https://avg.163.com/topic/detail/10732775
    https://avg.163.com/topic/detail/10732774
    https://avg.163.com/topic/detail/10732768
    https://avg.163.com/topic/detail/10732761
    https://avg.163.com/topic/detail/10732758
    https://avg.163.com/topic/detail/10732754
    https://avg.163.com/topic/detail/10732746
    https://avg.163.com/topic/detail/10732744
    https://avg.163.com/topic/detail/10732737
    https://avg.163.com/topic/detail/10732736
    https://avg.163.com/topic/detail/10732734
    https://avg.163.com/topic/detail/10732733
    https://avg.163.com/topic/detail/10732730
    https://avg.163.com/topic/detail/10732729
    https://avg.163.com/topic/detail/10732727
    https://avg.163.com/topic/detail/10732726
    https://avg.163.com/topic/detail/10732725
    https://avg.163.com/topic/detail/10732721
    https://avg.163.com/topic/detail/10732718
    https://avg.163.com/topic/detail/10732715
    https://avg.163.com/topic/detail/10732714
    https://avg.163.com/topic/detail/10732713
    https://avg.163.com/topic/detail/10732701
    https://avg.163.com/topic/detail/10732700
    https://avg.163.com/topic/detail/10732699
    https://avg.163.com/topic/detail/10732697
    https://avg.163.com/topic/detail/10732690
    https://avg.163.com/topic/detail/10732689
    https://avg.163.com/topic/detail/10732688
    https://avg.163.com/topic/detail/10732687
    https://avg.163.com/topic/detail/10732686
    https://avg.163.com/topic/detail/10732685
    https://avg.163.com/topic/detail/10732684
    https://avg.163.com/topic/detail/10732680
    https://avg.163.com/topic/detail/10732677
    https://avg.163.com/topic/detail/10732676
    https://avg.163.com/topic/detail/10732670
    https://avg.163.com/topic/detail/10732667
    https://avg.163.com/topic/detail/10732661
    https://avg.163.com/topic/detail/10732659
    https://avg.163.com/topic/detail/10732654
    https://avg.163.com/topic/detail/10732650
    https://avg.163.com/topic/detail/10732649
    https://avg.163.com/topic/detail/10732646
    https://avg.163.com/topic/detail/10732637
    https://avg.163.com/topic/detail/10732635
    https://avg.163.com/topic/detail/10732634
    https://avg.163.com/topic/detail/10732633
    https://avg.163.com/topic/detail/10732631
    https://avg.163.com/topic/detail/10732630
    https://avg.163.com/topic/detail/10732626
    https://avg.163.com/topic/detail/10732625
    https://avg.163.com/topic/detail/10732624
    https://avg.163.com/topic/detail/10732622
    https://avg.163.com/topic/detail/10732621
    https://avg.163.com/topic/detail/10732620
    https://avg.163.com/topic/detail/10732618
    https://avg.163.com/topic/detail/10732616
    https://avg.163.com/topic/detail/10732611
    https://avg.163.com/topic/detail/10732606
    https://avg.163.com/topic/detail/10732604
    https://avg.163.com/topic/detail/10732602
    https://avg.163.com/topic/detail/10732600
    https://avg.163.com/topic/detail/10732591
    https://avg.163.com/topic/detail/10732590
    https://avg.163.com/topic/detail/10732589
    https://avg.163.com/topic/detail/10732579
    https://avg.163.com/topic/detail/10732578
    https://avg.163.com/topic/detail/10732577
    https://avg.163.com/topic/detail/10732576
    https://avg.163.com/topic/detail/10732575
    https://avg.163.com/topic/detail/10732574
    https://avg.163.com/topic/detail/10732572
    https://avg.163.com/topic/detail/10732573
    https://avg.163.com/topic/detail/10732571
    https://avg.163.com/topic/detail/10732569
    https://avg.163.com/topic/detail/10732568
    https://avg.163.com/topic/detail/10732565
    https://avg.163.com/topic/detail/10732558
    https://avg.163.com/topic/detail/10732551
    https://avg.163.com/topic/detail/10732546
    https://avg.163.com/topic/detail/10732537
    https://avg.163.com/topic/detail/10732532
    https://avg.163.com/topic/detail/10732526
    https://avg.163.com/topic/detail/10732524
    https://avg.163.com/topic/detail/10732523
    https://avg.163.com/topic/detail/10732521
    https://avg.163.com/topic/detail/10732520
    https://avg.163.com/topic/detail/10732519
    https://avg.163.com/topic/detail/10732518
    https://avg.163.com/topic/detail/10732516
    https://avg.163.com/topic/detail/10732515
    https://avg.163.com/topic/detail/10732514
    https://avg.163.com/topic/detail/10732513
    https://avg.163.com/topic/detail/10732511
    https://avg.163.com/topic/detail/10732509
    https://avg.163.com/topic/detail/10732506
    https://avg.163.com/topic/detail/10732500
    https://avg.163.com/topic/detail/10732497
    https://avg.163.com/topic/detail/10732491
    https://avg.163.com/topic/detail/10732486
    https://avg.163.com/topic/detail/10732485
    https://avg.163.com/topic/detail/10732480
    https://avg.163.com/topic/detail/10732481
    https://avg.163.com/topic/detail/10732467
    https://avg.163.com/topic/detail/10732466
    https://avg.163.com/topic/detail/10732463
    https://avg.163.com/topic/detail/10732456
    https://avg.163.com/topic/detail/10732460
    https://avg.163.com/topic/detail/10732459
    https://avg.163.com/topic/detail/10732458
    https://avg.163.com/topic/detail/10732454
    https://avg.163.com/topic/detail/10732446
    https://avg.163.com/topic/detail/10732437
    https://avg.163.com/topic/detail/10732434
    https://avg.163.com/topic/detail/10732433
    https://avg.163.com/topic/detail/10732430
    https://avg.163.com/topic/detail/10732422
    https://avg.163.com/topic/detail/10732419
    https://avg.163.com/topic/detail/10732415
    https://avg.163.com/topic/detail/10732411
    https://avg.163.com/topic/detail/10732410
    https://avg.163.com/topic/detail/10732408
    https://avg.163.com/topic/detail/10732402
    https://avg.163.com/topic/detail/10732399
    https://avg.163.com/topic/detail/10732393
    https://avg.163.com/topic/detail/10732392
    https://avg.163.com/topic/detail/10732389
    https://avg.163.com/topic/detail/10732385
    https://avg.163.com/topic/detail/10732384
    https://avg.163.com/topic/detail/10732379
    https://avg.163.com/topic/detail/10732374
    https://avg.163.com/topic/detail/10732373
    https://avg.163.com/topic/detail/10732369
    https://avg.163.com/topic/detail/10732366
    https://avg.163.com/topic/detail/10732365
    https://avg.163.com/topic/detail/10732363
    https://avg.163.com/topic/detail/10732359
    https://avg.163.com/topic/detail/10732357
    https://avg.163.com/topic/detail/10732353
    https://avg.163.com/topic/detail/10732351
    https://avg.163.com/topic/detail/10732350
    https://avg.163.com/topic/detail/10732348
    https://avg.163.com/topic/detail/10732344
    https://avg.163.com/topic/detail/10732345
    https://avg.163.com/topic/detail/10732342
    https://avg.163.com/topic/detail/10732339
    https://avg.163.com/topic/detail/10732336
    https://avg.163.com/topic/detail/10732335
    https://avg.163.com/topic/detail/10732333
    https://avg.163.com/topic/detail/10732334
    https://avg.163.com/topic/detail/10732327
    https://avg.163.com/topic/detail/10732325
    https://avg.163.com/topic/detail/10732323
    https://avg.163.com/topic/detail/10732318
    https://avg.163.com/topic/detail/10732316
    https://avg.163.com/topic/detail/10732314
    https://avg.163.com/topic/detail/10732311
    https://avg.163.com/topic/detail/10732310
    https://avg.163.com/topic/detail/10732306
    https://avg.163.com/topic/detail/10732301
    https://avg.163.com/topic/detail/10732300
    https://avg.163.com/topic/detail/10732295
    https://avg.163.com/topic/detail/10732294
    https://avg.163.com/topic/detail/10732293
    https://avg.163.com/topic/detail/10732291
    https://avg.163.com/topic/detail/10732292
    https://avg.163.com/topic/detail/10732290
    https://avg.163.com/topic/detail/10732289
    https://avg.163.com/topic/detail/10732288
    https://avg.163.com/topic/detail/10732286
    https://avg.163.com/topic/detail/10732285
    https://avg.163.com/topic/detail/10732283
    https://avg.163.com/topic/detail/10732280
    https://avg.163.com/topic/detail/10732282
    https://avg.163.com/topic/detail/10732279
    https://avg.163.com/topic/detail/10732276

  • 8. 清除缓存命令:

    • yum clean packages: 清除缓存目录下的软件包
    • yum clean headers: 清除缓存目录下的 headers
    • yum clean oldheaders: 清除缓存目录下旧的 headers
    • yum clean, yum clean all (= yum clean packages; yum clean oldheaders) :清除缓存目录下的软件包及旧的 headers

实例 1

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

实例 2

移除 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!

实例 3

利用 yum 的功能,找出以 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


国内 yum 源

网易(163)yum 源是国内较好的 yum 源之一 ,无论是速度还是软件版本,都非常的不错。

将yum源设置为163 yum,可以提升软件包安装和更新的速度,同时避免一些常见软件版本无法找到。

安装步骤

首先备份/etc/yum.repos.d/CentOS-Base.repo

赞(0)
未经允许不得转载:网硕互联帮助中心 » Linux yum 命令4757
分享到: 更多 (0)

评论 抢沙发

评论前必须登录!