如何列出属于Linux中特定组的已安装软件包
如何列出属于特定组的已安装的包。
正如我们所知道的,所有Linux发行版都具有一次安装一组软件包的能力。
这就是我们所说的包组。
例如,"Mate-Desktop"包组将安装所有包相关的Mate桌面环境。
简而言之,包装组是一种提供共同目的的包的集合。
本简要教程介绍如何列出属于Linux中特定组的已安装软件包。
列出属于Linux中特定组的已安装软件包
在测试下面给出的这些命令之前,请确保在Linux框中安装了某些包组。
关于Arch Linux:
在ARCH Linux及其衍生产品(如Antergos),Manjaro Linux等,以下命令将显示已安装的软件包属于Mate包组。
$sudo pacman -Qg mate
示例输出:
mate caja mate marco mate mate-backgrounds mate mate-control-center mate mate-desktop mate mate-icon-theme mate mate-menus mate mate-notification-daemon mate mate-panel mate mate-polkit mate mate-session-manager mate mate-settings-daemon mate mate-themes mate mate-user-guide
类似地,以下命令显示已安装的软件包属于LXDE包组。
$sudo pacman -Qg lxde
请注意,上述命令只会显示程序包组的已安装软件包。
要列出所有包属于组,请运行:
$sudo pacman -Sg lxde
有关更多详细信息,请参阅Man页面。
$man pacman
下载 - 免费提示和技巧教程:"Windows应用程序的Linux替代品"
关于基于RPM的系统,如Rhel,Centos,Fedora:
要列出已安装的软件包属于名为"Web服务器"的组,请将以下命令运行为root用户:
# yum groups info "Web Server"
示例输出:
Loaded plugins: fastestmirror, langpacks Loading mirror speeds from cached hostfile * base: centos.excellmedia.net * epel: mirror.vinahost.vn * extras: centos.excellmedia.net * updates: centos.excellmedia.net Group: Web Server Group-Id: web-server Description: Allows the system to act as a web server, and run Perl and Python web applications. Mandatory Packages: =httpd Default Packages: =crypto-utils =httpd-manual =mod_fcgid =mod_ssl Optional Packages: Pound certmonger cherokee libmemcached memcached mod_auth_kerb mod_auth_mellon mod_auth_openidc mod_fcgid mod_nss mod_revocator mod_security mod_security_crs moin perl-CGI perl-CGI-Session plone python-memcached squid zope
在上面的输出中看到,包标记为不同的符号。
- "=":已安装包,它作为包组的一部分安装。
- "+":包未安装包,但它将安装在下一个yum升级或者yum group升级上。
- " - ":未安装包,它不会安装为包组的一部分。
- 没有符号:已安装包,但它已安装在包组之外。这意味着yum group删除命令不会删除这些包。
有关更多详细信息,请参阅Man页面。
# man yum
在Debian,Ubuntu系统:
在基于DEB的系统中,包组被称为"任务"。
任务是预定义的软件集合。
要查看可用任务列表,请运行:
$tasksel --list-task
示例输出:
u manual Manual package selection u kubuntu-live Kubuntu live CD u lubuntu-live Lubuntu live CD u ubuntu-gnome-live Ubuntu GNOME live CD u ubuntu-live Ubuntu live CD u ubuntu-mate-live Ubuntu MATE Live CD u ubuntustudio-dvd-live Ubuntu Studio live DVD u ubuntustudio-live Ubuntu Studio live CD u xubuntu-live Xubuntu live CD u cloud-image Ubuntu Cloud Image (instance) u dns-server DNS server u edubuntu-desktop-gnome Edubuntu desktop u kubuntu-desktop Kubuntu desktop u kubuntu-full Kubuntu full u lamp-server LAMP server u lubuntu-core Lubuntu minimal installation u lubuntu-desktop Lubuntu Desktop u mail-server Mail server u mythbuntu-backend-master Mythbuntu master backend u mythbuntu-backend-slave Mythbuntu slave backend u mythbuntu-desktop Mythbuntu additional roles u mythbuntu-frontend Mythbuntu frontend u postgresql-server PostgreSQL database u samba-server Samba file server u tomcat-server Tomcat Java server u ubuntu-desktop Ubuntu desktop u ubuntu-gnome-desktop Ubuntu GNOME desktop u ubuntu-mate-cloudtop Ubuntu MATE cloudtop u ubuntu-mate-core Ubuntu MATE minimal installation u ubuntu-mate-desktop Ubuntu MATE desktop u ubuntu-usb Ubuntu desktop USB u ubuntustudio-audio Audio recording and editing suite u ubuntustudio-desktop Ubuntu Studio desktop u ubuntustudio-desktop-core Ubuntu Studio minimal DE installation u ubuntustudio-font-meta Large selection of font packages u ubuntustudio-graphics 2D/3D creation and editing suite u ubuntustudio-photography Photograph touchup and editing suite u ubuntustudio-publishing Publishing applications u ubuntustudio-video Video creation and editing suite u virt-host Virtual Machine host u xubuntu-core Xubuntu minimal installation u xubuntu-desktop Xubuntu desktop i openssh-server OpenSSH server i server Basic Ubuntu server
其中字母'U'和'i'表示卸载/未安装和安装的任务。
在上面的输出中看到,我有两个安装的任务即'OpenSSH-Server'和'Server'。
现在,让我们回到主题。
要列出属于任何包组(即任务)的软件包,例如openssh-server,运行:
$aptitude show openssh-server
此命令将列出该任务将安装的包。
示例输出:
Package: openssh-server State: installed Automatically installed: no Multi-Arch: foreign Version: 1:7.2p2-4ubuntu2.1 Priority: optional Section: net Maintainer: Ubuntu Developers <Hyman@theitroad> Architecture: amd64 Uncompressed Size: 912 k Depends: libaudit1 (>= 1:2.2.1), libc6 (>= 2.17), libcomerr2 (>= 1.01), libgssapi-krb5-2 (>= 1.12.1+dfsg-2), libkrb5-3 (>= 1.13~alpha1+dfsg), libpam0g (>= 0.99.7.1), libselinux1 (>= 1.32), libssl1.0.0 (>= 1.0.2), libsystemd0, libwrap0 (>= 7.6-4~), zlib1g (>= 1:1.1.4), debconf (>= 0.5) | debconf-2.0, init-system-helpers (>= 1.18~), lsb-base (>= 4.1+Debian11ubuntu7), openssh-client (= 1:7.2p2-4ubuntu2.1), libpam-runtime (>= 0.76-14), libpam-modules (>= 0.72-9), adduser (>= 3.9), dpkg (>= 1.9.0), procps, openssh-sftp-server Recommends: xauth, ncurses-term, ssh-import-id Suggests: ssh-askpass, rssh, molly-guard, ufw, monkeysphere Conflicts: sftp, ssh-socks, ssh2, openssh-server:i386 Replaces: ssh, ssh:i386, ssh-krb5, ssh-krb5:i386 Provides: openssh-server:i386 (= 1:7.2p2-4ubuntu2.1), ssh-server, ssh-server:i386 Provided by: openssh-server:i386 (1:7.2p2-4), openssh-server:i386 (1:7.2p2-4ubuntu2.1) Description: secure shell (SSH) server, for secure access from remote machines This is the portable version of OpenSSH, a free implementation of the Secure Shell protocol as specified by the IETF secsh working group. [...]
有关更多详细信息,请参阅man页面:
$man apt
在SUSE/OpenSUSE上:
在SUSE/OpenSUSE Distrs中,软件组被称为模式。
要了解哪些包属于模式,请使用"IF"或者"INFO"如下所示:
$zypper if -t pattern <pattern_name>
或者,
$zypper pattern-info <pattern_name>
例如,以下命令显示包属于名为lamp_server的模式。
$zypper pattern-info lamp_server
有关更多详细信息,请参阅Man页面:
$man zupper