What is the easiest way to strip a desktop edition to a server edition?

It's possible to do it the other way around, but I've never seen anyone who was able to do this simply by installing a metapackage or something.

Your best bet is either:

  • a clean install
  • manually removing unneeded packages and installing the server components you need

You can remove ubuntu-desktop and simultaneously auto-remove all its orphaned dependants:

sudo apt-get autoremove ubuntu-desktop

Add the --purge option if you also want to remove the configuration of the affected packages (and not keep it for possible later reinstallation).

If you have any other Desktop remove them as well. if you reboot after this you should have no GUI to log into. If you purge a program rather than just removing it you also remove any config files that may remain.

As Rinzwind suggests try sudo apt-get remove gnome-*.

Before Ubuntu 16.04 it also provides a special kernel package for server installations, linux-image-server:

  • sudo apt-get install linux-image-server and reboot.

Then I suggest you install the server applications you want, like ssh-server.


But as always it's better to make a clean install. It gives less risk of errors and broken packages.


Note: as stated in comments, tasksel should only be used to install tasks, not remove them. In this specific task (remove desktop -> install server) it seems to work fine. So use it with caution.


You can try tasksel. With it, you can do what you want by selecting Basic Ubuntu Server and unchecking Ubuntu desktop.

sudo apt-get install tasksel

tasksel screen

Tags:

Server