首页 > 代码库 > yum如何下载rpm包到本地

yum如何下载rpm包到本地

有时,我们需要下载一个rpm包,只是下载下来,拷贝给其他机器使用,前面也介绍过yum安装rpm包的时候,首先得下载这个rpm包然后再去安装,所以使用yum完全可以做到只下载而不安装。

(1)首先要安装 yum-downloadonly

[root@localhost ~]# yum install -y yum-plugin-downloadonly.noarch

如果你的CentOS是5.x版本,则需要安装yum-downloadonly.noarch这个包。

(2)下载一个rpm包而不安装

[root@localhost ~]# yum install 包名 -y --downloadonly

这样虽然下载了,但是并没有保存到我们想要的目录下,那么如何指定目录呢?

(3)下载到指定目录

[root@localhost~]#yum install 包名 -y --downloadonly --downloaddir=/usr/local/src

下载一个rpm包:

[root@localhost ~]# yum install -y yum-presto.noarch  --downloadonly --downloaddir=/usr/local/src/ Loaded plugins: downloadonly, fastestmirror, security Loading mirror speeds from cached hostfile * base: mirrors.btte.net * extras: mirrors.btte.net * updates: mirrors.btte.net Setting up Install Process Resolving Dependencies --> Running transaction check ---> Package yum-presto.noarch 0:0.6.2-1.el6 will be installed --> Processing Dependency: deltarpm >= 3.4-2 for package: yum-presto-0.6.2-1.el6.noarch --> Running transaction check ---> Package deltarpm.i686 0:3.5-0.5.20090913git.el6 will be installed --> Finished Dependency Resolution Dependencies Resolved ================================================================================ Package          Arch         Version                         Repository  Size ================================================================================ Installing: yum-presto       noarch       0.6.2-1.el6                     base        32 k Installing for dependencies: deltarpm         i686         3.5-0.5.20090913git.el6         base        73 k Transaction Summary ================================================================================ Install       2 Package(s) Total download size: 105 k Installed size: 257 k Downloading Packages: -------------------------------------------------------------------------------- Total                                            43 MB/s | 105 kB     00:00 exiting because --downloadonly specified [root@localhost ~]# ls /usr/local/src/ deltarpm-3.5-0.5.20090913git.el6.i686.rpm  yum-presto-0.6.2-1.el6.noarch.rpm


本文出自 “12350027” 博客,谢绝转载!

yum如何下载rpm包到本地