나는 다음과 같은 대답을 계속 받는다.
yum list installed | grep bind
또는
rpm -qa | grep bind
그러나 다음과 같은 몇 가지 다른 바인드 패키지 목록을 얻었으므로 정확하지 않습니다.
bind-utils-9.8.2-0.17.rc1.el6_4.5.x86_64
rpcbind-0.2.0-11.el6.x86_64
bind-libs-9.8.2-0.17.rc1.el6_4.5.x86_64
samba-winbind-3.6.9-151.el6.x86_64
samba-winbind-clients-3.6.9-151.el6.x86_64
ypbind-1.20.4-30.el6.x86_64
그건 내가 원하는 게 아니야 대신 바인드 코어 패키지가 설치되어 있는지 정확하게 확인하고 싶습니다. 예 :bind.x86_64 32:9.8.2-0.17.rc1.el6_4.6
나는 다음과 같은 것을 바랐다.
yum check installed bind
그러나 누군가가 빛을 비출 수 있기를 바랍니다.
답변
이것을 시도 했습니까?
$ yum list installed bind
답변
이 쿼리를 발행하는 훨씬 쉬운 방법이 있습니다 : rpm -qa | grep bind또는 rpm -q bind. 전자는 패키지 이름을 완전히 모르는 경우에 가장 좋습니다.
답변
이 명령의 결과를 파싱하는 것이 가장 완전한 답입니다. 정확한 패키지 이름을 알아야합니다.
yum info bind
Loaded plugins: refresh-packagekit, rhnplugin
This system is receiving updates from RHN Classic or RHN Satellite.
Installed Packages
Name : bind
Arch : x86_64
Epoch : 32
Version : 9.8.2
Release : 0.17.rc1.el6_4.6
Size : 7.3 M
Repo : installed
From repo : rhel-x86_64-workstation-6
Summary : The Berkeley Internet Name Domain (BIND) DNS (Domain Name System) server
URL : http://www.isc.org/products/BIND/
License : ISC
Description : BIND (Berkeley Internet Name Domain) is an implementation of the DNS
: (Domain Name System) protocols. BIND includes a DNS server (named),
: which resolves host names to IP addresses; a resolver library
: (routines for applications to use when interfacing with DNS); and
: tools for verifying that the DNS server is operating properly.
답변
이 작업을 수행하기 위해 내가 만든 최고의 라이너는 다음과 같습니다 (스크립트에서 빠르게 사용하기에 좋습니다).
yum info <package_name> | grep Repo | awk '{ print $3 }'
예를 들어 : 현재 git설치 한 경우 :
yum info git | grep Repo | awk '{ print $3 }'
이것은 돌아올 것이다 installed
나는 현재 않으면 하지 않은 git: 같은 이전 명령을 돌려 보낼 설치 base/7/x86_64에 대한 현재 사용 가능한 설치되는git
답변
Python 코드를 사용하여 yum을 사용하여 패키지가 Python에 설치되어 있는지 확인하십시오.
def is_installed(package_name):
return "not installed" in commands.getstatusoutput("rpm -q " + package_name)[1]
답변
yum list installed bind >/dev/null ; echo $?
결과가 0이면 패키지가 설치된 것입니다