• news
  • pics
  • linux
  • windows
  • proxmox
  • game
  • news
  • pics
  • linux
  • windows
  • proxmox
  • game
Home
linux

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>
  • 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

[[email protected] ~]# 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

[[email protected] ~]# 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 为开头的软件名称有哪些?

[[email protected] ~]# 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

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

下载对应版本 repo 文件, 放入 /etc/yum.repos.d/ (操作前请做好相应备份)

  • CentOS5 :http://mirrors.163.com/.help/CentOS5-Base-163.repo
  • CentOS6 :http://mirrors.163.com/.help/CentOS6-Base-163.repo
  • CentOS7 :http://mirrors.163.com/.help/CentOS7-Base-163.repo
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
mv CentOS6-Base-163.repo CentOS-Base.repo

运行以下命令生成缓存

yum clean all
yum makecache

除了网易之外,国内还有其他不错的 yum 源,比如中科大和搜狐。

中科大的 yum 源,安装方法查看:https://lug.ustc.edu.cn/wiki/mirrors/help/centos

sohu 的 yum 源安装方法查看: http://mirrors.sohu.com/help/centos.htmlLinux vi/vimLinux apt 命令

2 篇笔记 写笔记

  1.    li1121567428  li1***[email protected]配置本地Yum仓库实现此案例需要按照如下步骤进行。步骤一:搭建一个本地Yum,将RHEL6光盘手动挂载到/media命令操作如下所示:[[email protected] ~]# mount /dev/cdrom /media/ mount: block device /dev/sr0 is write-protected, mounting read-only [[email protected] ~]# mount | tail -1 /dev/sr0 on /media type iso9660 (ro)步骤二:将本地设置为客户端,进行Yum验证Yum客户端需编辑配置文件,命令操作如下所示:[[email protected] ~]# cd /etc/yum.repos.d/ //必须在这个路径下 [[email protected] yum.repos.d]# ls //此路径下事先有配置文件的模板 rhel-source.repo [[email protected] yum.repos.d]# cp rhel-source.repo rhel6.repo //配置文件必须以.repo结尾 [[email protected] yum.repos.d]# vim rhel6.repo [rhel-6] //中括号里内容要求唯一,但不要出现特殊字符 name=Red Hat Enterprise Linux 6 //此为描述信息,可以看情况填写 baseurl=file:///media/ //此项为yum软件仓库位置,指向光盘挂载点 enabled=1 //此项为是否开启,1为开启, 0为不开启 gpgcheck=1 //此项为是否检查签名,1为检测, 0为不检测 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release //签名认证信息的路径 [[email protected] /]# yum repolist Loaded plugins: product-id, refresh-packagekit, security, subscription-manager This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register. rhel-6 | 3.9 kB 00:00 … rhel-6/primary_db | 3.1 MB 00:00 … repo id repo name status rhel-6 Red Hat Enterprise Linux 6 3,690 repolist: 3,690li1121567428   li1121567428  li1***[email protected]年前 (2017-07-01)
  2.    荣书  zrs***[email protected]对于 Linux 软件安装时提示缺失库的,可以使用 yum 的 provides 参数查看 libstdc++.so.6 的库文件包含在那个安装包中只需要执行:yum provides libstdc++.so.6然后按查询到安装包包名,使用 yum install 安装即可。
Previous article Linux vi/vim
Next article 〖COS系列〗黑白♚2b小姐姐,你更喜欢哪一组?

therock

19 Comments

  1. keto vegetarian recipes
    July 7, 2021 at 3:40 am

    liquid keto diet

  2. keto cheese sauce
    July 7, 2021 at 3:34 am

    what can you drink on keto diet

  3. keto wine
    July 7, 2021 at 2:49 am

    keto vegan diet

  4. lesbian dating websites free
    June 25, 2021 at 4:28 am

    new free dating

  5. old free dating site
    June 24, 2021 at 7:04 am

    list of absolutely free dating sites?

  6. free bi-sexual dating sites
    June 24, 2021 at 2:15 am

    free online dating for singles in usa

  7. mobile phone dating free
    June 23, 2021 at 9:46 pm

    free russian dating site

  8. online dating namibia free
    June 23, 2021 at 7:39 pm

    free dating sites for single bbw’s over 80 seeking younger man for relationship

  9. Usescedge
    June 14, 2021 at 1:17 pm

    dapoxetine

  10. cornwall dating free
    June 2, 2021 at 2:18 am

    farmersonly dating site free

  11. free sms dating
    June 1, 2021 at 11:05 pm

    100 free mexican dating

  12. free african american dating
    June 1, 2021 at 8:18 pm

    free online dating without payment

  13. australian free dating
    May 20, 2021 at 11:37 pm

    mydiscreteplace com free online dating

  14. dating free
    May 20, 2021 at 11:14 pm

    absolute free dating sites

  15. free speed dating chicago
    May 20, 2021 at 5:27 am

    best free online dating sites uk

  16. dating free online site
    May 19, 2021 at 8:14 pm

    sure free dating site

  17. free dating simulators
    May 19, 2021 at 6:35 pm

    free dating simulators

  18. prayeno
    May 15, 2021 at 8:46 am

    canadian pharmacy cialis

  19. what does the blue check mean on tinder
    May 14, 2021 at 9:23 pm

    what does the blue check mean on tinder

    Linux yum 命令 – rock funs

Meta
  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Categories
  • game
  • linux
  • news
  • pics
  • proxmox
  • windows
Recent Posts
  • proxmox7.3直通显卡
  • Proxmox VE 直通显卡方案及解决N卡Code43
  • Linux系统出现:You have new mail in /var/spool/mail/root 的原因及解决办法
  • debian系统解决中文乱码
  • pve添加git和pvetools
Recent Comments
  • EdgarTot on proxmox7.3直通显卡
  • Ashvem on proxmox7.3直通显卡
  • Tedvem on proxmox7.3直通显卡
  • Jackvem on proxmox7.3直通显卡
  • Miavem on proxmox7.3直通显卡
Archives
  • March 2023 (1)
  • December 2022 (4)
  • November 2022 (6)
  • April 2022 (1)
  • February 2022 (5)
  • January 2022 (2)
  • December 2021 (3)
  • November 2021 (1)
  • October 2021 (2)
  • September 2021 (1)
  • August 2021 (1)
  • July 2021 (8)
  • June 2021 (14)
  • May 2021 (2)
  • April 2021 (2)
  • March 2021 (10)
  • January 2021 (4)
  • December 2020 (4)
  • November 2020 (13)
  • April 2020 (276)
  • March 2020 (1)
  • June 2019 (5)
  • May 2019 (10)
  • December 2015 (1)