Rpm

已安裝軟體包的 zypper 和 rpm 之間的區別

  • February 28, 2022

我正在尋找一種可靠的方法來查找我的 OpenSUSE Leap 15.3 系統上安裝了多少個軟體包。我試過:

# number of available packages in the repos
vm-admin:~ # zypper se -s | wc -l
55800

# number of installed packages from the repos
vm-admin:~ # zypper se -si | wc -l
1490

# number of installed packages?
vm-admin:~ # rpm -qa | wc -l
1091

# number of available packages?
vm-admin:~ # pkcon get-packages | grep Available | wc -l
51058

# number of installed packages?
vm-admin:~ # pkcon get-packages | grep Installed | wc -l
1086

這些命令命令之間有什麼區別?

總而言之,zypper 比 rpm 詳細得多。只是為了展示我的一台虛擬機上的一個範例的不同之處:

ses7-host1:~ # zypper se -si ceph-common
Loading repository data...
Reading installed packages...

S  | Name                | Type    | Version                        | Arch   | Repository
---+---------------------+---------+--------------------------------+--------+-------------------------------------------------
i+ | ceph-common         | package | 15.2.14.84+gb6e5642e260-3.31.1 | x86_64 | SLE-Module-Basesystem15-SP2-Updates for x86_64
i+ | ceph-common         | package | 15.2.14.84+gb6e5642e260-3.31.1 | x86_64 | SUSE-Enterprise-Storage-7-Updates for x86_64 SP2
i  | python3-ceph-common | package | 15.2.14.84+gb6e5642e260-3.31.1 | x86_64 | SLE-Module-Basesystem15-SP2-Updates for x86_64
i  | python3-ceph-common | package | 15.2.14.84+gb6e5642e260-3.31.1 | x86_64 | SUSE-Enterprise-Storage-7-Updates for x86_64 SP2

該軟體包ceph-common可從兩個不同的儲存庫中獲得,但由於版本完全相同,因此被列為從兩者安裝。但rpm只能安裝一個包,當然:

ses7-host1:~ # rpm -qa | grep ceph-common
ceph-common-15.2.14.84+gb6e5642e260-3.31.1.x86_64
python3-ceph-common-15.2.14.84+gb6e5642e260-3.31.1.x86_64

然後你也應該注意到,zypper se -si你看到的不僅僅是安裝的包,還有模式、更新檔和模式,如果你想自己編譯包,甚至可能是原始碼。的輸出rpm -qa是 的子集zypper se -si

引用自:https://serverfault.com/questions/1094042