Linux基础之管理工具(RPM,YUM)

1.使用rpm安装zsh(忽略依赖关系安装)


C:\Users\勿忘初心>sftp root@192.168.45.130/22
root@192.168.45.130's password:
Connected to 192.168.45.130.
sftp> put D:\zsh-5.5.1-9.el8.x86_64.rpm
Uploading D:/zsh-5.5.1-9.el8.x86_64.rpm to /root/zsh-5.5.1-9.el8.x86_64.rpm
D:/zsh-5.5.1-9.el8.x86_64.rpm                                                                                                                              100% 2965KB 115.8MB/s   00:00

[root@bogon ~]# rpm -ivh zsh-5.5.1-9.el8.x86_64.rpm --nodeps
警告:zsh-5.5.1-9.el8.x86_64.rpm: 头V3 RSA/SHA256 Signature, 密钥 ID 8483c65d: NOKEY
Verifying...                          ################################# [100%]
准备中...                          ################################# [100%]
正在升级/安装...
   1:zsh-5.5.1-9.el8                  ################################# [100%]

查询是否已安装

[root@bogon ~]# rpm -qa|grep zsh-5.5.1-9.el8.x86_64
zsh-5.5.1-9.el8.x86_64

卸载zsh


[root@bogon ~]# rpm -e zsh-5.5.1-9.el8.x86_64

查询所有已安装软件

[root@bogon ~]# rpm -qa
device-mapper-event-1.02.177-10.el8.x86_64
libglvnd-egl-1.3.2-1.el8.x86_64
perl-libs-5.26.3-420.el8.x86_64
NetworkManager-adsl-1.32.10-4.el8.x86_64
dracut-049-191.git20210920.el8.x86_64
cups-pk-helper-0.2.6-5.el8.x86_64
libXmu-1.1.3-1.el8.x86_64
perl-PathTools-3.74-1.el8.x86_64
mlocate-0.26-20.el8.x86_64
systemd-239-51.el8.x86_64
tigervnc-server-minimal-1.11.0-9.el8.x86_64
acl-2.2.53-1.el8.x86_64

查询date命令所在软件包

[root@bogon ~]# whereis date
date: /usr/bin/date /usr/share/man/man1/date.1.gz /usr/share/man/man1p/date.1p.gz
[root@bogon ~]# cd /usr/bin/
[root@bogon bin]# rpm -qf date
coreutils-8.30-12.el8.x86_64

查询未安装的zsh的文件信息

[root@bogon bin]# rpm -ql zsh-5.5.1-9.el8.x86_64
未安装软件包 zsh-5.5.1-9.el8.x86_64 

2.yum本地源配置

[root@bogon dev]# mount /dev/cdrom /media/cdrom
mount: /media/cdrom: /dev/sr0 already mounted on /run/media/root/RHEL-8-5-0-BaseOS-x86_64.
[root@bogon dev]# cd ~
[root@bogon ~]# cd /etc/yum.repos.d/
[root@bogon yum.repos.d]# ls
CentOS-Base.repo  redhat.repo
[root@bogon yum.repos.d]# vim redhat.repo
[root@bogon yum.repos.d]# yum repolist 
正在更新 Subscription Management 软件仓库。
无法读取客户身份

本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。

仓库 'BaseOS' 在配置中缺少名称,将使用 id。
Repository AppStream is listed more than once in the configuration
仓库 id                         仓库名称
AppStream                       CentOS-8.5.2111 - AppStream - mirrors.aliyun.com
BaseOS                          BaseOS
base                            CentOS-8.5.2111 - Base - mirrors.aliyun.com
extras                          CentOS-8.5.2111 - Extras - mirrors.aliyun.com

yum网络源配置

[root@bogon ~]# wget https://mirrors.tuna.tsinghua.edu.cn/ redhat/rhel/rhel-8-beta.repo -P /etc/yum.repos.d/
--2022-04-12 20:05:18--  https://mirrors.tuna.tsinghua.edu.cn/
正在解析主机 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)... 101.6.15.130, 2402:f000:1:400::2
正在连接 mirrors.tuna.tsinghua.edu.cn (mirrors.tuna.tsinghua.edu.cn)|101.6.15.130|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:25719 (25K) [text/html]
正在保存至: “/etc/yum.repos.d/index.html”

index.html                                     100%[====================================================================================================>]  25.12K  --.-KB/s  用时 0s      

2022-04-12 20:05:19 (143 MB/s) - 已保存 “/etc/yum.repos.d/index.html” [25719/25719])

--2022-04-12 20:05:19--  http://redhat/rhel/rhel-8-beta.repo
正在解析主机 redhat (redhat)... 失败:未知的名称或服务。
wget: 无法解析主机地址 “redhat”
下载完毕 --2022-04-12 20:05:34--
总用时:16s
下载了:1 个文件,0s (143 MB/s) 中的 25K


[root@bogon yum.repos.d]# sed -i 's/enabled =0/enabled = 1/' /etc/yum.repos.d/index.html 

安装httpd软件

[root@bogon yum.repos.d]# yum install httpd
正在更新 Subscription Management 软件仓库。
无法读取客户身份

本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。

BaseOS                                                                                                                                                      2.7 MB/s | 2.8 kB     00:00    
AppStream                                                                                                                                                   3.1 MB/s | 3.2 kB     00:00    
依赖关系解决。
============================================================================================================================================================================================
 软件包                                       架构                             版本                                                               仓库                                 大小
============================================================================================================================================================================================
安装:
 httpd                                        x86_64                           2.4.37-41.module+el8.5.0+11772+c8e0c271                            AppStream                           1.4 M
安装依赖关系:
 apr                                          x86_64                           1.6.3-12.el8                                                       AppStream                           130 k
 apr-util                                     x86_64                           1.6.1-6.el8                                                        AppStream                           105 k
 httpd-filesystem                             noarch                           2.4.37-41.module+el8.5.0+11772+c8e0c271                            AppStream                            39 k
 httpd-tools                                  x86_64                           2.4.37-41.module+el8.5.0+11772+c8e0c271                            AppStream                           106 k
 mod_http2                                    x86_64                           1.15.7-3.module+el8.4.0+8625+d397f3da                              AppStream                           154 k
 redhat-logos-httpd                           noarch                           84.5-1.el8                                                         BaseOS                               29 k
安装弱的依赖:
 apr-util-bdb                                 x86_64                           1.6.1-6.el8                                                        AppStream                            25 k
 apr-util-openssl                             x86_64                           1.6.1-6.el8                                                        AppStream                            27 k
启用模块流:
 httpd                                                                         2.4                                                                                                         

事务概要
============================================================================================================================================================================================
安装  9 软件包

总计:2.0 M
安装大小:5.4 M
确定吗?[y/N]: y
下载软件包:
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中  :                                                                                                                                                                             1/1 
  安装    : apr-1.6.3-12.el8.x86_64                                                                                                                                                     1/9 
  运行脚本: apr-1.6.3-12.el8.x86_64                                                                                                                                                     1/9 
  安装    : apr-util-bdb-1.6.1-6.el8.x86_64                                                                                                                                             2/9 
  安装    : apr-util-openssl-1.6.1-6.el8.x86_64                                                                                                                                         3/9 
  安装    : apr-util-1.6.1-6.el8.x86_64                                                                                                                                                 4/9 
  运行脚本: apr-util-1.6.1-6.el8.x86_64                                                                                                                                                 4/9 
  安装    : httpd-tools-2.4.37-41.module+el8.5.0+11772+c8e0c271.x86_64                                                                                                                  5/9 
  运行脚本: httpd-filesystem-2.4.37-41.module+el8.5.0+11772+c8e0c271.noarch                                                                                                             6/9 
  安装    : httpd-filesystem-2.4.37-41.module+el8.5.0+11772+c8e0c271.noarch                                                                                                             6/9 
  安装    : redhat-logos-httpd-84.5-1.el8.noarch                                                                                                                                        7/9 
  安装    : mod_http2-1.15.7-3.module+el8.4.0+8625+d397f3da.x86_64                                                                                                                      8/9 
  安装    : httpd-2.4.37-41.module+el8.5.0+11772+c8e0c271.x86_64                                                                                                                        9/9 
  运行脚本: httpd-2.4.37-41.module+el8.5.0+11772+c8e0c271.x86_64                                                                                                                        9/9 
  验证    : redhat-logos-httpd-84.5-1.el8.noarch                                                                                                                                        1/9 
  验证    : apr-1.6.3-12.el8.x86_64                                                                                                                                                     2/9 
  验证    : apr-util-1.6.1-6.el8.x86_64                                                                                                                                                 3/9 
  验证    : apr-util-bdb-1.6.1-6.el8.x86_64                                                                                                                                             4/9 
  验证    : apr-util-openssl-1.6.1-6.el8.x86_64                                                                                                                                         5/9 
  验证    : httpd-2.4.37-41.module+el8.5.0+11772+c8e0c271.x86_64                                                                                                                        6/9 
  验证    : httpd-filesystem-2.4.37-41.module+el8.5.0+11772+c8e0c271.noarch                                                                                                             7/9 
  验证    : httpd-tools-2.4.37-41.module+el8.5.0+11772+c8e0c271.x86_64                                                                                                                  8/9 
  验证    : mod_http2-1.15.7-3.module+el8.4.0+8625+d397f3da.x86_64                                                                                                                      9/9 
已更新安装的产品。

已安装:
  apr-1.6.3-12.el8.x86_64                                       apr-util-1.6.1-6.el8.x86_64                               apr-util-bdb-1.6.1-6.el8.x86_64                                   
  apr-util-openssl-1.6.1-6.el8.x86_64                           httpd-2.4.37-41.module+el8.5.0+11772+c8e0c271.x86_64      httpd-filesystem-2.4.37-41.module+el8.5.0+11772+c8e0c271.noarch   
  httpd-tools-2.4.37-41.module+el8.5.0+11772+c8e0c271.x86_64    mod_http2-1.15.7-3.module+el8.4.0+8625+d397f3da.x86_64    redhat-logos-httpd-84.5-1.el8.noarch                              

完毕!

查看vim命令属于哪个软件包

[root@bogon yum.repos.d]# yum provides vim
正在更新 Subscription Management 软件仓库。
无法读取客户身份

本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。

上次元数据过期检查:0:01:50 前,执行于 2022年04月12日 星期二 20时13分26秒。
vim-enhanced-2:8.0.1763-16.el8.x86_64 : A version of the VIM editor which includes recent enhancements
仓库        :@System
匹配来源:
提供    : vim = 8.0.1763-16.el8

vim-enhanced-2:8.0.1763-16.el8.x86_64 : A version of the VIM editor which includes recent enhancements
仓库        :AppStream
匹配来源:
提供    : vim = 8.0.1763-16.el8

yum卸载httpd

[root@bogon yum.repos.d]# yum remove httpd
正在更新 Subscription Management 软件仓库。
无法读取客户身份

本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。

依赖关系解决。
============================================================================================================================================================================================
 软件包                                       架构                             版本                                                              仓库                                  大小
============================================================================================================================================================================================
移除:
 httpd                                        x86_64                           2.4.37-41.module+el8.5.0+11772+c8e0c271                           @AppStream                           4.3 M
清除未被使用的依赖关系:
 apr                                          x86_64                           1.6.3-12.el8                                                      @AppStream                           272 k
 apr-util                                     x86_64                           1.6.1-6.el8                                                       @AppStream                           230 k
 apr-util-bdb                                 x86_64                           1.6.1-6.el8                                                       @AppStream                            12 k
 apr-util-openssl                             x86_64                           1.6.1-6.el8                                                       @AppStream                            20 k
 httpd-filesystem                             noarch                           2.4.37-41.module+el8.5.0+11772+c8e0c271                           @AppStream                           400  
 httpd-tools                                  x86_64                           2.4.37-41.module+el8.5.0+11772+c8e0c271                           @AppStream                           194 k
 mod_http2                                    x86_64                           1.15.7-3.module+el8.4.0+8625+d397f3da                             @AppStream                           394 k
 redhat-logos-httpd                           noarch                           84.5-1.el8                                                        @BaseOS                              8.2 k

事务概要
============================================================================================================================================================================================
移除  9 软件包

将会释放空间:5.4 M
确定吗?[y/N]: y
运行事务检查
事务检查成功。
运行事务测试
事务测试成功。
运行事务
  准备中  :                                                                                                                                                                             1/1 
  运行脚本: httpd-2.4.37-41.module+el8.5.0+11772+c8e0c271.x86_64                                                                                                                        1/1 
  运行脚本: httpd-2.4.37-41.module+el8.5.0+11772+c8e0c271.x86_64                                                                                                                        1/9 
  删除    : httpd-2.4.37-41.module+el8.5.0+11772+c8e0c271.x86_64                                                                                                                        1/9 
  运行脚本: httpd-2.4.37-41.module+el8.5.0+11772+c8e0c271.x86_64                                                                                                                        1/9 
  删除    : httpd-filesystem-2.4.37-41.module+el8.5.0+11772+c8e0c271.noarch                                                                                                             2/9 
  运行脚本: httpd-filesystem-2.4.37-41.module+el8.5.0+11772+c8e0c271.noarch                                                                                                             2/9 
  删除    : redhat-logos-httpd-84.5-1.el8.noarch                                                                                                                                        3/9 
  删除    : httpd-tools-2.4.37-41.module+el8.5.0+11772+c8e0c271.x86_64                                                                                                                  4/9 
  删除    : apr-util-1.6.1-6.el8.x86_64                                                                                                                                                 5/9 
  运行脚本: apr-util-1.6.1-6.el8.x86_64                                                                                                                                                 5/9 
  删除    : apr-1.6.3-12.el8.x86_64                                                                                                                                                     6/9 
  运行脚本: apr-1.6.3-12.el8.x86_64                                                                                                                                                     6/9 
  删除    : apr-util-bdb-1.6.1-6.el8.x86_64                                                                                                                                             7/9 
  删除    : apr-util-openssl-1.6.1-6.el8.x86_64                                                                                                                                         8/9 
  删除    : mod_http2-1.15.7-3.module+el8.4.0+8625+d397f3da.x86_64                                                                                                                      9/9 
  运行脚本: mod_http2-1.15.7-3.module+el8.4.0+8625+d397f3da.x86_64                                                                                                                      9/9 
  验证    : apr-1.6.3-12.el8.x86_64                                                                                                                                                     1/9 
  验证    : apr-util-1.6.1-6.el8.x86_64                                                                                                                                                 2/9 
  验证    : apr-util-bdb-1.6.1-6.el8.x86_64                                                                                                                                             3/9 
  验证    : apr-util-openssl-1.6.1-6.el8.x86_64                                                                                                                                         4/9 
  验证    : httpd-2.4.37-41.module+el8.5.0+11772+c8e0c271.x86_64                                                                                                                        5/9 
  验证    : httpd-filesystem-2.4.37-41.module+el8.5.0+11772+c8e0c271.noarch                                                                                                             6/9 
  验证    : httpd-tools-2.4.37-41.module+el8.5.0+11772+c8e0c271.x86_64                                                                                                                  7/9 
  验证    : mod_http2-1.15.7-3.module+el8.4.0+8625+d397f3da.x86_64                                                                                                                      8/9 
  验证    : redhat-logos-httpd-84.5-1.el8.noarch                                                                                                                                        9/9 
已更新安装的产品。

已移除:
  apr-1.6.3-12.el8.x86_64                                       apr-util-1.6.1-6.el8.x86_64                               apr-util-bdb-1.6.1-6.el8.x86_64                                   
  apr-util-openssl-1.6.1-6.el8.x86_64                           httpd-2.4.37-41.module+el8.5.0+11772+c8e0c271.x86_64      httpd-filesystem-2.4.37-41.module+el8.5.0+11772+c8e0c271.noarch   
  httpd-tools-2.4.37-41.module+el8.5.0+11772+c8e0c271.x86_64    mod_http2-1.15.7-3.module+el8.4.0+8625+d397f3da.x86_64    redhat-logos-httpd-84.5-1.el8.noarch                              

完毕!


  清理缓存

[root@bogon yum.repos.d]# yum clean packages all
正在更新 Subscription Management 软件仓库。
无法读取客户身份

本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。

13 文件已删除


  重新创建缓存

[root@bogon yum.repos.d]# yum makecache
正在更新 Subscription Management 软件仓库。
无法读取客户身份

本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。

BaseOS                                                                                                                                                       45 MB/s | 2.4 MB     00:00    
AppStream                                                                                                                                                    67 MB/s | 7.2 MB     00:00    
上次元数据过期检查:0:00:01 前,执行于 2022年04月12日 星期二 20时18分49秒。
元数据缓存已建立。

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

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值