How do I remove all desktop-related packages, leaving server only?

20,162

Solution 1

To remove x11 and everything that uses it:

apt-get purge libx11.* libqt.*

Solution 2

You can use Tasksel It is a a tool that install/removes packages as per the type of system you require.

https://help.ubuntu.com/community/Tasksel

Share:
20,162

Related videos on Youtube

Victor Sergienko
Author by

Victor Sergienko

Updated on September 18, 2022

Comments

  • Victor Sergienko
    Victor Sergienko almost 2 years

    I've got a VPS server, on which I surprisingly find packages like bluez or thunderbird-gnome-support or firefox or libqt4.

    Do I have to list all the packages like in "How to delete all desktop environments except Unity?"?

  • Benoit
    Benoit about 10 years
    Take care with this and review the dependent packages that will be removed carefully because even on server installation, some program may need X11 libraries. I think mainly to image manipulation toolkit like ImageMagick used by many Web Gallery sites. Also, this REGEX will remove not only libx11 related libraries but also libxml libraries that may definetly needed on a server. So for me apt-get purge libx11* would a better proposal.
  • bain
    bain about 10 years
    tasksel -t remove ubuntu-desktop shows that it does not remove Firefox, xorg, etc.
  • bain
    bain about 10 years
    Yes you can also do it from the command line with sudo tasksel remove ubuntu-desktop. But if you do dpkg -l libx11-6 or dpkg -l firefox afterwards you will see that those packages are still installed, so tasksel is not removing all of the desktop packages.
  • StallionSA
    StallionSA about 10 years
    To get from ubuntu 14.04 desktop to server I ran sudo tasksel then select from the available options Basic Ubuntu Server I unselected the Ubuntu Desktop then tab to ok. It removed all of my std desktop and only installed/left me with a server installation. I have not used the tasksel -t remove before only the terminal gui. I think that you are left with xorg etc.. as removing the ubuntu destop and not selecting the server option does not remove the x-windows system leaving only server cli. x-windows system requires xorg and firefox can be run from the x-windows system.
  • bain
    bain about 10 years
    I just tested this, selecting Basic Ubuntu Server and deselecting Ubuntu desktop exactly as you described, and it did not remove firefox or the x11 libraries.