본문으로 건너뛰기

rpm 명령어로 설치된 패키지 정보를 확인하는 방법은 무엇인가요?

💡 요약 정리

  • rpm 명령어의 -q, --query 옵션을 사용하여 설치된 패키지 정보를 확인할 수 있습니다.
  • -qa, -qi, -qf, -ql, -qd, -qc, -qR 등의 하위 옵션을 조합해 다양한 정보 검색이 가능합니다.
  • grep 명령어와 결합하면 특정 패키지 필터링도 가능합니다.

1. 설치된 모든 패키지 확인하기

  • rpm -qa 또는 rpm -q --all 명령어로 시스템에 설치된 모든 패키지를 나열합니다.
[root@localhost ~]# rpm -qa
[root@localhost ~]# rpm -q --all

vsftpd-2.0.5-24.el5_8.1
libhbaapi-devel-2.2-6.el5
dump-0.4b41-6.el5
nss-3.13.1-5.el5_8
libacl-2.2.39-8.el5
libhbaapi-2.2-6.el5
libgfortran44-4.4.6-3.el5.1
xulrunner-devel-10.0.5-1.el5_8
expat-devel-1.95.8-11.el5_8
libxml2-python-2.6.26-2.1.15.el5_8.2
mkinitrd-5.1.19.6-75.el5
PyXML-0.8.4-6.el5
sabayon-2.12.4-9.el5
system-config-bind-4.0.3-5.el5.centos
libtool-ltdl-1.5.22-7.el5_4
tclx-8.4.0-5.fc6
  • grep 을 함께 사용하면 특정 패키지를 필터링해 확인할 수 있습니다.
[root@localhost ~]# rpm -qa | grep mysql
[root@localhost ~]# rpm -qa | grep vsftpd

vsftpd-2.0.5-24.el5_8.1
[root@localhost ~]#

2. 패키지의 상세 정보 확인하기

  • rpm -qi 또는 rpm -q --info 옵션을 사용합니다.
[root@localhost ~]# rpm -qi httpd

package httpd is not installed

[root@localhost ~]# rpm -qa | grep mysql

mysql-5.0.95-1.el5_7.1

[root@localhost ~]# rpm -qi mysql
[root@localhost ~]# rpm -q --info mysql

Name        : mysql                     Relocations: (not relocatable)
Version     : 5.0.95                    Vendor: CentOS
Release     : 1.el5_7.1                 Build Date: Tue Feb 14 07:08:03 2012
Install Date: Wed Jul 18 14:14:01 2012  Build Host: builder10.centos.org
Group       : Applications/Databases    Source RPM: mysql-5.0.95-1.el5_7.1.src.rpm
Size        : 8582075                   License: GPLv2 with exceptions
Signature   : DSA/SHA1, Tue Feb 14 12:09:23 2012, Key ID a8a447dce8562897
URL         : http://www.mysql.com
Summary     : MySQL client programs and shared libraries
Description :
MySQL is a multi-user, multi-threaded SQL database server. MySQL is a
client/server implementation consisting of a server daemon (mysqld)
and many different client programs and libraries. The base package
contains the MySQL client programs, the client shared libraries, and
generic MySQL files.

[root@localhost ~]#

3. 특정 파일이 어떤 패키지에 속해있는지 확인하기

  • rpm -qf 또는 rpm -q --file 옵션을 사용합니다.
[root@localhost ~]# which df

/bin/df

[root@localhost ~]# rpm -qf /bin/df
[root@localhost ~]# rpm -q --file /bin/df

coreutils-5.97-34.el5_8.1
[root@localhost ~]#

4. 패키지가 포함하고 있는 파일 목록 확인하기

  • rpm -ql 또는 rpm -q --list 옵션을 사용합니다.
[root@localhost ~]# rpm -ql coreutils
[root@localhost ~]# rpm -q --list coreutils

/bin/basename
/bin/cat
/bin/chgrp
/bin/chmod
/bin/chown
/bin/cp
/bin/cut
...
/usr/share/man/man1/unlink.1.gz
/usr/share/man/man1/users.1.gz
/usr/share/man/man1/vdir.1.gz
/usr/share/man/man1/wc.1.gz
/usr/share/man/man1/who.1.gz
/usr/share/man/man1/whoami.1.gz
/usr/share/man/man1/yes.1.gz

[root@localhost mail]#

5. 패키지 문서 파일 목록 확인하기

  • rpm -qd 또는 rpm -q --docfiles 옵션을 사용합니다.
[root@localhost ~]# rpm -qd coreutils
[root@localhost ~]# rpm -q --docfiles coreutils

/usr/share/doc/coreutils-5.97/ABOUT-NLS
/usr/share/doc/coreutils-5.97/ChangeLog.bz2
/usr/share/doc/coreutils-5.97/NEWS
/usr/share/doc/coreutils-5.97/README
/usr/share/doc/coreutils-5.97/THANKS
/usr/share/doc/coreutils-5.97/TODO
/usr/share/doc/coreutils-5.97/fileutils/ChangeLog-1997.bz2
/usr/share/doc/coreutils-5.97/fileutils/ChangeLog.bz2
...
/usr/share/man/man1/uniq.1.gz
/usr/share/man/man1/unlink.1.gz
/usr/share/man/man1/users.1.gz
/usr/share/man/man1/vdir.1.gz
/usr/share/man/man1/wc.1.gz
/usr/share/man/man1/who.1.gz
/usr/share/man/man1/whoami.1.gz
/usr/share/man/man1/yes.1.gz

6. 패키지 설정 파일 목록 확인하기

  • rpm -qc 또는 rpm -q --configfiles 옵션을 사용합니다.
[root@localhost ~]# rpm -qc coreutils
[root@localhost ~]# rpm -q --configfiles coreutils

/etc/DIR_COLORS
/etc/DIR_COLORS.xterm
/etc/pam.d/runuser
/etc/pam.d/runuser-l
/etc/pam.d/su
/etc/pam.d/su-l
/etc/profile.d/colorls.csh
/etc/profile.d/colorls.sh

7. 패키지 의존성 확인하기

  • rpm -qR 또는 rpm -q --requires 옵션을 사용합니다.
[root@localhost ~]# rpm -qR coreutils
[root@localhost ~]# rpm -q --requires coreutils

/bin/sh
/bin/sh
/bin/sh
/bin/sh
/sbin/install-info
config(coreutils) = 5.97-34.el5_8.1
findutils
grep
libacl.so.1()(64bit)
libacl.so.1(ACL_1.0)(64bit)
libattr
libattr.so.1()(64bit)
libattr.so.1(ATTR_1.1)(64bit)
libc.so.6()(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)
libdl.so.2()(64bit)
libm.so.6()(64bit)
libm.so.6(GLIBC_2.2.5)(64bit)
libpam.so.0()(64bit)
libpam.so.0(LIBPAM_1.0)(64bit)
libpam_misc.so.0()(64bit)
libpam_misc.so.0(LIBPAM_MISC_1.0)(64bit)
librt.so.1()(64bit)
librt.so.1(GLIBC_2.2.5)(64bit)
libselinux >= 1.25.6-1
libselinux.so.1()(64bit)
pam >= 0.66-12
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rpmlib(VersionedDependencies) <= 3.0.3-1
rtld(GNU_HASH)

[root@localhost ~]#