## 安装扩展源 epel
```
[root@jzplinux-01 yum.repos.d]# yum install -y epel-release
[root@jzplinux-01 yum.repos.d]# ls
CentOS7-Base-163.repo CentOS-fasttrack.repo CentOS-Vault.repo
CentOS-CR.repo CentOS-Media.repo epel.repo
CentOS-Debuginfo.repo CentOS-Sources.repo epel-testing.repo
```
## yum install -y zsh --downloadonly ;表示仅仅下载,不安装
```
[root@jzplinux-01 yum.repos.d]# yum install -y zsh --downloadonly
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* epel: ftp.jaist.ac.jp
正在解决依赖关系
--> 正在检查事务
---> 软件包 zsh.x86_64.0.5.0.2-25.el7_3.1 将被 安装
--> 解决依赖关系完成
依赖关系解决
===============================================================================================
Package 架构 版本 源 大小
===============================================================================================
正在安装:
zsh x86_64 5.0.2-25.el7_3.1 updates 2.4 M
事务概要
===============================================================================================
安装 1 软件包
总下载量:2.4 M
安装大小:5.6 M
Background downloading packages, then exiting:
zsh-5.0.2-25.el7_3.1.x86_64.rpm | 2.4 MB 00:01:29
exiting because "Download Only" specified
[root@jzplinux-01 yum.repos.d]# rpm -q zsh
未安装软件包 zsh
[root@jzplinux-01 yum.repos.d]#
```
## ls /var/cache/yum/x86_64/7 ; 默认存放下载的rpm包的路径
```
[root@jzplinux-01 yum.repos.d]# ls /var/cache/yum/x86_64/7
base dvd epel extras timedhosts timedhosts.txt updates
[root@jzplinux-01 yum.repos.d]# ls /var/cache/yum/x86_64/7/updates/packages/
zsh-5.0.2-25.el7_3.1.x86_64.rpm zsh-5.0.2-25.el7_3.1.x86_64.rpm.3198.tmp
[root@jzplinux-01 yum.repos.d]#
```
## yum install -y zsh --downloadonly --downloaddir=/tmp/ ;指定rpm包下载存放路径
```
[root@jzplinux-01 yum.repos.d]# yum install -y zsh --downloadonly --downloaddir=/tmp/
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* epel: mirror01.idc.hinet.net
正在解决依赖关系
--> 正在检查事务
---> 软件包 zsh.x86_64.0.5.0.2-25.el7_3.1 将被 安装
--> 解决依赖关系完成
依赖关系解决
===============================================================================================
Package 架构 版本 源 大小
===============================================================================================
正在安装:
zsh x86_64 5.0.2-25.el7_3.1 updates 2.4 M
事务概要
===============================================================================================
安装 1 软件包
总下载量:2.4 M
安装大小:5.6 M
Background downloading packages, then exiting:
exiting because "Download Only" specified
[root@jzplinux-01 yum.repos.d]# ls /tmp
1.txt.bz2
1.txt.gz
2.txt.xz
d6z
data
systemd-private-981800ab92974028b7b8d78f1284cd97-vmtoolsd.service-cgDPbW
systemd-private-baa7ccf9078b4ad6997102c4aa94295a-vmtoolsd.service-awAtr5
yum_save_tx.2017-06-24.21-30.q7FhWg.yumtx
yum_save_tx.2017-06-24.21-36.OYimNl.yumtx
yum_save_tx.2017-06-24.21-49.dHv31O.yumtx
zsh-5.0.2-25.el7_3.1.x86_64.rpm
[root@jzplinux-01 yum.repos.d]#
```
## yum install -y vim-enhanced --downloadonly --downloaddir=/tmp/ ; 已经安装的rpm 包不能下载
```
[root@jzplinux-01 yum.repos.d]# yum install -y vim-enhanced --downloadonly --downloaddir=/tmp/
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* epel: epel.mirror.angkasa.id
软件包 2:vim-enhanced-7.4.160-1.el7_3.1.x86_64 已安装并且是最新版本
无须任何处理
[root@jzplinux-01 yum.repos.d]#
```
## yum reinstall -y vim-enhanced --downloadonly --downloaddir=/tmp/ ;重新安装包“reinstall” 并指定rpm包下载存放路径
```
[root@jzplinux-01 yum.repos.d]# yum reinstall -y vim-enhanced --downloadonly --downloaddir=/tmp/
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* epel: mirror01.idc.hinet.net
正在解决依赖关系
--> 正在检查事务
---> 软件包 vim-enhanced.x86_64.2.7.4.160-1.el7_3.1 将被 已重新安装
--> 解决依赖关系完成
依赖关系解决
===============================================================================================
Package 架构 版本 源 大小
===============================================================================================
重新安装:
vim-enhanced x86_64 2:7.4.160-1.el7_3.1 updates 1.0 M
事务概要
===============================================================================================
重新安装 1 软件包
总下载量:1.0 M
安装大小:2.2 M
Background downloading packages, then exiting:
vim-enhanced-7.4.160-1.el7_3.1.x86_64.rpm | 1.0 MB 00:00:06
exiting because "Download Only" specified
[root@jzplinux-01 yum.repos.d]#
[root@jzplinux-01 yum.repos.d]# ls /tmp
1.txt.bz2
1.txt.gz
2.txt.xz
d6z
data
systemd-private-981800ab92974028b7b8d78f1284cd97-vmtoolsd.service-cgDPbW
systemd-private-baa7ccf9078b4ad6997102c4aa94295a-vmtoolsd.service-awAtr5
vim-enhanced-7.4.160-1.el7_3.1.x86_64.rpm
yum_save_tx.2017-06-24.21-30.q7FhWg.yumtx
yum_save_tx.2017-06-24.21-36.OYimNl.yumtx
yum_save_tx.2017-06-24.21-49.dHv31O.yumtx
yum_save_tx.2017-06-24.22-01.AiQg3g.yumtx
zsh-5.0.2-25.el7_3.1.x86_64.rpm
[root@jzplinux-01 yum.repos.d]#
```