如果只想通过yum下载软件的安装包,但是不需要进行安装的话,可以使用 yumdownloader 命令。
yumdownloader 命令在软件包 yum-utils 里面。
先安装 yum-utils :
yum install yum-utils -y
查看 yum-utils 软件包里面都有哪些命令:
# rpm -ql yum-utils /etc/bash_completion.d /etc/bash_completion.d/yum-utils.bash /usr/bin/debuginfo-install /usr/bin/find-repos-of-install /usr/bin/needs-restarting /usr/bin/package-cleanup /usr/bin/repo-graph /usr/bin/repo-rss /usr/bin/repoclosure /usr/bin/repodiff /usr/bin/repomanage /usr/bin/repoquery /usr/bin/reposync /usr/bin/repotrack /usr/bin/show-changed-rco /usr/bin/show-installed /usr/bin/verifytree /usr/bin/yum-builddep /usr/bin/yum-config-manager /usr/bin/yum-debug-dump /usr/bin/yum-debug-restore /usr/bin/yum-groups-manager /usr/bin/yumdownloader /usr/lib/python2.6/site-packages/yumutils /usr/lib/python2.6/site-packages/yumutils/__init__.py /usr/lib/python2.6/site-packages/yumutils/__init__.pyc /usr/lib/python2.6/site-packages/yumutils/__init__.pyo /usr/lib/python2.6/site-packages/yumutils/i18n.py /usr/lib/python2.6/site-packages/yumutils/i18n.pyc /usr/lib/python2.6/site-packages/yumutils/i18n.pyo /usr/sbin/yum-complete-transaction /usr/sbin/yumdb /usr/share/doc/yum-utils-1.1.30 /usr/share/doc/yum-utils-1.1.30/COPYING /usr/share/doc/yum-utils-1.1.30/README /usr/share/doc/yum-utils-1.1.30/yum-util-cli-template /usr/share/locale/da/LC_MESSAGES/yum-utils.mo /usr/share/man/man1/debuginfo-install.1.gz /usr/share/man/man1/find-repos-of-install.1.gz /usr/share/man/man1/needs-restarting.1.gz /usr/share/man/man1/package-cleanup.1.gz /usr/share/man/man1/repo-graph.1.gz /usr/share/man/man1/repo-rss.1.gz /usr/share/man/man1/repoclosure.1.gz /usr/share/man/man1/repodiff.1.gz /usr/share/man/man1/repomanage.1.gz /usr/share/man/man1/repoquery.1.gz /usr/share/man/man1/reposync.1.gz /usr/share/man/man1/repotrack.1.gz /usr/share/man/man1/show-changed-rco.1.gz /usr/share/man/man1/show-installed.1.gz /usr/share/man/man1/verifytree.1.gz /usr/share/man/man1/yum-builddep.1.gz /usr/share/man/man1/yum-config-manager.1.gz /usr/share/man/man1/yum-debug-dump.1.gz /usr/share/man/man1/yum-debug-restore.1.gz /usr/share/man/man1/yum-groups-manager.1.gz /usr/share/man/man1/yum-utils.1.gz /usr/share/man/man1/yumdownloader.1.gz /usr/share/man/man8/yum-complete-transaction.8.gz /usr/share/man/man8/yumdb.8.gz
可以看到 yumdownloader 命令也在其中(上面红色背景的那一行)。
测试:
比如只想下载 busybox 但是不安装,默认下载到当前目录下,可以执行如下指令:
# yumdownloader busybox Loaded plugins: fastestmirror, refresh-packagekit Loading mirror speeds from cached hostfile * base: mirrors.yun-idc.com * extras: mirrors.yun-idc.com * updates: mirrors.yun-idc.com busybox-1.15.1-21.el6_6.x86_64.rpm | 611 kB 00:01 # ls busybox-1.15.1-21.el6_6.x86_64.rpm