如何彻底(安装所有软件包)删除或禁用 taskel 桌面环境?

如何彻底(安装所有软件包)删除或禁用 taskel 桌面环境?

我在安装 Debian 时意外安装了桌面环境。现在我试图删除它,但没有成功:tasksel remove desktop仅更改iuif tasksel --list-tasks

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

我甚至看不到 task-desktop 包里面有什么元包。

我只想获得一个 Debian 服务器,而不是桌面。

答案1

我会按照优先顺序做什么:

  1. 使用 PXE + 重新启动并重新安装我的服务器preseed。这样,您就有了一种可重复的安装方法,无需容易出错的人为干预。花在设置上的时间在您第二次使用它时会得到回报。

  2. 如果无法重新安装:

    a. 我将尝试找出任务选择安装了哪些软件包,首先列出可用的选择:

    $ 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
    

    b. 接下来列出具体选择:

    $ 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 <[email protected]>
    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。

相关内容