yum 下载rpm包到指定目录,只下载不安装


在离线环境下安装某些软件依赖相关库,可以找台可以上网的机器把相关库下载好后再导入

1、yum install –downloadonly –downloaddir=路径 安装包名

例:安装gcc pcre pcre-devel openssl openssl-devel zlib zlib-devel的rpm到/root/nginx目录

[root@nginx yum.repos.d]# yum install --downloadonly --downloaddir=/root/nginx gcc pcre pcre-devel openssl openssl-devel zlib zlib-devel

已加载插件:fastestmirror
Repository epel is listed more than once in the configuration
Repository epel-source is listed more than once in the configuration
Loading mirror speeds from cached hostfile
* base: mirrors.bupt.edu.cn
* extras: mirrors.bupt.edu.cn
* updates: mirrors.huaweicloud.com
base | 3.6 kB 00:00:00
docker-ce-stable | 3.5 kB 00:00:00
epel | 4.7 kB 00:00:00
extras | 2.9 kB 00:00:00
openresty | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/10): docker-ce-stable/7/x86_64/updateinfo | 55 B 00:00:00
(2/10): base/7/x86_64/primary_db | 6.1 MB 00:00:00
(3/10): docker-ce-stable/7/x86_64/primary_db | 81 kB 00:00:00
(4/10): base/7/x86_64/group_gz | 153 kB 00:00:01
(5/10): epel/x86_64/group_gz | 97 kB 00:00:01
(6/10): extras/7/x86_64/primary_db | 250 kB 00:00:00
(7/10): openresty/7/x86_64/primary_db | 55 kB 00:00:00
(8/10): updates/7/x86_64/primary_db | 17 MB 00:00:00
(9/10): epel/x86_64/updateinfo | 1.1 MB 00:00:11
(10/10): epel/x86_64/primary_db | 7.0 MB 00:01:07
软件包 pcre-8.32-17.el7.x86_64 已安装并且是最新版本
正在解决依赖关系
–> 正在检查事务
—> 软件包 gcc.x86_64.0.4.8.5-44.el7 将被 安装
–> 正在处理依赖关系 cpp = 4.8.5-44.el7,它被软件包 gcc-4.8.5-44.el7.x86_64 需要
–> 正在处理依赖关系 glibc-devel >= 2.2.90-12,它被软件包 gcc-4.8.5-44.el7.x86_64 需要
–> 正在处理依赖关系 libmpfr.so.4()(64bit),它被软件包 gcc-4.8.5-44.el7.x86_64 需要
–> 正在处理依赖关系 libmpc.so.3()(64bit),它被软件包 gcc-4.8.5-44.el7.x86_64 需要
—> 软件包 openssl.x86_64.1.1.0.2k-19.el7 将被 升级
—> 软件包 openssl.x86_64.1.1.0.2k-25.el7_9 将被 更新
–> 正在处理依赖关系 openssl-libs(x86-64) = 1:1.0.2k-25.el7_9,它被软件包 1:openssl-1.0.2k-25.el7_9.x86_64 需要
—> 软件包 openssl-devel.x86_64.1.1.0.2k-25.el7_9 将被 安装
–> 正在处理依赖关系 krb5-devel(x86-64),它被软件包 1:openssl-devel-1.0.2k-25.el7_9.x86_64 需要
—> 软件包 pcre-devel.x86_64.0.8.32-17.el7 将被 安装
—> 软件包 zlib.x86_64.0.1.2.7-18.el7 将被 升级
—> 软件包 zlib.x86_64.0.1.2.7-20.el7_9 将被 更新
—> 软件包 zlib-devel.x86_64.0.1.2.7-20.el7_9 将被 安装
–> 正在检查事务
—> 软件包 cpp.x86_64.0.4.8.5-44.el7 将被 安装
—> 软件包 glibc-devel.x86_64.0.2.17-326.el7_9 将被 安装
–> 正在处理依赖关系 glibc-headers = 2.17-326.el7_9,它被软件包 glibc-devel-2.17-326.el7_9.x86_64 需要
–> 正在处理依赖关系 glibc = 2.17-326.el7_9,它被软件包 glibc-devel-2.17-326.el7_9.x86_64 需要
–> 正在处理依赖关系 glibc-headers,它被软件包 glibc-devel-2.17-326.el7_9.x86_64 需要
—> 软件包 krb5-devel.x86_64.0.1.15.1-54.el7_9 将被 安装
–> 正在处理依赖关系 libkadm5(x86-64) = 1.15.1-54.el7_9,它被软件包 krb5-devel-1.15.1-54.el7_9.x86_64 需要
–> 正在处理依赖关系 krb5-libs(x86-64) = 1.15.1-54.el7_9,它被软件包 krb5-devel-1.15.1-54.el7_9.x86_64 需要
–> 正在处理依赖关系 libverto-devel,它被软件包 krb5-devel-1.15.1-54.el7_9.x86_64 需要
–> 正在处理依赖关系 libselinux-devel,它被软件包 krb5-devel-1.15.1-54.el7_9.x86_64 需要
–> 正在处理依赖关系 libcom_err-devel,它被软件包 krb5-devel-1.15.1-54.el7_9.x86_64 需要
–> 正在处理依赖关系 keyutils-libs-devel,它被软件包 krb5-devel-1.15.1-54.el7_9.x86_64 需要
—> 软件包 libmpc.x86_64.0.1.0.1-3.el7 将被 安装
—> 软件包 mpfr.x86_64.0.3.1.1-4.el7 将被 安装
—> 软件包 openssl-libs.x86_64.1.1.0.2k-19.el7 将被 升级
—> 软件包 openssl-libs.x86_64.1.1.0.2k-25.el7_9 将被 更新
–> 正在检查事务
—> 软件包 glibc.x86_64.0.2.17-317.el7 将被 升级
–> 正在处理依赖关系 glibc = 2.17-317.el7,它被软件包 glibc-common-2.17-317.el7.x86_64 需要
—> 软件包 glibc.x86_64.0.2.17-326.el7_9 将被 更新
—> 软件包 glibc-headers.x86_64.0.2.17-326.el7_9 将被 安装
–> 正在处理依赖关系 kernel-headers >= 2.2.1,它被软件包 glibc-headers-2.17-326.el7_9.x86_64 需要
–> 正在处理依赖关系 kernel-headers,它被软件包 glibc-headers-2.17-326.el7_9.x86_64 需要
—> 软件包 keyutils-libs-devel.x86_64.0.1.5.8-3.el7 将被 安装
—> 软件包 krb5-libs.x86_64.0.1.15.1-50.el7 将被 升级
—> 软件包 krb5-libs.x86_64.0.1.15.1-54.el7_9 将被 更新
—> 软件包 libcom_err-devel.x86_64.0.1.42.9-19.el7 将被 安装
—> 软件包 libkadm5.x86_64.0.1.15.1-54.el7_9 将被 安装
—> 软件包 libselinux-devel.x86_64.0.2.5-15.el7 将被 安装
–> 正在处理依赖关系 libsepol-devel(x86-64) >= 2.5-10,它被软件包 libselinux-devel-2.5-15.el7.x86_64 需要
–> 正在处理依赖关系 pkgconfig(libsepol),它被软件包 libselinux-devel-2.5-15.el7.x86_64 需要
—> 软件包 libverto-devel.x86_64.0.0.2.5-4.el7 将被 安装
–> 正在检查事务
—> 软件包 glibc-common.x86_64.0.2.17-317.el7 将被 升级
—> 软件包 glibc-common.x86_64.0.2.17-326.el7_9 将被 更新
—> 软件包 kernel-headers.x86_64.0.3.10.0-1160.76.1.el7 将被 安装
—> 软件包 libsepol-devel.x86_64.0.2.5-10.el7 将被 安装
–> 解决依赖关系完成

依赖关系解决

==================================================================================================
Package 架构 版本 源 大小
==================================================================================================
正在安装:
gcc x86_64 4.8.5-44.el7 base 16 M
openssl-devel x86_64 1:1.0.2k-25.el7_9 updates 1.5 M
pcre-devel x86_64 8.32-17.el7 base 480 k
zlib-devel x86_64 1.2.7-20.el7_9 updates 50 k
正在更新:
openssl x86_64 1:1.0.2k-25.el7_9 updates 494 k
zlib x86_64 1.2.7-20.el7_9 updates 90 k
为依赖而安装:
cpp x86_64 4.8.5-44.el7 base 5.9 M
glibc-devel x86_64 2.17-326.el7_9 updates 1.1 M
glibc-headers x86_64 2.17-326.el7_9 updates 691 k
kernel-headers x86_64 3.10.0-1160.76.1.el7 updates 9.1 M
keyutils-libs-devel x86_64 1.5.8-3.el7 base 37 k
krb5-devel x86_64 1.15.1-54.el7_9 updates 273 k
libcom_err-devel x86_64 1.42.9-19.el7 base 32 k
libkadm5 x86_64 1.15.1-54.el7_9 updates 179 k
libmpc x86_64 1.0.1-3.el7 base 51 k
libselinux-devel x86_64 2.5-15.el7 base 187 k
libsepol-devel x86_64 2.5-10.el7 base 77 k
libverto-devel x86_64 0.2.5-4.el7 base 12 k
mpfr x86_64 3.1.1-4.el7 base 203 k
为依赖而更新:
glibc x86_64 2.17-326.el7_9 updates 3.6 M
glibc-common x86_64 2.17-326.el7_9 updates 12 M
krb5-libs x86_64 1.15.1-54.el7_9 updates 810 k
openssl-libs x86_64 1:1.0.2k-25.el7_9 updates 1.2 M

事务概要
==================================================================================================
安装 4 软件包 (+13 依赖软件包)
升级 2 软件包 (+ 4 依赖软件包)

总下载量:54 M
Background downloading packages, then exiting:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/23): cpp-4.8.5-44.el7.x86_64.rpm | 5.9 MB 00:00:03
(2/23): glibc-2.17-326.el7_9.x86_64.rpm | 3.6 MB 00:00:03
(3/23): glibc-common-2.17-326.el7_9.x86_64.rpm | 12 MB 00:00:03
(4/23): glibc-devel-2.17-326.el7_9.x86_64.rpm | 1.1 MB 00:00:00
(5/23): glibc-headers-2.17-326.el7_9.x86_64.rpm | 691 kB 00:00:00
(6/23): gcc-4.8.5-44.el7.x86_64.rpm | 16 MB 00:00:03
(7/23): krb5-devel-1.15.1-54.el7_9.x86_64.rpm | 273 kB 00:00:00
(8/23): krb5-libs-1.15.1-54.el7_9.x86_64.rpm | 810 kB 00:00:00
(9/23): libkadm5-1.15.1-54.el7_9.x86_64.rpm | 179 kB 00:00:00
(10/23): kernel-headers-3.10.0-1160.76.1.el7.x86_64.rpm | 9.1 MB 00:00:00
(11/23): keyutils-libs-devel-1.5.8-3.el7.x86_64.rpm | 37 kB 00:00:02
(12/23): libcom_err-devel-1.42.9-19.el7.x86_64.rpm | 32 kB 00:00:02
(13/23): libmpc-1.0.1-3.el7.x86_64.rpm | 51 kB 00:00:00
(14/23): libsepol-devel-2.5-10.el7.x86_64.rpm | 77 kB 00:00:00
(15/23): libselinux-devel-2.5-15.el7.x86_64.rpm | 187 kB 00:00:00
(16/23): libverto-devel-0.2.5-4.el7.x86_64.rpm | 12 kB 00:00:00
(17/23): mpfr-3.1.1-4.el7.x86_64.rpm | 203 kB 00:00:00
(18/23): openssl-1.0.2k-25.el7_9.x86_64.rpm | 494 kB 00:00:02
(19/23): openssl-devel-1.0.2k-25.el7_9.x86_64.rpm | 1.5 MB 00:00:02
(20/23): zlib-1.2.7-20.el7_9.x86_64.rpm | 90 kB 00:00:00
(21/23): openssl-libs-1.0.2k-25.el7_9.x86_64.rpm | 1.2 MB 00:00:00
(22/23): zlib-devel-1.2.7-20.el7_9.x86_64.rpm | 50 kB 00:00:00
(23/23): pcre-devel-8.32-17.el7.x86_64.rpm | 480 kB 00:00:02
————————————————————————————————–
总计 4.6 MB/s | 54 MB 00:00:11
exiting because “Download Only” specified

2、查看下载好的rpm包

[root@nginx yum.repos.d]# ls /root/nginx/
cpp-4.8.5-44.el7.x86_64.rpm libmpc-1.0.1-3.el7.x86_64.rpm
gcc-4.8.5-44.el7.x86_64.rpm libselinux-devel-2.5-15.el7.x86_64.rpm
glibc-2.17-326.el7_9.x86_64.rpm libsepol-devel-2.5-10.el7.x86_64.rpm
glibc-common-2.17-326.el7_9.x86_64.rpm libverto-devel-0.2.5-4.el7.x86_64.rpm
glibc-devel-2.17-326.el7_9.x86_64.rpm mpfr-3.1.1-4.el7.x86_64.rpm
glibc-headers-2.17-326.el7_9.x86_64.rpm openssl-1.0.2k-25.el7_9.x86_64.rpm
kernel-headers-3.10.0-1160.76.1.el7.x86_64.rpm openssl-devel-1.0.2k-25.el7_9.x86_64.rpm
keyutils-libs-devel-1.5.8-3.el7.x86_64.rpm openssl-libs-1.0.2k-25.el7_9.x86_64.rpm
krb5-devel-1.15.1-54.el7_9.x86_64.rpm pcre-devel-8.32-17.el7.x86_64.rpm
krb5-libs-1.15.1-54.el7_9.x86_64.rpm zlib-1.2.7-20.el7_9.x86_64.rpm
libcom_err-devel-1.42.9-19.el7.x86_64.rpm zlib-devel-1.2.7-20.el7_9.x86_64.rpm
libkadm5-1.15.1-54.el7_9.x86_64.rpm

 

原创文章,作者:ItWorker,如若转载,请注明出处:https://blog.ytso.com/288436.html

(0)
上一篇 2022年9月9日
下一篇 2022年9月9日

相关推荐

发表回复

登录后才能评论