yum实现仅仅下载不安装包

  问题的产生,都是源于真实的需求。。。

01、yum安装切保存rpm包于本地

[root@yhs_web_1 ~]# vim /etc/yum.conf 

[main]
cachedir=/var/cache/yum/$basearch/$releasever  #保存路径
keepcache=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=16&ref=http://bugs.centos.org/bug_report
_page.php?category=yumdistroverpkg=centos-release

#  This is the default, if you make this bigger yum won't see if the metadata
# is newer on the remote and so you'll "gain" the bandwidth of not having to
# download the new metadata and "pay" for it by yum not having correct
# information.
#  It is esp. important, to have correct metadata, for distributions like
# Fedora which don't keep old packages around. If you don't like this checking
# interupting your command line usage, it's much better to have something
# manually check the metadata once an hour (yum-updatesd will do this).
# metadata_expire=90m

# PUT YOUR REPOS HERE OR IN separate files named file.repo
# in /etc/yum.repos.d

02、下载指定rpm包,不安装

yum  install -y yum-utils       #yumdownloade

yumdownloade  openssh    #下载切保存到本地

03、下载rpm包切下载依赖相关包,不安装

yum -y install yum-downloadonly   #yum 插件

yum -y install --downloadonly --downloaddir=/tmp/ vlock  

--downloadongly   仅仅下载

--downloaddir        指定保存目录

yum-downloadonly:

链接: https://pan.baidu.com/s/1i5L4NOx 密码: 99tb

 

posted @ 2017-10-19 13:51  mvpbang  阅读(536)  评论(0编辑  收藏  举报