yum安装软件之后保存rpm包

修改/etc/yum.conf

[root@node03 ~]# vim /etc/yum.conf
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0  <----------- 这里改为1
debuglevel=2
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release

查看目录/var/cache/yum/x86_64/7/

[root@node03 ~]# ll /var/cache/yum/x86_64/7/
total 16
drwxr-xr-x. 4 root root 4096 Aug  1 16:17 base
drwxr-xr-x. 4 root root 4096 Aug  1 16:17 epel
drwxr-xr-x. 4 root root  276 Aug  1 16:17 extras
-rw-r--r--  1 root root  248 Aug  1 16:18 timedhosts
-rw-r--r--. 1 root root 1283 Aug  1 09:23 timedhosts.txt
drwxr-xr-x. 4 root root  276 Aug  1 16:17 updates

查看如下目录即可:

/var/cache/yum/x86_64/7/base/packages/
/var/cache/yum/x86_64/7/epel/packages/
/var/cache/yum/x86_64/7/extras/packages/
/var/cache/yum/x86_64/7/updates/packages/

使用yum-utils

yum install -y yum-utils
yumdownloader --destdir=/root/software bash-completion
                 |                         |
                 |---> 指定下载目录          |--->要安装的软件包

你可能感兴趣的:(运维及自动化,操作系统)