24

I have a VPS that has Ubuntu 11.10 on it. Unfortunately, only the 11.10 Desktop (not server) image was available as an image to install your VPS with. How can I remove the packages included in the Desktop install, and, if needed, install the packages that only the server install has?

I've tried sudo apt-get remove ubuntu-desktop and then sudo apt-get autoremove. Unfortunately, that didn't work: it only removed 'libjudy-debian' (or something like that) which was installed from having 'miredo' installed at one point.

Azendale
  • 11,891

3 Answers3

41

To remove x11 and everything that uses it, including all configuration:

apt-get purge libx11.* libqt.*

Unlike the accepted answer (remove xserver-xorg-core) this one will also remove all desktop packages like Firefox etc.

bain
  • 11,260
  • Will this remove xserver as the accepted answer? Or does that remove need to be done as well? – IanVaughan Feb 04 '15 at 23:17
  • 3
    Yes it will be removed. Do apt-get --assume-no remove libx11.* libqt.* to see all of the packages that will be removed. – bain Feb 06 '15 at 13:23
  • yes, i'm doing this now, it removes quite a lot more than the accepted answer and it's all things you don't want there anyway. http://pastebin.com/mQK1MYCH – parsecpython Dec 21 '15 at 15:09
  • apt autoremove will also remove a ton of "unneeded" packages after the purge operation – andrei Dec 01 '18 at 18:26
  • This worked in my case, but in my virtual setup ( KVM ) I am not getting console view after this, but able to ssh – Arun Aug 18 '21 at 11:31
21

Right autoremove only removes packages that were installed automatically as part of other package installs. The things installed in the image are seeded and so all are basically considered "manual".

You'll probably get rid of most of them by getting rid of Xorg:

sudo apt-get remove xserver-xorg-core

And then do another autoremove.

There will likely be other things that are left around that you don't need.. but .. really.. why not just ask your VPS provider for a server image.. isn't it a little silly that they even offer the desktop image?

SpamapS
  • 19,820
4
sudo apt-get purge -y libx11.* libqt.* libgtk.
sudo apt-get autoremove -y
vochicong
  • 41
  • 3
  • 2
    A code only answer is not high quality. It would be better to explain what this does, how this is better than other answers. You should also link to any references you used to write this answer. – Stephen Ostermiller May 16 '19 at 11:44