一、修改yum.conf配置文件參數,打開安裝包緩存字段keepcache=1
[root@localhost yum.repos.d]# vim /etc/yum.conf
[main] cachedir=/var/cache/yum/$basearch/$releasever keepcache=1
二、執行yum 安裝命令
[root@localhost yum.repos.d]# yum install telnet -y Loaded plugins: fastestmirror Loading mirror speeds from cached hostfile * base: mirrors.aliyun.com * centos-sclo-rh: mirrors.bupt.edu.cn * centos-sclo-sclo: mirrors.bupt.edu.cn * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com Resolving Dependencies --> Running transaction check ---> Package telnet.x86_64 1:0.17-66.el7 will be installed --> Finished Dependency Resolution Dependencies Resolved ============================================================================================================================ Package Arch Version Repository Size ============================================================================================================================ Installing: telnet x86_64 1:0.17-66.el7 updates 64 k Transaction Summary ============================================================================================================================ Install 1 Package Total download size: 64 k Installed size: 113 k Downloading packages: telnet-0.17-66.el7.x86_64.rpm | 64 kB 00:00:00 Running transaction check Running transaction test Transaction test succeeded Running transaction Installing : 1:telnet-0.17-66.el7.x86_64 1/1 Verifying : 1:telnet-0.17-66.el7.x86_64 1/1 Installed: telnet.x86_64 1:0.17-66.el7 Complete! [root@localhost yum.repos.d]#
三、查看緩存的rpm安裝包
[root@localhost /]# cd /var/cache/yum/x86_64/7/updates/packages/ [root@localhost packages]# ll total 68 -rw-r--r-- 1 root root 65932 Nov 18 2020 telnet-0.17-66.el7.x86_64.rpm [root@localhost packages]#
如果updates目錄下沒有就去base目錄下的packages下找。