安装扩展源epel,yum下载rpm包

一,安装扩展源epel

只安装一个CentOS7-Base-163.repo基础源是不够用的,有时候安装RPM包的时候没有一些扩展的东西。

# yum install -y epel-release      //安装扩展源epel
[root@localhost 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

说明:可以看出安装了两个文件分别是epel.repo,epel-testing.repo。最核心的是epel.repo。


  • 使用yum list会发现增加了很多包
#yum list|grep epel
tesseract-langpack-enm.noarch           3.04.00-3.el7                  epel     
tesseract-langpack-epo.noarch           3.04.00-3.el7                  epel     
tesseract-langpack-equ.noarch           3.04.00-3.el7                  epel     
tesseract-langpack-est.noarch           3.04.00-3.el7                  epel     
tesseract-langpack-eus.noarch           3.04.00-3.el7                  epel     
tesseract-langpack-fas.noarch           3.04.00-3.el7                  epel     
tesseract-langpack-fin.noarch           3.04.00-3.el7                  epel     
tesseract-langpack-fra.noarch           3.04.00-3.el7                  epel     
tesseract-langpack-frk.noarch           3.04.00-3.el7                  epel     
tesseract-langpack-frm.noarch           3.04.00-3.el7                  epel     
tesseract-langpack-gle.noarch           3.04.00-3.el7                  epel     
tesseract-langpack-glg.noarch           3.04.00-3.el7                  epel     
tesseract-langpack-grc.noarch           3.04.00-3.el7                  epel     
tesseract-langpack-guj.noarch           3.04.00-3.el7                  epel     
tesseract-langpack-hat.noarch           3.04.00-3.el7                  epel     
tesseract-langpack-heb.noarch           3.04.00-3.el7                  epel     
tesseract-langpack-hin.noarch           3.04.00-3.el7                  epel     
tesseract-langpack-hrv.noarch           3.04.00-3.el7                  epel     
.......................

二,yum下载PRM包

  • yum install -y 包名 –downloadonly //下载RPM包而不安装
  • yum install -y 包名 –downloadnly –downloaddir=路径 //下载到指定的目录下
  • yum reinstall -y 包名 –downloadnly –downloaddir=路径 //下载已经安装过的RPM包到指定的目录下
  • ls /var/cache/yum/x86_64/7/ //下载RPM包的地址

  • 下载未安装的rpm包
[root@localhost yum.repos.d]# yum install zsh --downloadonly    //下载zsh包而不安装
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * epel: mirror01.idc.hinet.net
正在解决依赖关系
--> 正在检查事务
---> 软件包 zsh.x86_64.0.5.0.2-28.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

======================================================================================
 Package         架构               版本                       源                大小
======================================================================================
正在安装:
 zsh             x86_64             5.0.2-28.el7               base             2.4 M

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

总下载量:2.4 M
安装大小:5.6 M
Background downloading packages, then exiting:
zsh-5.0.2-28.el7.x86_64.rpm                                    | 2.4 MB  00:00:01     
exiting because "Download Only" specified
[root@localhost yum.repos.d]# rpm -q zsh    //查看是否安装
未安装软件包 zsh 

  • 下载未安装的RPM包并指定路径
[root@localhost yum.repos.d]# yum install zsh --downloadonly --downloaddir=/tmp/    //下载zsh包并指定路径为/tmp/下
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * epel: mirrors.ustc.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 zsh.x86_64.0.5.0.2-28.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

======================================================================================
 Package         架构               版本                       源                大小
======================================================================================
正在安装:
 zsh             x86_64             5.0.2-28.el7               base             2.4 M

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

总下载量:2.4 M
安装大小:5.6 M
Background downloading packages, then exiting:
exiting because "Download Only" specified
[root@localhost yum.repos.d]# ls /tmp    //可以看到最后一个就是zsh的包
1.txt.bz2
1.txt.gz
2.txt.xz
d6z
systemd-private-9c22b8392f96450dbb860673eb6fc475-systemd-hostnamed.service-pbtygD
systemd-private-9c22b8392f96450dbb860673eb6fc475-vmtoolsd.service-aiRxbT
systemd-private-a8e9aa48a42c456d87283388533d71d6-vmtoolsd.service-IQNhNA
xxx.conf
yum_save_tx.2017-11-13.19-04.dUj53q.yumtx
yum_save_tx.2017-11-13.19-47.Ct3gxQ.yumtx
yum_save_tx.2017-11-14.13-38.fhdcdp.yumtx
yum_save_tx.2017-11-14.15-48.SWwDlT.yumtx
yum_save_tx.2017-11-14.15-53.X0GEaL.yumtx
yum_save_tx.2017-11-14.15-56.AyZGxP.yumtx
zsh-5.0.2-28.el7.x86_64.rpm

  • 下载以安装的rpm包并指定路径
[root@localhost yum.repos.d]# yum reinstall vim-enhanced --downloadonly --downloaddir=/tmp/
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * epel: mirrors.ustc.edu.cn
正在解决依赖关系
--> 正在检查事务
---> 软件包 vim-enhanced.x86_64.2.7.4.160-2.el7 将被 已重新安装
--> 解决依赖关系完成

依赖关系解决

======================================================================================
 Package               架构            版本                       源             大小
======================================================================================
重新安装:
 vim-enhanced          x86_64          2:7.4.160-2.el7            base          1.0 M

事务概要
======================================================================================
重新安装  1 软件包

总下载量:1.0 M
安装大小:2.2 M
Background downloading packages, then exiting:
vim-enhanced-7.4.160-2.el7.x86_64.rpm                          | 1.0 MB  00:00:00     
exiting because "Download Only" specified
[root@localhost yum.repos.d]# ls /tmp
1.txt.bz2                                                                          yum_save_tx.2017-11-13.19-04.dUj53q.yumtx
1.txt.gz                                                                           yum_save_tx.2017-11-13.19-47.Ct3gxQ.yumtx
2.txt.xz                                                                           yum_save_tx.2017-11-14.13-38.fhdcdp.yumtx
d6z                                                                                yum_save_tx.2017-11-14.15-48.SWwDlT.yumtx
systemd-private-9c22b8392f96450dbb860673eb6fc475-systemd-hostnamed.service-pbtygD  yum_save_tx.2017-11-14.15-53.X0GEaL.yumtx
systemd-private-9c22b8392f96450dbb860673eb6fc475-vmtoolsd.service-aiRxbT           yum_save_tx.2017-11-14.15-56.AyZGxP.yumtx
systemd-private-a8e9aa48a42c456d87283388533d71d6-vmtoolsd.service-IQNhNA           yum_save_tx.2017-11-14.16-03._I0hB1.yumtx
vim-enhanced-7.4.160-2.el7.x86_64.rpm                                              zsh-5.0.2-28.el7.x86_64.rpm
xxx.conf

你可能感兴趣的:(Linux软件包安装和卸载)