yum provides 사용

yum 은 provides 명령어를 제공하므로 특정 파일이 어떤 패키지에서 제공되는지 확인할 수 있습니다.

예로 다음 명령어로 gcc 를 제공하는 패키지명을 알수 있습니다.

$ sudo yum provides '/usr/bin/gcc'

Last metadata expiration check: 2:27:08 ago on Tue 23 Feb 2021 11:51:48 AM UTC.
gcc-8.2.1-3.5.el8.x86_64 : Various compilers (C, C++, Objective-C, ...)
Repo        : rhel-8-appstream-rhui-rpms
Matched from:
Filename    : /usr/bin/gcc

gcc-8.3.1-4.5.el8.x86_64 : Various compilers (C, C++, Objective-C, ...)
Repo        : rhel-8-appstream-rhui-rpms
Matched from:
Filename    : /usr/bin/gcc
BASH


경로를 특정하지 않고 gcc 를 찾을 경우 * 을 사용하면 됩니다. 다음 명령어는 gcc 라는 파일을 제공하는 모든 패키지를 출력합니다.

$ sudo yum provides '*/gcc'

gcc-toolset-9-libubsan-devel-9.2.1-2.3.el8.i686 : The Undefined Behavior Sanitizer static library
Repo        : rhel-8-appstream-rhui-rpms
Matched from:
Filename    : /opt/rh/gcc-toolset-9/root/usr/lib/gcc

gcc-toolset-9-libubsan-devel-9.2.1-2.3.el8.x86_64 : The Undefined Behavior Sanitizer static library
Repo        : rhel-8-appstream-rhui-rpms
Matched from:
Filename    : /opt/rh/gcc-toolset-9/root/usr/lib/gcc
BASH

rpm query 사용

이미 설치되어 있는 파일이 속한 패키지를 알아낼 경우 rpm 의 query 명령어를 사용하면 됩니다.


예로 다음 rpm -qf 명령어로 /etc/sysctl.conf  파일을 제공하는 패키지를 알수 있습니다.

$  rpm -qf /etc/sysctl.conf 

systemd-239-41.el8_3.x86_64
BASH


같이 보기