使用yum插件Downloadonly下载rpm包和依赖包
使用yum插件Downloadonly下载rpm包和依赖包
雁南飞丶 发表于1年前
使用yum插件Downloadonly下载rpm包和依赖包
  • 发表于 1年前
  • 阅读 228
  • 收藏 0
  • 点赞 0
  • 评论 0

【腾讯云】新注册用户域名抢购1元起>>>   

1、查看系统版本

[root@leo packages]# cat /etc/issue
CentOS release 6.5 (Final)
Kernel \r on an \m

[root@leo packages]# uname -r
3.10.101-1.el6.elrepo.x86_64

2、使用阿里云的yum源{online},使用阿里云yum源配置点这aliyun源

3、安装 Downloadonly 插件

[root@leo ~]# yum install yum-plugin-downloadonly
Loaded plugins: fastestmirror, refresh-packagekit, security
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package yum.noarch 0:3.2.29-40.el6.centos will be updated
---> Package yum.noarch 0:3.2.29-75.el6.centos will be an update
--> Processing Dependency: python-urlgrabber >= 3.9.1-10 for package: yum-3.2.29-75.el6.centos.noarch
--> Running transaction check
---> Package python-urlgrabber.noarch 0:3.9.1-9.el6 will be updated
---> Package python-urlgrabber.noarch 0:3.9.1-11.el6 will be an update
--> Finished Dependency Resolution

Dependencies Resolved

====================================================================================================================================================
 Package                                Arch                        Version                                      Repository                    Size
====================================================================================================================================================
Updating:
 yum                                    noarch                      3.2.29-75.el6.centos                         updates                      1.0 M
Updating for dependencies:
 python-urlgrabber                      noarch                      3.9.1-11.el6                                 base                          86 k

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

Total download size: 1.1 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): python-urlgrabber-3.9.1-11.el6.noarch.rpm                                                                             |  86 kB     00:01     
(2/2): yum-3.2.29-75.el6.centos.noarch.rpm                                                                                   | 1.0 MB     00:17     
----------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                58 kB/s | 1.1 MB     00:19     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : python-urlgrabber-3.9.1-11.el6.noarch                                                                                            1/4 
  Updating   : yum-3.2.29-75.el6.centos.noarch                                                                                                  2/4 
  Cleanup    : yum-3.2.29-40.el6.centos.noarch                                                                                                  3/4 
  Cleanup    : python-urlgrabber-3.9.1-9.el6.noarch                                                                                             4/4 
  Verifying  : yum-3.2.29-75.el6.centos.noarch                                                                                                  1/4 
  Verifying  : python-urlgrabber-3.9.1-11.el6.noarch                                                                                            2/4 
  Verifying  : yum-3.2.29-40.el6.centos.noarch                                                                                                  3/4 
  Verifying  : python-urlgrabber-3.9.1-9.el6.noarch                                                                                             4/4 

Updated:
  yum.noarch 0:3.2.29-75.el6.centos                                                                                                                 

Dependency Updated:
  python-urlgrabber.noarch 0:3.9.1-11.el6                                                                                                           

Complete!

4、使用下面命令安装

yum install --downloadonly <package-name>

默认情况下,这个命令将会下载并把软件包保存到 /var/cache/yum/ 的 {arch}-channel/packageslocation 目录,不过,你也可以下载和保存软件包到任何位置,你可以通过 –downloaddir 选项来指定。

yum install --downloadonly --downloaddir=<directory> <package-name>

5、测试安装mysql服务器

[root@leo ~]# yum install --downloadonly mysql-server
已加载插件:fastestmirror, refresh-packagekit, security
设置安装进程
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
解决依赖关系
--> 执行事务检查
---> Package mysql-server.x86_64 0:5.1.73-7.el6 will be 安装
--> 处理依赖关系 mysql = 5.1.73-7.el6,它被软件包 mysql-server-5.1.73-7.el6.x86_64 需要
--> 处理依赖关系 perl-DBI,它被软件包 mysql-server-5.1.73-7.el6.x86_64 需要
--> 处理依赖关系 perl-DBD-MySQL,它被软件包 mysql-server-5.1.73-7.el6.x86_64 需要
--> 处理依赖关系 perl(DBI),它被软件包 mysql-server-5.1.73-7.el6.x86_64 需要
--> 执行事务检查
---> Package mysql.x86_64 0:5.1.73-7.el6 will be 安装
--> 处理依赖关系 mysql-libs = 5.1.73-7.el6,它被软件包 mysql-5.1.73-7.el6.x86_64 需要
---> Package perl-DBD-MySQL.x86_64 0:4.013-3.el6 will be 安装
---> Package perl-DBI.x86_64 0:1.609-4.el6 will be 安装
--> 执行事务检查
---> Package mysql-libs.x86_64 0:5.1.71-1.el6 will be 升级
---> Package mysql-libs.x86_64 0:5.1.73-7.el6 will be an update
--> 完成依赖关系计算

依赖关系解决

====================================================================================================================================================
 软件包                                  架构                            版本                                   仓库                           大小
====================================================================================================================================================
正在安装:
 mysql-server                            x86_64                          5.1.73-7.el6                           base                          8.6 M
为依赖而安装:
 mysql                                   x86_64                          5.1.73-7.el6                           base                          894 k
 perl-DBD-MySQL                          x86_64                          4.013-3.el6                            base                          134 k
 perl-DBI                                x86_64                          1.609-4.el6                            base                          705 k
为依赖而更新:
 mysql-libs                              x86_64                          5.1.73-7.el6                           base                          1.2 M

事务概要
====================================================================================================================================================
Install       4 Package(s)
Upgrade       1 Package(s)

总文件大小:12 M
总下载量:9.4 M
确定吗?[y/N]:y
下载软件包:
(1/3): mysql-server-5.1.73-7.el6.x86_64.rpm                                                                                  | 8.6 MB     01:31     
(2/3): perl-DBD-MySQL-4.013-3.el6.x86_64.rpm                                                                                 | 134 kB     00:00     
(3/3): perl-DBI-1.609-4.el6.x86_64.rpm                                                                                       | 705 kB     00:02     
----------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                103 kB/s | 9.4 MB     01:34     
exiting because --downloadonly specified

6、查看下载保存的rpm包

[root@leo packages]# ll
总用量 11820
-rw-r--r--. 1 root root  915880 5月  12 18:47 mysql-5.1.73-7.el6.x86_64.rpm
-rw-r--r--. 1 root root 1283716 5月  12 18:52 mysql-libs-5.1.73-7.el6.x86_64.rpm
-rw-r--r--. 1 root root 9034296 5月  12 18:49 mysql-server-5.1.73-7.el6.x86_64.rpm
-rw-r--r--. 1 root root  137008 7月   3 2011 perl-DBD-MySQL-4.013-3.el6.x86_64.rpm
-rw-r--r--. 1 root root  721964 7月   3 2011 perl-DBI-1.609-4.el6.x86_64.rpm
[root@leo packages]# pwd
/var/cache/yum/x86_64/6/base/packages

7、指定位置下载rpm包

[root@leo ~]# mkdir /opt/tt
[root@leo ~]# yum install --downloadonly --downloaddir=/opt/tt/ samba
已加载插件:fastestmirror, refresh-packagekit, security
设置安装进程
Loading mirror speeds from cached hostfile
 * base: mirrors.aliyun.com
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
解决依赖关系
--> 执行事务检查
---> Package samba.x86_64 0:3.6.23-36.el6_8 will be 安装
--> 处理依赖关系 samba-winbind-clients = 3.6.23-36.el6_8,它被软件包 samba-3.6.23-36.el6_8.x86_64 需要
--> 处理依赖关系 samba-common = 3.6.23-36.el6_8,它被软件包 samba-3.6.23-36.el6_8.x86_64 需要
--> 执行事务检查
---> Package samba-common.x86_64 0:3.6.9-164.el6 will be 升级
--> 处理依赖关系 samba-common = 3.6.9-164.el6,它被软件包 samba-winbind-3.6.9-164.el6.x86_64 需要
--> 处理依赖关系 samba-common = 3.6.9-164.el6,它被软件包 samba-client-3.6.9-164.el6.x86_64 需要
---> Package samba-common.x86_64 0:3.6.23-36.el6_8 will be an update
---> Package samba-winbind-clients.x86_64 0:3.6.9-164.el6 will be 升级
--> 处理依赖关系 samba-winbind-clients = 3.6.9-164.el6,它被软件包 libsmbclient-3.6.9-164.el6.x86_64 需要
---> Package samba-winbind-clients.x86_64 0:3.6.23-36.el6_8 will be an update
--> 执行事务检查
---> Package libsmbclient.x86_64 0:3.6.9-164.el6 will be 升级
---> Package libsmbclient.x86_64 0:3.6.23-36.el6_8 will be an update
---> Package samba-client.x86_64 0:3.6.9-164.el6 will be 升级
---> Package samba-client.x86_64 0:3.6.23-36.el6_8 will be an update
---> Package samba-winbind.x86_64 0:3.6.9-164.el6 will be 升级
---> Package samba-winbind.x86_64 0:3.6.23-36.el6_8 will be an update
--> 完成依赖关系计算

依赖关系解决

====================================================================================================================================================
 软件包                                      架构                         版本                                  仓库                           大小
====================================================================================================================================================
正在安装:
 samba                                       x86_64                       3.6.23-36.el6_8                       updates                       5.1 M
为依赖而更新:
 libsmbclient                                x86_64                       3.6.23-36.el6_8                       updates                       1.6 M
 samba-client                                x86_64                       3.6.23-36.el6_8                       updates                        11 M
 samba-common                                x86_64                       3.6.23-36.el6_8                       updates                        10 M
 samba-winbind                               x86_64                       3.6.23-36.el6_8                       updates                       2.2 M
 samba-winbind-clients                       x86_64                       3.6.23-36.el6_8                       updates                       2.0 M

事务概要
====================================================================================================================================================
Install       1 Package(s)
Upgrade       5 Package(s)

总下载量:32 M
确定吗?[y/N]:y
下载软件包:
(1/6): libsmbclient-3.6.23-36.el6_8.x86_64.rpm                                                                               | 1.6 MB     00:32     
(2/6): samba-3.6.23-36.el6_8.x86_64.rpm                                                                                      | 5.1 MB     01:32     
(3/6): samba-client-3.6.23-36.el6_8.x86_64.rpm                                                                               |  11 MB     01:48     
(4/6): samba-common-3.6.23-36.el6_8.x86_64.rpm                                                                               |  10 MB     00:29     
(5/6): samba-winbind-3.6.23-36.el6_8.x86_64.rpm                                                                              | 2.2 MB     00:08     
(6/6): samba-winbind-clients-3.6.23-36.el6_8.x86_64.rpm                                                                      | 2.0 MB     00:02     
----------------------------------------------------------------------------------------------------------------------------------------------------
总计                                                                                                                117 kB/s |  32 MB     04:40     
exiting because --downloadonly specified


#
[root@leo ~]# ll /opt/tt/
总用量 32800
-rw-r--r--. 1 root root  1693832 8月  24 03:10 libsmbclient-3.6.23-36.el6_8.x86_64.rpm
-rw-r--r--. 1 root root  5330696 8月  24 03:10 samba-3.6.23-36.el6_8.x86_64.rpm
-rw-r--r--. 1 root root 11516800 8月  24 03:10 samba-client-3.6.23-36.el6_8.x86_64.rpm
-rw-r--r--. 1 root root 10634372 8月  24 03:10 samba-common-3.6.23-36.el6_8.x86_64.rpm
-rw-r--r--. 1 root root  2276252 8月  24 03:10 samba-winbind-3.6.23-36.el6_8.x86_64.rpm
-rw-r--r--. 1 root root  2123744 8月  24 03:10 samba-winbind-clients-3.6.23-36.el6_8.x86_64.rpm

  • 打赏
  • 点赞
  • 收藏
  • 分享
共有 人打赏支持
粉丝 37
博文 123
码字总数 215399
×
雁南飞丶
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: