怎样使用yum只下载一个包而不安装呢?
解决方法:
相关发行版: 红帽企业版Linux 5
请确认yum-downloadonly包已经安装。如果没有安装,可以从红帽网络(RHN) 下载。如果系统已经注册到RHN,可以执行以下命令安装yum-downloadonly包:
#yum install yum-downloadonly
yum-downloadonly是yum的一个插件,使得yum可以从RHN或者yum的仓库只下载包而不安装。 检查一下/etc/yum/pluginconf.d/downloadonly.conf的内容,确认这个插件已经启用:
[main] enabled=1
例如我们要下载vsftpd的最新版本,而不安装它,执行命令:
# yum install --downloadonly vsftpd Loading "downloadonly" plugin Loading "rhnplugin" plugin rhel-i386-server-5 100% |=========================| 1.4 kB 00:00 Setting up Install Process Parsing package install arguments Package vsftpd - 2.0.5-10.el5.i386 is already installed. Resolving Dependencies --> Running transaction check ---> Package vsftpd.i386 0:2.0.5-12.el5 set to be updated --> Finished Dependency Resolution Dependencies Resolved ============================================================================= Package Arch Version Repository Size ====! ========================================================================= Updating: vsftpd i386 2.0.5-12.el5 rhel-i386-server-5 138 k Transaction Summary ============================================================================= Install 0 Package(s) Update 1 Package(s) Remove 0 Package(s) Total download size: 138 k Is this ok [y/N]: y Downloading Packages: (1/1): vsftpd-2.0.5-12.el 100% |=========================| 138 kB 00:02 exiting because --downloadonly specified
默认的,包会被报存在/var/cache/yum/{RepositoryName}/packages/目录中。在这里 {RepositoryName}是rhel-i386-server-5。 指定yum的参数--downloaddir,和--downloadonly一并使用,来指定另外的目录来存放下载的包。
#yum install --downloadonly --downloaddir=/tmp vsftpd