Linux中國

如何在 Linux 中列出可用的軟體包組

我們知道,如果想要在 Linux 中安裝軟體包,可以使用軟體包管理器來進行安裝。由於系統管理員需要頻繁用到軟體包管理器,所以它是 Linux 當中的一個重要工具。

但是如果想一次性安裝一個軟體包組,在 Linux 中有可能嗎?又如何通過命令去實現呢?

在 Linux 中確實可以用軟體包管理器來達到這樣的目的。很多軟體包管理器都有這樣的選項來實現這個功能,但就我所知,aptapt-get 軟體包管理器卻並沒有這個選項。因此對基於 Debian 的系統,需要使用的命令是 tasksel,而不是 aptapt-get 這樣的官方軟體包管理器。

在 Linux 中安裝軟體包組有很多好處。對於 LAMP 來說,安裝過程會包含多個軟體包,但如果安裝軟體包組命令來安裝,只安裝一個包就可以了。

當你的團隊需要安裝 LAMP,但不知道其中具體包含哪些軟體包,這個時候軟體包組就派上用場了。軟體包組是 Linux 系統上一個很方便的工具,它能讓你輕鬆地完成一組軟體包的安裝。

軟體包組是一組用於公共功能的軟體包,包括系統工具、聲音和視頻。 安裝軟體包組的過程中,會獲取到一系列的依賴包,從而大大節省了時間。

推薦閱讀:

如何在 CentOS/RHEL 系統上列出可用的軟體包組

RHEL 和 CentOS 系統使用的是 RPM 軟體包,因此可以使用 yum 軟體包管理器來獲取相關的軟體包信息。

yum 是 「Yellowdog Updater, Modified」 的縮寫,它是一個用於基於 RPM 系統(例如 RHEL 和 CentOS)的,開源的命令行軟體包管理工具。它是從發行版倉庫或其它第三方庫中獲取、安裝、刪除、查詢和管理 RPM 包的主要工具。

推薦閱讀: 使用 yum 命令在 RHEL/CentOS 系統上管理軟體包

# yum grouplist
Loaded plugins: fastestmirror, security
Setting up Group Process
Loading mirror speeds from cached hostfile
 * epel: epel.mirror.constant.com
Installed Groups:
 Base
 E-mail server
 Graphical Administration Tools
 Hardware monitoring utilities
 Legacy UNIX compatibility
 Milkymist
 Networking Tools
 Performance Tools
 Perl Support
 Security Tools
Available Groups:
 Additional Development
 Backup Client
 Backup Server
 CIFS file server
 Client management tools
 Compatibility libraries
 Console internet tools
 Debugging Tools
 Desktop
.
.
Available Language Groups:
 Afrikaans Support [af]
 Albanian Support [sq]
 Amazigh Support [ber]
 Arabic Support [ar]
 Armenian Support [hy]
 Assamese Support [as]
 Azerbaijani Support [az]
.
.
Done

如果需要列出相關聯的軟體包,可以執行以下這個命令。下面的例子是列出和 「Performance Tools」 組相關聯的軟體包。

# yum groupinfo "Performance Tools"
Loaded plugins: fastestmirror, security
Setting up Group Process
Loading mirror speeds from cached hostfile
 * epel: ewr.edge.kernel.org

Group: Performance Tools
 Description: Tools for diagnosing system and application-level performance problems.
 Mandatory Packages:
 blktrace
 sysstat
 Default Packages:
 dstat
 iotop
 latencytop
 latencytop-tui
 oprofile
 perf
 powertop
 seekwatcher
 Optional Packages:
 oprofile-jit
 papi
 sdparm
 sg3_utils
 tiobench
 tuned
 tuned-utils

如何在 Fedora 系統上列出可用的軟體包組

Fedora 系統使用的是 DNF 軟體包管理器,因此可以通過 DNF 軟體包管理器來獲取相關的信息。

DNF 的含義是 「Dandified yum」。DNF 軟體包管理器是 YUM 軟體包管理器的一個分支,它使用 hawkey/libsolv 庫作為後端。從 Fedora 18 開始,Aleš Kozumplík 開始著手 DNF 的開發,直到在 Fedora 22 開始加入到系統中。

dnf 命令可以在 Fedora 22 及更高版本上安裝、更新、搜索和刪除軟體包, 它可以自動解決軟體包的依賴關係並其順利安裝,不會產生問題。

YUM 被 DNF 取代是由於 YUM 中存在一些長期未被解決的問題。為什麼 Aleš Kozumplík 沒有對 yum 的這些問題作出修補呢,他認為補丁解決存在技術上的難題,而 YUM 團隊也不會馬上接受這些更改,還有一些重要的問題。而且 YUM 的代碼量有 5.6 萬行,而 DNF 只有 2.9 萬行。因此已經不需要沿著 YUM 的方向繼續開發了,重新開一個分支才是更好的選擇。

推薦閱讀: 在 Fedora 系統上使用 DNF 命令管理軟體包

# dnf grouplist
Last metadata expiration check: 0:00:00 ago on Sun 09 Sep 2018 07:10:36 PM IST.
Available Environment Groups:
 Fedora Custom Operating System
 Minimal Install
 Fedora Server Edition
 Fedora Workstation
 Fedora Cloud Server
 KDE Plasma Workspaces
 Xfce Desktop
 LXDE Desktop
 Hawaii Desktop
 LXQt Desktop
 Cinnamon Desktop
 MATE Desktop
 Sugar Desktop Environment
 Development and Creative Workstation
 Web Server
 Infrastructure Server
 Basic Desktop
Installed Groups:
 C Development Tools and Libraries
 Development Tools
Available Groups:
 3D Printing
 Administration Tools
 Ansible node
 Audio Production
 Authoring and Publishing
 Books and Guides
 Cloud Infrastructure
 Cloud Management Tools
 Container Management
 D Development Tools and Libraries
.
.
 RPM Development Tools
 Security Lab
 Text-based Internet
 Window Managers
 GNOME Desktop Environment
 Graphical Internet
 KDE (K Desktop Environment)
 Fonts
 Games and Entertainment
 Hardware Support
 Sound and Video
 System Tools

如果需要列出相關聯的軟體包,可以執行以下這個命令。下面的例子是列出和 「Editor」 組相關聯的軟體包。

# dnf groupinfo Editors
Last metadata expiration check: 0:04:57 ago on Sun 09 Sep 2018 07:10:36 PM IST.

Group: Editors
 Description: Sometimes called text editors, these are programs that allow you to create and edit text files. This includes Emacs and Vi.
 Optional Packages:
 code-editor
 cssed
 emacs
 emacs-auctex
 emacs-bbdb
 emacs-ess
 emacs-vm
 geany
 gobby
 jed
 joe
 leafpad
 nedit
 poedit
 psgml
 vim-X11
 vim-enhanced
 xemacs
 xemacs-packages-base
 xemacs-packages-extra
 xemacs-xft
 xmlcopyeditor
 zile

如何在 openSUSE 系統上列出可用的軟體包組

openSUSE 系統使用的是 zypper 軟體包管理器,因此可以通過 zypper 軟體包管理器來獲取相關的信息。

Zypper 是 suse 和 openSUSE 發行版的命令行包管理器。它可以用於安裝、更新、搜索和刪除軟體包,還有管理存儲庫,執行各種查詢等功能。 Zypper 命令行界面用到了 ZYpp 系統管理庫(libzypp)。

推薦閱讀: 在 openSUSE 和 suse 系統使用 zypper 命令管理軟體包

# zypper patterns
Loading repository data...
Warning: Repository 'Update Repository (Non-Oss)' appears to be outdated. Consider using a different mirror or server.
Warning: Repository 'Main Update Repository' appears to be outdated. Consider using a different mirror or server.
Reading installed packages...
S | Name | Version | Repository | Dependency
---|----------------------|---------------|-----------------------|-------- | 64bit | 20150918-25.1 | Main Repository (OSS) |
 | apparmor | 20150918-25.1 | Main Repository (OSS) |
i | apparmor | 20150918-25.1 | @System |
 | base | 20150918-25.1 | Main Repository (OSS) |
i+ | base | 20150918-25.1 | @System |
 | books | 20150918-25.1 | Main Repository (OSS) |
 | console | 20150918-25.1 | Main Repository (OSS) |
 | devel_C_C++ | 20150918-25.1 | Main Repository (OSS) |
i | enhanced_base | 20150918-25.1 | @System |
 | enlightenment | 20150918-25.1 | Main Repository (OSS) |
 | file_server | 20150918-25.1 | Main Repository (OSS) |
 | fonts | 20150918-25.1 | Main Repository (OSS) |
i | fonts | 20150918-25.1 | @System |
 | games | 20150918-25.1 | Main Repository (OSS) |
i | games | 20150918-25.1 | @System |
 | gnome | 20150918-25.1 | Main Repository (OSS) |
 | gnome_basis | 20150918-25.1 | Main Repository (OSS) |
i | imaging | 20150918-25.1 | @System |
 | kde | 20150918-25.1 | Main Repository (OSS) |
i+ | kde | 20150918-25.1 | @System |
 | kde_plasma | 20150918-25.1 | Main Repository (OSS) |
i | kde_plasma | 20150918-25.1 | @System |
 | lamp_server | 20150918-25.1 | Main Repository (OSS) |
 | laptop | 20150918-25.1 | Main Repository (OSS) |
i+ | laptop | 20150918-25.1 | @System |
 | lxde | 20150918-25.1 | Main Repository (OSS) |
 | lxqt | 20150918-25.1 | Main Repository (OSS) |
i | multimedia | 20150918-25.1 | @System |
 | network_admin | 20150918-25.1 | Main Repository (OSS) |
 | non_oss | 20150918-25.1 | Main Repository (OSS) |
i | non_oss | 20150918-25.1 | @System |
 | office | 20150918-25.1 | Main Repository (OSS) |
i | office | 20150918-25.1 | @System |
 | print_server | 20150918-25.1 | Main Repository (OSS) |
 | remote_desktop | 20150918-25.1 | Main Repository (OSS) |
 | x11 | 20150918-25.1 | Main Repository (OSS) |
i+ | x11 | 20150918-25.1 | @System |
 | x86 | 20150918-25.1 | Main Repository (OSS) |
 | xen_server | 20150918-25.1 | Main Repository (OSS) |
 | xfce | 20150918-25.1 | Main Repository (OSS) |
 | xfce_basis | 20150918-25.1 | Main Repository (OSS) |
 | yast2_basis | 20150918-25.1 | Main Repository (OSS) |
i | yast2_basis | 20150918-25.1 | @System |
 | yast2_install_wf | 20150918-25.1 | Main Repository (OSS) |

如果需要列出相關聯的軟體包,可以執行以下這個命令。下面的例子是列出和 「file_server」 組相關聯的軟體包。另外 zypper 還允許用戶使用不同的選項執行相同的操作。

# zypper info file_server
Loading repository data...
Warning: Repository 'Update Repository (Non-Oss)' appears to be outdated. Consider using a different mirror or server.
Warning: Repository 'Main Update Repository' appears to be outdated. Consider using a different mirror or server.
Reading installed packages...

Information for pattern file_server:
---------------------------------Repository : Main Repository (OSS)
Name : file_server
Version : 20150918-25.1
Arch : x86_64
Vendor : openSUSE
Installed : No
Visible to User : Yes
Summary : File Server
Description :
 File services to host files so that they may be accessed or retrieved by other computers on the same network. This includes the FTP, SMB, and NFS protocols.
Contents :
 S | Name | Type | Dependency
 ---|-------------------------------|---------|--------- i+ | patterns-openSUSE-base | package | Required
 | patterns-openSUSE-file_server | package | Required
 | nfs-kernel-server | package | Recommended
 i | nfsidmap | package | Recommended
 i | samba | package | Recommended
 i | samba-client | package | Recommended
 i | samba-winbind | package | Recommended
 | tftp | package | Recommended
 | vsftpd | package | Recommended
 | yast2-ftp-server | package | Recommended
 | yast2-nfs-server | package | Recommended
 i | yast2-samba-server | package | Recommended
 | yast2-tftp-server | package | Recommended

如果需要列出相關聯的軟體包,可以執行以下這個命令。

# zypper pattern-info file_server
Loading repository data...
Warning: Repository 'Update Repository (Non-Oss)' appears to be outdated. Consider using a different mirror or server.
Warning: Repository 'Main Update Repository' appears to be outdated. Consider using a different mirror or server.
Reading installed packages...

Information for pattern file_server:
---------------------------------Repository : Main Repository (OSS)
Name : file_server
Version : 20150918-25.1
Arch : x86_64
Vendor : openSUSE
Installed : No
Visible to User : Yes
Summary : File Server
Description :
 File services to host files so that they may be accessed or retrieved by other computers on the same network. This includes the FTP, SMB, and NFS protocols.
Contents :
 S | Name | Type | Dependency
 ---|-------------------------------|---------|--------- i+ | patterns-openSUSE-base | package | Required
 | patterns-openSUSE-file_server | package | Required
 | nfs-kernel-server | package | Recommended
 i | nfsidmap | package | Recommended
 i | samba | package | Recommended
 i | samba-client | package | Recommended
 i | samba-winbind | package | Recommended
 | tftp | package | Recommended
 | vsftpd | package | Recommended
 | yast2-ftp-server | package | Recommended
 | yast2-nfs-server | package | Recommended
 i | yast2-samba-server | package | Recommended
 | yast2-tftp-server | package | Recommended

如果需要列出相關聯的軟體包,也可以執行以下這個命令。

# zypper info pattern file_server
Loading repository data...
Warning: Repository 'Update Repository (Non-Oss)' appears to be outdated. Consider using a different mirror or server.
Warning: Repository 'Main Update Repository' appears to be outdated. Consider using a different mirror or server.
Reading installed packages...

Information for pattern file_server:
---------------------------------Repository : Main Repository (OSS)
Name : file_server
Version : 20150918-25.1
Arch : x86_64
Vendor : openSUSE
Installed : No
Visible to User : Yes
Summary : File Server
Description :
 File services to host files so that they may be accessed or retrieved by other computers on the same network. This includes the FTP, SMB, and NFS protocols.
Contents :
 S | Name | Type | Dependency
 ---|-------------------------------|---------|--------- i+ | patterns-openSUSE-base | package | Required
 | patterns-openSUSE-file_server | package | Required
 | nfs-kernel-server | package | Recommended
 i | nfsidmap | package | Recommended
 i | samba | package | Recommended
 i | samba-client | package | Recommended
 i | samba-winbind | package | Recommended
 | tftp | package | Recommended
 | vsftpd | package | Recommended
 | yast2-ftp-server | package | Recommended
 | yast2-nfs-server | package | Recommended
 i | yast2-samba-server | package | Recommended
 | yast2-tftp-server | package | Recommended

如果需要列出相關聯的軟體包,也可以執行以下這個命令。

# zypper info -t pattern file_server
Loading repository data...
Warning: Repository 'Update Repository (Non-Oss)' appears to be outdated. Consider using a different mirror or server.
Warning: Repository 'Main Update Repository' appears to be outdated. Consider using a different mirror or server.
Reading installed packages...

Information for pattern file_server:
---------------------------------Repository : Main Repository (OSS)
Name : file_server
Version : 20150918-25.1
Arch : x86_64
Vendor : openSUSE
Installed : No
Visible to User : Yes
Summary : File Server
Description :
 File services to host files so that they may be accessed or retrieved by other computers on the same network. This includes the FTP, SMB, and NFS protocols.
Contents :
 S | Name | Type | Dependency
 ---|-------------------------------|---------|--------- i+ | patterns-openSUSE-base | package | Required
 | patterns-openSUSE-file_server | package | Required
 | nfs-kernel-server | package | Recommended
 i | nfsidmap | package | Recommended
 i | samba | package | Recommended
 i | samba-client | package | Recommended
 i | samba-winbind | package | Recommended
 | tftp | package | Recommended
 | vsftpd | package | Recommended
 | yast2-ftp-server | package | Recommended
 | yast2-nfs-server | package | Recommended
 i | yast2-samba-server | package | Recommended
 | yast2-tftp-server | package | Recommended

如何在 Debian/Ubuntu 系統上列出可用的軟體包組

由於 APT 或 APT-GET 軟體包管理器沒有為基於 Debian/Ubuntu 的系統提供這樣的選項,因此需要使用 tasksel 命令來獲取相關信息。

tasksel 是 Debian/Ubuntu 系統上一個很方便的工具,只需要很少的操作就可以用它來安裝好一組軟體包。可以在 /usr/share/tasksel 目錄下的 .desc 文件中安排軟體包的安裝任務。

默認情況下,tasksel 工具是作為 Debian 系統的一部分安裝的,但桌面版 Ubuntu 則沒有自帶 tasksel,這個功能類似軟體包管理器中的元包(meta-packages)。

tasksel 工具帶有一個基於 zenity 的簡單用戶界面,例如命令行中的彈出圖形對話框。

推薦閱讀: 使用 tasksel 在 Debian/Ubuntu 系統上快速安裝軟體包組

# tasksel --list-task
u kubuntu-live Kubuntu live CD
u lubuntu-live-gtk Lubuntu live CD (GTK part)
u ubuntu-budgie-live Ubuntu Budgie 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 vanilla-gnome-live Ubuntu GNOME live CD
u xubuntu-live Xubuntu live CD
u cloud-image Ubuntu Cloud Image (instance)
u dns-server DNS server
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 lubuntu-gtk-core Lubuntu minimal installation (GTK part)
u lubuntu-gtk-desktop Lubuntu Desktop (GTK part)
u lubuntu-qt-core Lubuntu minimal installation (Qt part)
u lubuntu-qt-desktop Lubuntu Qt Desktop (Qt part)
u mail-server Mail server
u postgresql-server PostgreSQL database
i print-server Print server
u samba-server Samba file server
u tomcat-server Tomcat Java server
u ubuntu-budgie-desktop Ubuntu Budgie desktop
i ubuntu-desktop Ubuntu desktop
u ubuntu-mate-core Ubuntu MATE minimal
u ubuntu-mate-desktop Ubuntu MATE desktop
i 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-fonts 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 vanilla-gnome-desktop Vanilla GNOME desktop
u xubuntu-core Xubuntu minimal installation
u xubuntu-desktop Xubuntu desktop
u openssh-server OpenSSH server
u server Basic Ubuntu server

如果需要列出相關聯的軟體包,可以執行以下這個命令。下面的例子是列出和 「lamp-server」 組相關聯的軟體包。

# tasksel --task-desc "lamp-server"
Selects a ready-made Linux/Apache/MySQL/PHP server.

如何在基於 Arch Linux 的系統上列出可用的軟體包組

基於 Arch Linux 的系統使用的是 pacman 軟體包管理器,因此可以通過 pacman 軟體包管理器來獲取相關的信息。

pacman 是 「package manager」 的縮寫。pacman 可以用於安裝、構建、刪除和管理 Arch Linux 軟體包。pacman 使用 libalpm(Arch Linux Package Management 庫,ALPM)作為後端來執行所有操作。

推薦閱讀: 使用 pacman 在基於 Arch Linux 的系統上管理軟體包

# pacman -Sg
base-devel
base
multilib-devel
gnome-extra
kde-applications
kdepim
kdeutils
kdeedu
kf5
kdemultimedia
gnome
plasma
kdegames
kdesdk
kdebase
xfce4
fprint
kdegraphics
kdenetwork
kdeadmin
kf5-aids
kdewebdev
.
.
dlang-ldc
libretro
ring
lxqt
non-daw
non
alsa
qtcurve
realtime
sugar-fructose
tesseract-data
vim-plugins

如果需要列出相關聯的軟體包,可以執行以下這個命令。下面的例子是列出和 「gnome」 組相關聯的軟體包。

# pacman -Sg gnome
gnome baobab
gnome cheese
gnome eog
gnome epiphany
gnome evince
gnome file-roller
gnome gdm
gnome gedit
gnome gnome-backgrounds
gnome gnome-calculator
gnome gnome-calendar
gnome gnome-characters
gnome gnome-clocks
gnome gnome-color-manager
gnome gnome-contacts
gnome gnome-control-center
gnome gnome-dictionary
gnome gnome-disk-utility
gnome gnome-documents
gnome gnome-font-viewer
.
.
gnome sushi
gnome totem
gnome tracker
gnome tracker-miners
gnome vino
gnome xdg-user-dirs-gtk
gnome yelp
gnome gnome-boxes
gnome gnome-software
gnome simple-scan

也可以執行以下這個命令實現同樣的效果。

# pacman -S gnome
:: There are 64 members in group gnome:
:: Repository extra
 1) baobab 2) cheese 3) eog 4) epiphany 5) evince 6) file-roller 7) gdm 8) gedit 9) gnome-backgrounds 10) gnome-calculator 11) gnome-calendar 12) gnome-characters 13) gnome-clocks
 14) gnome-color-manager 15) gnome-contacts 16) gnome-control-center 17) gnome-dictionary 18) gnome-disk-utility 19) gnome-documents 20) gnome-font-viewer 21) gnome-getting-started-docs
 22) gnome-keyring 23) gnome-logs 24) gnome-maps 25) gnome-menus 26) gnome-music 27) gnome-photos 28) gnome-screenshot 29) gnome-session 30) gnome-settings-daemon 31) gnome-shell
 32) gnome-shell-extensions 33) gnome-system-monitor 34) gnome-terminal 35) gnome-themes-extra 36) gnome-todo 37) gnome-user-docs 38) gnome-user-share 39) gnome-video-effects 40) grilo-plugins
 41) gvfs 42) gvfs-afc 43) gvfs-goa 44) gvfs-google 45) gvfs-gphoto2 46) gvfs-mtp 47) gvfs-nfs 48) gvfs-smb 49) mousetweaks 50) mutter 51) nautilus 52) networkmanager 53) orca 54) rygel
 55) sushi 56) totem 57) tracker 58) tracker-miners 59) vino 60) xdg-user-dirs-gtk 61) yelp
:: Repository community
 62) gnome-boxes 63) gnome-software 64) simple-scan

Enter a selection (default=all): ^C
Interrupt signal received

可以執行以下命令檢查相關軟體包的數量。

# pacman -Sg gnome | wc -l
64

via: https://www.2daygeek.com/how-to-list-an-available-package-groups-in-linux/

作者:Prakash Subramanian 選題:lujun9972 譯者:HankChow 校對:wxy

本文由 LCTT 原創編譯,Linux中國 榮譽推出


本文轉載來自 Linux 中國: https://github.com/Linux-CN/archive

對這篇文章感覺如何?

太棒了
0
不錯
0
愛死了
0
不太好
0
感覺很糟
0
雨落清風。心向陽

    You may also like

    Leave a reply

    您的電子郵箱地址不會被公開。 必填項已用 * 標註

    此站點使用Akismet來減少垃圾評論。了解我們如何處理您的評論數據

    More in:Linux中國