惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

酷 壳 – CoolShell
酷 壳 – CoolShell
T
Threatpost
Latest news
Latest news
N
News | PayPal Newsroom
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Help Net Security
Help Net Security
D
Darknet – Hacking Tools, Hacker News & Cyber Security
AI
AI
Simon Willison's Weblog
Simon Willison's Weblog
TaoSecurity Blog
TaoSecurity Blog
The Last Watchdog
The Last Watchdog
L
LINUX DO - 热门话题
Google DeepMind News
Google DeepMind News
T
Threat Research - Cisco Blogs
O
OpenAI News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
The Exploit Database - CXSecurity.com
NISL@THU
NISL@THU
Application and Cybersecurity Blog
Application and Cybersecurity Blog
S
Securelist
小众软件
小众软件
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Martin Fowler
Martin Fowler
S
SegmentFault 最新的问题
Cisco Talos Blog
Cisco Talos Blog
云风的 BLOG
云风的 BLOG
AWS News Blog
AWS News Blog
GbyAI
GbyAI
N
News and Events Feed by Topic
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
美团技术团队
Engineering at Meta
Engineering at Meta
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
S
Schneier on Security
博客园 - 聂微东
V2EX - 技术
V2EX - 技术
T
Troy Hunt's Blog
SecWiki News
SecWiki News
S
Secure Thoughts
B
Blog RSS Feed
Hugging Face - Blog
Hugging Face - Blog
WordPress大学
WordPress大学
腾讯CDC
H
Heimdal Security Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Apple Machine Learning Research
Apple Machine Learning Research
月光博客
月光博客
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy International News Feed

博客园 - simhare

Fix “Windows cannot access the specified device path or file” Error Domain Space mysql 登录后 修改密码 git delete repository php - func_get_args mysql key mul - 看不懂 mysql show create table `tablename` 查看建表语句 zend framework assumptions linux vsftpd linux chkconfig pkill kill 看看自己是谁 linux 本地编码-如何解决乱码 linux添加用户-例如oracle 博文阅读密码验证 - 博客园 mysql netstat linux pts tty linux pts Linux 启动 进入单用户模式 其他用户无法连接 apache start stop
yum 只下载不安装
simhare · 2013-05-02 · via 博客园 - simhare

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
--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

可能是install而不是update

[root@DBSVR02 ~]# yum install httpd -y --downloadonly --downloaddir=/opt
Loaded plugins: downloadonly, fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: ftp.stust.edu.tw
 * extras: mirrors.grandcloud.cn
 * updates: mirrors.grandcloud.cn
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package httpd.i686 0:2.2.15-26.el6.centos will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=============================================================================================
 Package                                   Arch                                     Version                                                     Repository                                Size
=============================================================================================
Installing:
 httpd                                     i686                                     2.2.15-26.el6.centos                                        base                                     827 k

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

Total download size: 827 k
Installed size: 2.8 M
Downloading Packages:
httpd-2.2.15-26.el6.centos.i686.rpm                                                                                                                                     | 827 kB     00:05    


exiting because --downloadonly specified
[root@DBSVR02 ~]# ll /opt
total 832
-rw-r--r--. 1 root root 847020 Feb 23 12:51 httpd-2.2.15-26.el6.centos.i686.rpm
drwxr-xr-x. 2 root root   4096 Jun 22  2012 rh
[root@DBSVR02 ~]#


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

[root@DBSVR02 ~]# yum install mysql-server.i686 -y --downloadonly --downloaddir=/opt
Loaded plugins: downloadonly, fastestmirror, security
Loading mirror speeds from cached hostfile
 * base: mirrors.yun-idc.com
 * extras: mirrors.yun-idc.com
 * updates: mirrors.yun-idc.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package mysql-server.i686 0:5.1.69-1.el6_4 will be installed
--> Processing Dependency: mysql = 5.1.69-1.el6_4 for package: mysql-server-5.1.69-1.el6_4.i686
--> Running transaction check
---> Package mysql.i686 0:5.1.69-1.el6_4 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===========================================================================================
 Package                                         Arch                                    Version                                              Repository                                  Size
==========================================================================================
Installing:
 mysql-server                                    i686                                    5.1.69-1.el6_4                                       updates                                    8.8 M
Installing for dependencies:
 mysql                                           i686                                    5.1.69-1.el6_4                                       updates                                    917 k

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

Total download size: 9.7 M
Installed size: 27 M
Downloading Packages:
(1/2): mysql-5.1.69-1.el6_4.i686.rpm                                                                                                                                    | 917 kB     00:00    
(2/2): mysql-server-5.1.69-1.el6_4.i686.rpm                                                                                                                             | 8.8 MB     00:05    
------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                          1.5 MB/s | 9.7 MB     00:06    


exiting because --downloadonly specified
[root@DBSVR02 ~]# ll /opt
total 10800
-rw-r--r--. 1 root root  847020 Feb 23 12:51 httpd-2.2.15-26.el6.centos.i686.rpm
-rw-r--r--. 1 root root  939176 Apr 25 14:52 mysql-5.1.69-1.el6_4.i686.rpm
-rw-r--r--. 1 root root 9263220 Apr 25 14:52 mysql-server-5.1.69-1.el6_4.i686.rpm
drwxr-xr-x. 2 root root    4096 Jun 22  2012 rh
[root@DBSVR02 ~]#

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

-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