0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

RPMパッケージの依存関係や、ファイルがどのRPMパッケージに含まれているかを確認する

Posted at

What's?

RPMパッケージ内の依存関係や、OSにインストールされたファイルがどのRPMパッケージに属しているかを調べたいな、と思いまして。

環境

CentOS 8で確認します。

$ cat /etc/redhat-release
CentOS Linux release 8.4.2105


$ uname -srvmpio
Linux 4.18.0-305.12.1.el8_4.x86_64 #1 SMP Wed Aug 11 01:59:55 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

確認は、Apacheを例にして試していきます。

RPMパッケージの依存関係を調べる

パッケージ名から調べる

RPMパッケージが要求する依存関係は、dnf deplistで調べることができます。

$ dnf deplist [パッケージ名]

例。

$ dnf deplist httpd
Last metadata expiration check: 0:12:36 ago on 2021年08月26日 22時50分47秒.
package: httpd-2.4.37-39.module_el8.4.0+778+c970deab.x86_64
  dependency: /bin/sh
   provider: bash-4.4.20-1.el8_4.x86_64
  dependency: /etc/mime.types
   provider: mailcap-2.1.48-3.el8.noarch
  dependency: httpd-filesystem
   provider: httpd-filesystem-2.4.37-39.module_el8.4.0+778+c970deab.noarch
  dependency: httpd-filesystem = 2.4.37-39.module_el8.4.0+778+c970deab
   provider: httpd-filesystem-2.4.37-39.module_el8.4.0+778+c970deab.noarch
  dependency: httpd-tools = 2.4.37-39.module_el8.4.0+778+c970deab
   provider: httpd-tools-2.4.37-39.module_el8.4.0+778+c970deab.x86_64
  dependency: libapr-1.so.0()(64bit)
   provider: apr-1.6.3-11.el8.x86_64
  dependency: libaprutil-1.so.0()(64bit)
   provider: apr-util-1.6.1-6.el8.x86_64
  dependency: libbrotlienc.so.1()(64bit)
   provider: brotli-1.0.6-3.el8.x86_64
  dependency: libc.so.6(GLIBC_2.14)(64bit)
   provider: glibc-2.28-151.el8.x86_64
  dependency: libcrypt.so.1()(64bit)
   provider: libxcrypt-4.1.1-4.el8.x86_64
  dependency: libcrypt.so.1(XCRYPT_2.0)(64bit)
   provider: libxcrypt-4.1.1-4.el8.x86_64
  dependency: libdl.so.2()(64bit)
   provider: glibc-2.28-151.el8.x86_64
  dependency: libexpat.so.1()(64bit)
   provider: expat-2.2.5-4.el8.x86_64
  dependency: liblua-5.3.so()(64bit)
   provider: lua-libs-5.3.4-11.el8.x86_64
  dependency: libm.so.6()(64bit)
   provider: glibc-2.28-151.el8.x86_64
  dependency: libpcre.so.1()(64bit)
   provider: pcre-8.42-4.el8.x86_64
  dependency: libpthread.so.0()(64bit)
   provider: glibc-2.28-151.el8.x86_64
  dependency: libpthread.so.0(GLIBC_2.2.5)(64bit)
   provider: glibc-2.28-151.el8.x86_64
  dependency: libselinux.so.1()(64bit)
   provider: libselinux-2.9-5.el8.x86_64
  dependency: libsystemd.so.0()(64bit)
   provider: systemd-libs-239-45.el8_4.3.x86_64
  dependency: libsystemd.so.0(LIBSYSTEMD_209)(64bit)
   provider: systemd-libs-239-45.el8_4.3.x86_64
  dependency: libz.so.1()(64bit)
   provider: zlib-1.2.11-17.el8.x86_64
  dependency: mod_http2
   provider: mod_http2-1.15.7-3.module_el8.4.0+778+c970deab.x86_64
  dependency: rtld(GNU_HASH)
   provider: glibc-2.28-151.el8.i686
   provider: glibc-2.28-151.el8.x86_64
  dependency: system-logos-httpd >= 82.0
   provider: centos-logos-httpd-85.8-1.el8.noarch
  dependency: systemd-units
   provider: systemd-239-45.el8_4.3.i686
   provider: systemd-239-45.el8_4.3.x86_64

なお、dnf deplistdnf repoquery --deplistのエイリアスでもあります。

$ dnf repoquery --deplist httpd

RPMファイルから調べる

RPMファイルから依存関係を調べるのも、同様にdnf deplistが使えます。

$ dnf deplist httpd-2.4.37-39.module_el8.4.0+778+c970deab.x86_64.rpm

rpm -qRpでも可能です。

$ rpm -qRp httpd-2.4.37-39.module_el8.4.0+778+c970deab.x86_64.rpm

結果の表示はだいぶ異なりますが。

$ rpm -qRp httpd-2.4.37-39.module_el8.4.0+778+c970deab.x86_64.rpm 
/bin/sh
/bin/sh
/bin/sh
/bin/sh
/bin/sh
/bin/sh
/etc/mime.types
config(httpd) = 2.4.37-39.module_el8.4.0+778+c970deab
httpd-filesystem
httpd-filesystem = 2.4.37-39.module_el8.4.0+778+c970deab
httpd-tools = 2.4.37-39.module_el8.4.0+778+c970deab
libapr-1.so.0()(64bit)
libaprutil-1.so.0()(64bit)
libbrotlienc.so.1()(64bit)
libc.so.6()(64bit)
libc.so.6(GLIBC_2.14)(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.3.4)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
libcrypt.so.1()(64bit)
libcrypt.so.1(XCRYPT_2.0)(64bit)
libdl.so.2()(64bit)
libexpat.so.1()(64bit)
liblua-5.3.so()(64bit)
libm.so.6()(64bit)
libpcre.so.1()(64bit)
libpthread.so.0()(64bit)
libpthread.so.0(GLIBC_2.2.5)(64bit)
libselinux.so.1()(64bit)
libsystemd.so.0()(64bit)
libsystemd.so.0(LIBSYSTEMD_209)(64bit)
libz.so.1()(64bit)
mod_http2
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileCaps) <= 4.6.1-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(PayloadIsXz) <= 5.2-1
rtld(GNU_HASH)
system-logos-httpd >= 82.0
systemd-units
systemd-units
systemd-units

ファイルがどのRPMパッケージに含まれているか確認する

最初に、Apacheをインストールしておきます。

$ sudo dnf install httpd

バージョン。

$ httpd -V
Server version: Apache/2.4.37 (centos)
Server built:   May 20 2021 04:33:06
Server's Module Magic Number: 20120211:83
Server loaded:  APR 1.6.3, APR-UTIL 1.6.1
Compiled using: APR 1.6.3, APR-UTIL 1.6.1
Architecture:   64-bit
Server MPM:     event
  threaded:     yes (fixed thread count)
    forked:     yes (variable process count)
Server compiled with....
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=256
 -D HTTPD_ROOT="/etc/httpd"
 -D SUEXEC_BIN="/usr/sbin/suexec"
 -D DEFAULT_PIDLOG="run/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"

httpdパッケージのインストールで配置されたファイルから、パッケージを特定します。

たとえば、Apacheの実行バイナリを例に。

$ which httpd
/usr/sbin/httpd

rpm -qfで、httpdパッケージに含まれていることが確認できます。

$ rpm -qf /usr/sbin/httpd
httpd-2.4.37-39.module_el8.4.0+778+c970deab.x86_64

設定ファイルなどでもOKです。

$ rpm -qf /etc/httpd/conf/httpd.conf
httpd-2.4.37-39.module_el8.4.0+778+c970deab.x86_64

RPMパッケージに含まれるファイルを確認する

オマケ的に。

RPMファイルにどのようなファイルが含まれるかは、rpm -qlで確認できます。

$ rpm -ql httpd-2.4.37-39.module_el8.4.0+778+c970deab.x86_64.rpm
/etc/httpd/conf
/etc/httpd/conf.d/autoindex.conf
/etc/httpd/conf.d/userdir.conf
/etc/httpd/conf.d/welcome.conf
/etc/httpd/conf.modules.d
/etc/httpd/conf.modules.d/00-base.conf
/etc/httpd/conf.modules.d/00-dav.conf
/etc/httpd/conf.modules.d/00-lua.conf
/etc/httpd/conf.modules.d/00-mpm.conf
/etc/httpd/conf.modules.d/00-optional.conf
/etc/httpd/conf.modules.d/00-proxy.conf
/etc/httpd/conf.modules.d/00-systemd.conf
/etc/httpd/conf.modules.d/01-cgi.conf
/etc/httpd/conf.modules.d/README
/etc/httpd/conf/httpd.conf
/etc/httpd/conf/magic
/etc/httpd/logs
/etc/httpd/modules
/etc/httpd/run
/etc/httpd/state

〜省略〜

パッケージをインストールしている場合は、パッケージ名でもOKです。

$ rpm -ql httpd
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?