在 x86_64 上安装 CentOS 6.3。
下面我将使用 parted 包演示我的问题。
跑步:
yumdownloader --destdir=001 --assumeyes --resolve parted
因此下载了以下 rpm:
ls -1 001/
device-mapper-libs-1.02.74-10.el6_3.3.i686.rpm
libblkid-2.17.2-12.7.el6_3.i686.rpm
libselinux-2.0.94-5.3.el6.i686.rpm
libsepol-2.0.41-4.el6.i686.rpm
libudev-147-2.42.el6.i686.rpm
libuuid-2.17.2-12.7.el6_3.i686.rpm
ncurses-libs-5.7-3.20090208.el6.i686.rpm
parted-2.1-18.el6.i686.rpm
parted-2.1-18.el6.x86_64.rpm
readline-6.0-4.el6.i686.rpm
如果我检查 parted 的 x86_64 版本的依赖关系,我会看到:
rpm -qp --requires 001/parted-2.1-18.el6.x86_64.rpm
/bin/sh
...
libblkid.so.1()(64bit)
libblkid.so.1(BLKID_2.15)(64bit)
libblkid.so.1(BLKID_2.17)(64bit)
...
libblkid
因此,我希望也能下载x86_64 版本。
那么,如何同时下载了 i686 和 x86_64 版本parted
,但解析后的 rpm 却仅有 i686?
答案1
该yumdownloader --resolve
命令并不总是下载所需软件包的第一层,更不用说递归依赖项了。repoquery
尽管该命令也有递归限制,但它在确定所需软件包方面做得更好。
要解决 yumdownloader 仅下载 i686 解析的 rpm 的问题,请使用命令repoquery --requires --recursive
获取所需软件包的列表,并将该列表通过管道传递yumdownloader
给下载软件包的命令。例如,要下载parted
软件包及其第一层依赖项:
/usr/bin/repoquery --requires --recursive --resolve --pkgnarrow=all --qf "%{name}" parted | sort | uniq | xargs -r yumdownloader
在我的 RHEL 6.4 系统上,上述命令下载了所需软件包的 i686(如果适用)和 x86_64 版本:
# ls -1
bash-4.1.2-14.el6.x86_64.rpm
device-mapper-libs-1.02.77-9.el6.i686.rpm
device-mapper-libs-1.02.77-9.el6.x86_64.rpm
glibc-2.12-1.107.el6.i686.rpm
glibc-2.12-1.107.el6.x86_64.rpm
info-4.13a-8.el6.x86_64.rpm
libblkid-2.17.2-12.9.el6_4.3.i686.rpm
libblkid-2.17.2-12.9.el6_4.3.x86_64.rpm
libselinux-2.0.94-5.3.el6.i686.rpm
libselinux-2.0.94-5.3.el6.x86_64.rpm
libsepol-2.0.41-4.el6.i686.rpm
libsepol-2.0.41-4.el6.x86_64.rpm
libuuid-2.17.2-12.9.el6_4.3.i686.rpm
libuuid-2.17.2-12.9.el6_4.3.x86_64.rpm
ncurses-libs-5.7-3.20090208.el6.i686.rpm
ncurses-libs-5.7-3.20090208.el6.x86_64.rpm
parted-2.1-19.el6.i686.rpm
parted-2.1-19.el6.x86_64.rpm
readline-6.0-4.el6.i686.rpm
readline-6.0-4.el6.x86_64.rpm
虽然这是一个好的开始,但是缺少 glibc-common 包表明下载的包列表仍然不完整。要下载所需包的更完整列表,需要一组命令,这些命令会调用 repoquery 两次,如下所示:
/usr/bin/repoquery --requires --recursive --resolve --pkgnarrow=all --qf "%{name}" parted | sort | uniq | xargs rpm -q --requires | sort | uniq | awk '{print $1}' | grep -v rpmlib | xargs -n1 -r -i{} yum -q resolvedep "{}" | sort | uniq | xargs -r -n1 /usr/bin/repoquery --requires --recursive --resolve --pkgnarrow=all --qf "%{name}" | sort | uniq | xargs -r -n 1 yumdownloader -q
该命令下载的软件包包括 glibc-common 以及我们第一次遗漏的其他几个软件包:
# ls -1
basesystem-10.0-4.el6.noarch.rpm
bash-4.1.2-14.el6.x86_64.rpm
device-mapper-1.02.77-9.el6.x86_64.rpm
device-mapper-libs-1.02.77-9.el6.i686.rpm
device-mapper-libs-1.02.77-9.el6.x86_64.rpm
filesystem-2.4.30-3.el6.x86_64.rpm
glibc-2.12-1.107.el6.i686.rpm
glibc-2.12-1.107.el6.x86_64.rpm
glibc-common-2.12-1.107.el6.x86_64.rpm
info-4.13a-8.el6.x86_64.rpm
libblkid-2.17.2-12.9.el6_4.3.i686.rpm
libblkid-2.17.2-12.9.el6_4.3.x86_64.rpm
libcap-2.16-5.5.el6.i686.rpm
libcap-2.16-5.5.el6.x86_64.rpm
libgcc-4.4.7-3.el6.i686.rpm
libgcc-4.4.7-3.el6.x86_64.rpm
libselinux-2.0.94-5.3.el6.i686.rpm
libselinux-2.0.94-5.3.el6.x86_64.rpm
libsepol-2.0.41-4.el6.i686.rpm
libsepol-2.0.41-4.el6.x86_64.rpm
libudev-147-2.46.el6.i686.rpm
libudev-147-2.46.el6.x86_64.rpm
libuuid-2.17.2-12.9.el6_4.3.i686.rpm
libuuid-2.17.2-12.9.el6_4.3.x86_64.rpm
ncurses-base-5.7-3.20090208.el6.x86_64.rpm
ncurses-libs-5.7-3.20090208.el6.i686.rpm
ncurses-libs-5.7-3.20090208.el6.x86_64.rpm
nss-softokn-freebl-3.12.9-11.el6.i686.rpm
nss-softokn-freebl-3.12.9-11.el6.x86_64.rpm
parted-2.1-19.el6.i686.rpm
parted-2.1-19.el6.x86_64.rpm
readline-6.0-4.el6.i686.rpm
readline-6.0-4.el6.x86_64.rpm
setup-2.8.14-20.el6.noarch.rpm
tzdata-2013b-1.el6.noarch.rpm
udev-147-2.46.el6.x86_64.rpm
util-linux-ng-2.17.2-12.9.el6_4.3.i686.rpm
util-linux-ng-2.17.2-12.9.el6_4.3.x86_64.rpm
zlib-1.2.3-29.el6.i686.rpm
zlib-1.2.3-29.el6.x86_64.rpm
这可能比您需要的软件包多很多,但它是一套更完整的软件包,并且包含您期望的 64 位软件包。