よく使うrpmコマンドのオプション

Infrastructure

rpmコマンドのオプションのうち、よく使うものをメモ

rpm -qa

インストールされているrpmの一覧を出力する。

[root@localhost ~]# rpm -qa
nss-3.53.1-7.el7_9.x86_64
policycoreutils-2.5-34.el7.x86_64
net-snmp-libs-5.7.2-49.el7_9.1.x86_64
authconfig-6.2.8-30.el7.x86_64
kbd-misc-1.15.5-15.el7.noarch
kbd-1.15.5-15.el7.x86_64
chrony-3.4-1.el7.x86_64
man-db-2.6.3-11.el7.x86_64
libsepol-2.5-10.el7.x86_64
device-mapper-1.02.170-6.el7_9.5.x86_64
libffi-3.0.13-19.el7.x86_64

rpm -qa | grep <regex>

rpm のオプションとは違うが、パイプでgrepに渡して目的のrpmがインストールされているかどうか調べるコマンド

[root@localhost ~]# rpm -qa | grep ssh
openssh-server-7.4p1-21.el7.x86_64
openssh-clients-7.4p1-21.el7.x86_64
libssh2-1.8.0-4.el7.x86_64
openssh-7.4p1-21.el7.x86_64

rpm -ivh

rpmが手元にあり、インストールしたいときに使う

rpm -ivh bind-9.11.4-9.P2.el7.x86_64.rpm 

アップデートの場合は-Uvhとする

rpm -qi

rpm -qaでインストールされているパッケージが出力出来たら、-qiでインストール時の詳細を表示することが出来る。インストール元、インストールされた時間などが表示できるので何かと役に立つ。

[root@localhost ~]# rpm -qi openssh-clients-7.4p1-21.el7.x86_64
Name        : openssh-clients
Version     : 7.4p1
Release     : 21.el7
Architecture: x86_64
Install Date: 2020年01月01日 00時42分04秒
Group       : Applications/Internet
Size        : 2643176
License     : BSD
Signature   : RSA/SHA256, 2019年08月23日 06時37分26秒, Key ID 24c6a8a7f4a80eb5
Source RPM  : openssh-7.4p1-21.el7.src.rpm
Build Date  : 2019年08月09日 10時40分49秒
Build Host  : x86-01.bsys.centos.org
Relocations : (not relocatable)
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Vendor      : CentOS
URL         : http://www.openssh.com/portable.html
Summary     : An open source SSH client applications
Description :
OpenSSH is a free version of SSH (Secure SHell), a program for logging
into and executing commands on a remote machine. This package includes
the clients necessary to make encrypted connections to SSH servers.

この記事を書いた人

渋谷で働くよわよわエンジニア。TypeScript(Next.js/Node.js)/Golang/AWS/Flutterなど
LINE API Expert(2023/1~)

tokkuをフォローする
オススメ記事
在宅ワークが多くなって、デスクの配線周りに困っている方は、拡張デスクの導入がおすすめです。Windows/MacOS/Linuxの複数の機器をスッキリとデスク周りに収める事ができました!リモートからサーバーメンテを行うインフラエンジニアは必見です!
InfrastructureLinux
tokkuをフォローする
インフラエンジニアがもがくブログ

コメント

タイトルとURLをコピーしました