更新するパッケージの現在のバージョンと将来のバージョンを知ることができる簡単な yum コマンドはありますか。
私は今、次のことについて考えています:
yum list updates
しかし、それはパッケージの新しいバージョンのみを印刷します...
答え1
インストールされているすべてのパッケージを一覧表示するには、次のコマンドを使用します。
# yum list installed
特定のパッケージについては、次を試してください:
# yum info httpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.vietoss.com
* epel: ftp.cuhk.edu.hk
* extras: mirror.vietoss.com
* rpmforge: ftp-stud.fht-esslingen.de
* updates: mirror.vietoss.com
Installed Packages
Name : httpd
Arch : x86_64
Version : 2.2.3
Release : 43.el5.centos
Size : 3.3 M
Repo : installed
Summary : Apache HTTP Server
URL : http://httpd.apache.org/
License : Apache Software License
Description: The Apache HTTP Server is a powerful, efficient, and extensible
: web server.
Available Packages
Name : httpd
Arch : x86_64
Version : 2.2.3
Release : 53.el5.centos.3
Size : 1.2 M
Repo : updates
Summary : Apache HTTP Server
URL : http://httpd.apache.org/
License : Apache Software License
Description: The Apache HTTP Server is a powerful, efficient, and extensible
: web server.
# yum list httpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.vietoss.com
* epel: ftp.cuhk.edu.hk
* extras: mirror.vietoss.com
* rpmforge: ftp-stud.fht-esslingen.de
* updates: mirror.vietoss.com
Installed Packages
httpd.x86_64 2.2.3-43.el5.centos installed
Available Packages
httpd.x86_64 2.2.3-53.el5.centos.3 updates
答え2
これをさらにスクリプト化したい場合は、rpm から直接抜け出す方が簡単かもしれません。次のように実行することで、インストールしたパッケージとそのバージョンの一覧を取得できます
rpm -qa --queryformat "%{NAME} %{VERSION}\n"
。
%{VARIABLES} に入れることができるすべてのものを調べるには、次のコマンドを実行しますrpm --querytags
。このフォーマットは、printf と同様に引数を取ります (たとえば、改行の場合は \n、タブの場合は \t など)。