伺服器通常以文字模式運行,但某些場景(如圖形化安裝工具、遠端桌面)需要 GUI。本文說明 CentOS 7/8 使用 yum groupinstall 安裝、移除 GNOME、KDE 或最小 X Window 的指令與注意事項。
yum groupinstall "X Window System" -y
yum groupinstall "GNOME Desktop" -y
# CentOS 7 群組名為 "GNOME Desktop Environment"
# CentOS 8/Stream 群組名為 "GNOME Desktop" 或 "Server with GUI"
yum groupinstall "KDE Plasma Workspaces" -y
# CentOS 7 群組名為 "KDE (K Desktop Environment)"
systemctl set-default graphical.target
# 切回文字模式
systemctl set-default multi-user.target
startx
# 或
systemctl isolate graphical.target
yum groupremove "GNOME Desktop" -y
yum groupremove "KDE Plasma Workspaces" -y
yum groupremove "X Window System" -y
# 清理孤立套件
yum autoremove -y
yum grouplist 確認確切名稱;或啟用 EPEL、PowerTools 倉庫。xorg-x11-drv-* 顯卡驅動,或嘗試 yum install xorg-x11-server-Xorg。tigervnc-server、xrdp 並開放防火牆 5900/3389。yum install @core @base xorg-x11-server-Xorg xorg-x11-xauth xterm 手動構建極簡 GUI。| 環境 | 記憶體佔用(空閒) | 磁碟空間 |
|---|---|---|
| 最小文字模式 | ~100 MB | ~2 GB |
| X Window Only | ~200 MB | +300 MB |
| GNOME | ~600 MB | +1.5 GB |
| KDE | ~700 MB | +2 GB |
按需安裝,避免浪費伺服器資源。