yum的用法

1.yum -y install安装

2.yum -y remove卸载

3.yum search dhcp :搜索软件包包含DHCP或者软件summary里包含DHCP的

冒号后面就是描述

[root@localhost yum.repos.d]# yum search pam
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
========================================================================== N/S matched: pam ===========================================================================
PyPAM.x86_64 : PAM bindings for Python
evolution-spamassassin.x86_64 : SpamAssassin plugin for Evolution
fprintd-pam.i686 : PAM module for fingerprint authentication
fprintd-pam.x86_64 : PAM module for fingerprint authentication
gdm-pam-extensions-devel.i686 : Macros for developing GDM extensions to PAM
gdm-pam-extensions-devel.x86_64 : Macros for developing GDM extensions to PAM
gnome-keyring-pam.i686 : Pam module for unlocking keyrings
gnome-keyring-pam.x86_64 : Pam module for unlocking keyrings
mod_authnz_pam.x86_64 : PAM authorization checker and PAM Basic Authentication provider
pam-devel.i686 : Files needed for developing PAM-aware applications and modules for PAM
pam-devel.x86_64 : Files needed for developing PAM-aware applications and modules for PAM
pam_pkcs11.i686 : PKCS #11/NSS PAM login module
pam_pkcs11.x86_64 : PKCS #11/NSS PAM login module
pam_snapper.i686 : PAM module for calling snapper
pam_snapper.x86_64 : PAM module for calling snapper
pam_ssh_agent_auth.i686 : PAM module for authentication with ssh-agent
pam_ssh_agent_auth.x86_64 : PAM module for authentication with ssh-agent
spamassassin.x86_64 : Spam filter for email which can be invoked from mail delivery agents
bogofilter.x86_64 : Fast anti-spam filtering by Bayesian statistical analysis
libcgroup-pam.i686 : A Pluggable Authentication Module for libcgroup
libcgroup-pam.x86_64 : A Pluggable Authentication Module for libcgroup
mod_intercept_form_submit.x86_64 : Apache module to intercept login form submission and run PAM authentication
nss-pam-ldapd.i686 : An nsswitch module which uses directory servers
nss-pam-ldapd.x86_64 : An nsswitch module which uses directory servers
opa-libopamgt.x86_64 : Omni-Path management API library
opa-libopamgt-devel.x86_64 : Omni-Path library development headers
pam.i686 : An extensible library which provides authentication for applications
pam.x86_64 : An extensible library which provides authentication for applications
pam_krb5.i686 : A Pluggable Authentication Module for Kerberos 5
pam_krb5.x86_64 : A Pluggable Authentication Module for Kerberos 5
passwd.x86_64 : An utility for setting or changing passwords using PAM
sssd-client.i686 : SSSD Client libraries for NSS and PAM
sssd-client.x86_64 : SSSD Client libraries for NSS and PAM

  Name and summary matches only, use "search all" for everything.
[root@localhost yum.repos.d]# yum info PyPAM.x86_64
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
Available Packages
Name        : PyPAM
Arch        : x86_64
Version     : 0.5.0
Release     : 19.el7
Size        : 25 k
Repo        : base/7/x86_64
Summary     : PAM bindings for Python
URL         : http://www.pangalactic.org/PyPAM
License     : LGPLv2
Description : PAM (Pluggable Authentication Module) bindings for Python.

[root@localhost yum.repos.d]# 

4.yum list:列出所有服务器上的软件包,不只是已经安装的

前面显示的是installed (已安装)

后面显示的是还可以安装的软件,available

5.列出所有和pam开头的软件包

yum list pam*   :list后面接的是软件包的名字

[root@localhost yum.repos.d]# yum list pam*
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
Installed Packages
pam.x86_64                                                                         1.1.8-23.el7                                                               @anaconda
Available Packages
pam.i686                                                                           1.1.8-23.el7                                                               base     
pam-devel.i686                                                                     1.1.8-23.el7                                                               base     
pam-devel.x86_64                                                                   1.1.8-23.el7                                                               base     
pam_krb5.i686                                                                      2.4.8-6.el7                                                                base     
pam_krb5.x86_64                                                                    2.4.8-6.el7                                                                base     
pam_pkcs11.i686                                                                    0.6.2-30.el7                                                               base     
pam_pkcs11.x86_64                                                                  0.6.2-30.el7                                                               base     
pam_snapper.i686                                                                   0.2.8-4.el7                                                                base     
pam_snapper.x86_64                                                                 0.2.8-4.el7                                                                base     
pam_ssh_agent_auth.i686                                                            0.10.3-2.22.el7_9                                                          updates  
pam_ssh_agent_auth.x86_64                                                          0.10.3-2.22.el7_9                                                          updates  
[root@localhost yum.repos.d]# 

5.yum info就是查看软件包的具体信息

如果是没有安装的就会显示avaiable

[root@localhost ~]# yum info dhcp
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
Available Packages
Name        : dhcp
Arch        : x86_64
Epoch       : 12
Version     : 4.2.5
Release     : 83.el7.centos.1
Size        : 515 k
Repo        : updates/7/x86_64
Summary     : Dynamic host configuration protocol software
URL         : http://isc.org/products/DHCP/
License     : ISC
Description : DHCP (Dynamic Host Configuration Protocol) is a protocol which allows
            : individual devices on an IP network to get their own network
            : configuration information (IP address, subnetmask, broadcast address,
            : etc.) from a DHCP server. The overall purpose of DHCP is to make it
            : easier to administer a large network.
            : 
            : To use DHCP on your network, install a DHCP service (or relay agent),
            : and on clients run a DHCP client daemon.  The dhcp package provides
            : the ISC DHCP service and relay agent.

 如果没有安装会写installed

[root@localhost gen]# yum info ftp
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
Installed Packages
Name        : ftp
Arch        : x86_64
Version     : 0.17
Release     : 67.el7
Size        : 96 k
Repo        : installed
From repo   : base
Summary     : The standard UNIX FTP (File Transfer Protocol) client
URL         : ftp://ftp.linux.org.uk/pub/linux/Networking/netkit
License     : BSD with advertising
Description : The ftp package provides the standard UNIX command-line FTP (File
            : Transfer Protocol) client.  FTP is a widely used protocol for
            : transferring files over the Internet and for archiving files.
            : 
            : If your system is on a network, you should install ftp in order to do
            : file transfers.

6.yum provides passwd想知道passwd这个命令是什么软件包提供的,可以用provides这个命令

图中的示例是/usr/sbin/ip

[root@localhost yum.repos.d]# yum provides /usr/sbin/ip
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
iproute-4.11.0-30.el7.x86_64 : Advanced IP routing and network device configuration tools
Repo        : base
Matched from:
Filename    : /usr/sbin/ip



iproute-4.11.0-30.el7.x86_64 : Advanced IP routing and network device configuration tools
Repo        : @anaconda
Matched from:
Filename    : /usr/sbin/ip

7.yum install/update 软件包

默认安装最新,如果想要安装指定的版本,后面写上软件包的全名

[root@localhost yum.repos.d]# yum provides ftp
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.cn99.com
 * extras: mirrors.cn99.com
 * updates: mirrors.cn99.com
ftp-0.17-67.el7.x86_64 : The standard UNIX FTP (File Transfer Protocol) client
Repo        : base



[root@localhost yum.repos.d]# yum install ftp-0.17-67.el7.x86_64
Loaded plugins: fastestmirror

8.yum的设置文件,在/etc/yum.repos.d/里面有.repo结尾的文件,这个文件里面就是存放版本的各个容器

[root@localhost yum.repos.d]# cat docker-ce.repo
[docker-ce-stable]   #中括号里是容器的名字
name=Docker CE Stable - $basearch
baseurl=https://mirrors.aliyun.com/docker-ce/linux/centos/$releasever/$basearch/stable #容器的实际地址
#mirrorlist= 不想要可以comment掉,表示的是让yum 自行去镜像站点上找。
enabled=1   #enable这个容器,不想enable就写0
gpgcheck=1  #是否查阅RPM软件的数字证书
gpgkey=https://mirrors.aliyun.com/docker-ce/linux/centos/gpg #公钥存放的地址

9.修改repo以后,因为yum会下载容器放到/var/cache/yum里,如果修改了网址却没有修改容器名,有可能导致本机的列表和服务器不同步,所有先yum clean all,yum makecache

10.yum clean all删除所有容器数据

11.yum clean 软件包名字,删除下载的这个软件包的文件

12.yum clean 软件头, 删除下载的这个软件头

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值