Linux

如何完全(已安裝所有軟體包)刪除或禁用 tasksel 桌面環境?

  • June 20, 2013

我在 debian 安裝時不小心安裝了桌面環境。現在我正在嘗試刪除它但沒有機會:tasksel remove desktop僅更改iuif tasksel --list-tasks

sudo apt-get remove task-desktop也不起作用:根本沒有輸出。

我什至看不到任務桌麵包中有什麼作為元包。

我只想獲得一個伺服器 debian,而不是桌面。

我會做什麼,按優先順序:

  1. 使用 PXE + 重新啟動並重新安裝我的伺服器preseed。這樣,您就有了一種可重複的安裝方法,而不會出現容易出錯的人為乾預。設置它所花費的時間在您第二次使用它時得到了回報。
  2. 如果重新安裝不可行:

一種。我會嘗試找出任務選擇安裝了哪些軟體包,首先列出可用的選擇:

$ tasksel --list-tasks
u desktop       Debian desktop environment
u web-server    Web server
u print-server  Print server
u database-server       SQL database
u dns-server    DNS Server
u file-server   File server
u mail-server   Mail server
u ssh-server    SSH server
u laptop        Laptop

灣。接下來列出具體的選擇:

$ tasksel --task-packages desktop
task-desktop

C。顯示包元數據以找出其依賴項:

$ aptitude show task-desktop
Package: task-desktop
State: not installed
Version: 3.16
Priority: optional
Section: tasks
Maintainer: Debian Install System Team <debian-boot@lists.debian.org>
Architecture: all
Uncompressed Size: 21.5 k
Depends: tasksel, xorg, xserver-xorg-video-all, xserver-xorg-input-all, desktop-base, menu
Recommends: task-gnome-desktop | task-kde-desktop | task-lxde-desktop | task-xfce-desktop, xdg-utils, avahi-daemon, libnss-mdns, anacron, libgl1-mesa-dri, eject, iw, alsa-utils, alsa-base, pm-utils
Description: Debian desktop environment
This task package is used to install the Debian desktop.

d。您可以對每個依賴項重複最後一步,或使用其他工具直接查找該資訊:

$ apt-cache depends task-desktop
task-desktop
 Depends: tasksel
 Depends: xorg
 Depends: xserver-xorg-video-all
 Depends: xserver-xorg-input-all
 Depends: desktop-base
 Depends: menu
|Recommends: task-gnome-desktop
|Recommends: task-kde-desktop
|Recommends: task-lxde-desktop
 Recommends: task-xfce-desktop
 Recommends: xdg-utils
 Recommends: avahi-daemon
 Recommends: libnss-mdns
 Recommends: anacron
 Recommends: libgl1-mesa-dri
 Recommends: eject
 Recommends: iw
 Recommends: alsa-utils
 Recommends: alsa-base
 Recommends: pm-utils

e. 有列出正向和反向依賴項的工具,以及輸出過濾選項:

$ apt-rdepends -r task-desktop --state-follow=Installed
Reading package lists... Done
Building dependency tree
Reading state information... Done
task-desktop
 Reverse Depends: task-gnome-desktop (3.16)
 Reverse Depends: task-kde-desktop (3.16)
 Reverse Depends: task-lxde-desktop (3.16)
 Reverse Depends: task-xfce-desktop (3.16)

$ apt-rdepends task-desktop --state-follow=Installed
Reading package lists... Done
Building dependency tree
Reading state information... Done
task-desktop
 Depends: desktop-base
 Depends: menu
 Depends: tasksel
 Depends: xorg
 Depends: xserver-xorg-input-all
 Depends: xserver-xorg-video-all
menu
 Depends: dpkg (>= 1.15.4)
 Depends: install-info
 Depends: libc6 (>= 2.2.5)
 Depends: libgcc1 (>= 1:4.1.1)
 Depends: libstdc++6 (>= 4.6)
dpkg
 PreDepends: libbz2-1.0
 PreDepends: libc6 (>= 2.11)
 PreDepends: liblzma5 (>= 5.1.1alpha+20120614)
 PreDepends: libselinux1 (>= 1.32)
 PreDepends: tar (>= 1.23)
 PreDepends: zlib1g (>= 1:1.1.4)

F。此時,您可以開始解除安裝東西,使用諸如orphaner確保您沒有留下任何東西之類的工具,或者開始以更好的眼光看待選項 1。

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