利用yum下载rpm而不安装包

jackxiang 2012-10-26 14:58 | |
请问是用Yum install命令安装时下载的文件包放在哪里了?
Centos下yum-downloadonly软件包
yum-downloadonly用于下载所需要的软件包而并不真正的安装,下载好的软件包方便在没有网络的情况下使用
安装:
yum install yum-downloadonly
查看/etc/yum/pluginconf.d/downloadonly.conf,确包插件是启用的,即:
[main]
enabled=1
例如:下载Apache软件包,并放在/下
yum install --downloadonly --downloaddir=/ httpd

我试下下载一个Dos2Unix的rpm包放在/root/software目录下:
root@192.168.98.128:/var/cache/yum/i386# yum install --downloadonly --downloaddir=/root/software  dos2unix
Loaded plugins: downloadonly, fastestmirror, presto
Loading mirror speeds from cached hostfile
* base: mirrors.btte.net
* extras: mirrors.btte.net
* updates: mirrors.btte.net
Setting up Install Process
Package dos2unix-3.1-37.el6.i686 already installed and latest version
Nothing to do

发现已经安装了则卸载:
root@192.168.98.128:/var/cache/yum/i386# rpm -e dos2unix-3.1-37.el6.i686
root@192.168.98.128:/var/cache/yum/i386# yum install --downloadonly --downloaddir=/root/software  dos2unix
Loaded plugins: downloadonly, fastestmirror, presto
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 dos2unix.i686 0:3.1-37.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved
======================================
Package   Arch  Version        Repository                   Size
======================================
Installing:
dos2unix  i686  3.1-37.el6     base   15 k

Transaction Summary
======================================
Install       1 Package(s)

Total download size: 15 k
Installed size: 17 k
Is this ok [y/N]: y
Downloading Packages:
Setting up and reading Presto delta metadata
Processing delta metadata
Package(s) data still to download: 15 k
dos2unix-3.1-37.el6.i686.rpm                                                                                 |  15 kB     00:00    


exiting because --downloadonly specified
root@192.168.98.128:/var/cache/yum/i386# ls /root/software/dos2unix-3.1-37.el6.i686.rpm
/root/software/dos2unix-3.1-37.el6.i686.rpm
包有了,可以弄到其他机器(上不了网的)上再安装一次,刚才那个本机也没有安上,于是也安一次:
rpm -ihv /root/software/dos2unix-3.1-37.el6.i686.rpm  
Preparing...                ########################################### [100%]
   1:dos2unix               ########################################### [100%]

作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:http://jackxiang.com/post/5695/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!


最后编辑: jackxiang 编辑于2012-10-26 15:06
评论列表
发表评论

昵称

网址

电邮

打开HTML 打开UBB 打开表情 隐藏 记住我 [登入] [注册]