使用yum下载而不安装rpm包 - linux operation - benxiong

来源:百度文库 编辑:神马文学网 时间:2024/04/28 20:45:23


您查询的关键词是:yum 下载 rpm  。如果打开速度慢,可以尝试快速版;如果想保存快照,可以添加到搜藏。
(百度和网页http://blog.chinaunix.net/u/22677/showart_1183254.html的作者无关,不对其内容负责。百度快照谨为网络故障时之索引,不代表被搜索网站的即时页面。)
博客首页注册建议与交流排行榜推荐投诉 搜索:帮助
benxiong
 
人生有时候没有的选择!
benxiong.cublog.cn管理博客
发表文章
留言
收藏夹· linux security
博客圈
音乐
相册
文章· Cloud   }· IaaS   }· Nimbus
· linux operation· linux server   }· Cluster   }· LVS· Torque
· DHCP· DNS· HTTP· LDAP· MediaWiki· NIS · SAMBA· svn-cvs
· Program   }· HTML· Linux C/C++· Shell
· Virtualization   }· Xen
· Network   }· Router· Switch· Voice· Wireless
· Database   }· MySQL· Oracle
· Windows · Equipment   }· Printer· Storage   }· Tivoli Storage Manager
· Others
首页


使用yum下载而不安装rpm包How To Download a RPM Package Using yum Command Without Installing On Linux
Q. I would like to only download the packages via yum and not install/update them. How do I download a RPM package using yum command under CentOS Enterprise Linux server 5.x or RHEL 5.x systems?
A. You need to install plugin called yum-downloadonly. This plugin adds a --downloadonly flag to yum so that yum will only download the packages and not install/update them. Following options supported by this plugin:
[a] --downloadonly : don't update, just download a rpm file
[b] --downloaddir=/path/to/dir : specifies an alternate directory to store packages such as /tmp
Please note following instructions are only tested on CentOS server but should work with RHN and RHEL without any problem.
How do I install yum-downloadonly plugin?
Type the following command to install plugin, enter:
# yum install yum-downloadonly
Sample output:
Loading "fastestmirror" plugin
Loading "security" plugin
Loading mirror speeds from cached hostfile
* base: centos.mirrors.tds.net
* updates: mirror.myriadnetwork.com
* addons: mirrors.gigenet.com
* extras: holmes.umflint.edu
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package yum-downloadonly.noarch 0:1.1.10-9.el5.centos set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
yum-downloadonly        noarch     1.1.10-9.el5.centos  base              9.0 k
Transaction Summary
=============================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)
Total download size: 9.0 k
Is this ok [y/N]: y
Downloading Packages:
(1/1): yum-downloadonly-1 100% |=========================| 9.0 kB    00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: yum-downloadonly             ######################### [1/1]
Installed: yum-downloadonly.noarch 0:1.1.10-9.el5.centos
Complete!How do I download a RPM package only from RHN or CentOS mirror, without installing it?Download httpd package but don't install/update, enter:
# yum update httpd -y --downloadonly
By default package will by downloaded and stored in /var/cache/yum/ directory. But, you can specifies an alternate directory to store packages such as /opt, enter:
# yum update httpd -y --downloadonly --downloaddir=/opt
Sample output:
yum install httpd -y --downloadonly
Loading "downloadonly" plugin
Loading "fastestmirror" plugin
Loading "security" plugin
Loading mirror speeds from cached hostfile
* base: centos.mirrors.mypsh.com
* updates: mirror.steadfast.net
* addons: mirrors.gigenet.com
* extras: holmes.umflint.edu
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package httpd.i386 0:2.2.3-11.el5_1.centos.3 set to be updated
filelists.xml.gz          100% |=========================| 2.8 MB    00:03
filelists.xml.gz          100% |=========================| 681 kB    00:11
filelists.xml.gz          100% |=========================| 122 kB    00:00
filelists.xml.gz          100% |=========================|  150 B    00:00
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
httpd                   i386       2.2.3-11.el5_1.centos.3  base              1.1 M
Transaction Summary
=============================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)
Total download size: 1.1 M
Downloading Packages:
(1/1): httpd-2.2.3-11.el5 100% |=========================| 1.1 MB    00:01
exiting because --downloadonly specified
To see downloaded file, enter:
# ls -l /opt/*.rpm
Sample output:
-rw-r--r-- 1 root root 1116426 Jan 17 03:36 /opt/httpd-2.2.3-11.el5_1.centos.3.i386.rpm
-rw-r--r-- 1 root root   83452 Oct  2  2007 /opt/lighttpd-fastcgi-1.4.18-1.el5.rf.i386.rpm
-rw-r--r-- 1 root root  635045 Oct 20  2007 /opt/psad-2.1-1.i386.rpm
如果某个软件从来没有安装过,现在想通过yum把它下载下来,可以这样:
# yum install perl-MailTools --downloadonly --downloaddir=/opt -y
Loading "installonlyn" plugin
Loading "downloadonly" plugin
Loading "security" plugin
Loading "rhnplugin" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Install Process
Setting up repositories
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for perl-MailTools to pack into transaction set.
perl-MailTools-2.03-1.el5 100% |=========================|  11 kB    00:00
---> Package perl-MailTools.noarch 0:2.03-1.el5.rf set to be updated
--> Running transaction check
Dependencies Resolved
=============================================================================
Package                 Arch       Version          Repository        Size
=============================================================================
Installing:
perl-MailTools          noarch     2.03-1.el5.rf    dag               100 k
Transaction Summary
=============================================================================
Install      1 Package(s)
Update       0 Package(s)
Remove       0 Package(s)
Total download size: 100 k
Downloading Packages:
(1/1): perl-MailTools-2.0 100% |=========================| 100 kB    00:02
exiting because --downloadonly specified
原文地址http://www.cyberciti.biz/faq/yum-downloadonly-plugin/
发表于: 2008-09-10 ,修改于: 2008-09-10 17:29,已浏览379次,有评论0条推荐投诉


网友评论
发表评论