Ok, this Ubuntu disto was originally installed as Ubuntu Server 12.04. Along the line, someone thought it was a good idea to install ubuntu-desktop. It has since been upgraded to 14.04 LTS and remains Ubuntu Desktop.

I don't want to have any of the desktop packages any longer and would like to revert it back to just Ubuntu server. I have searched high and low, but I can't seem to find anything definitive for this process for 14.04LTS.

I have found removing the ubuntu-desktop package, but as I've learned this doesn't even remotely remove everything related to the desktop version. Unity, Gnome, Firefox, etc etc.

Could someone please fill me in on the proper way to COMPLETELY remove all of the desktop environment and all of its associated packages for 14.04? Thank you


1 Answer 1


you can use the following instructions it worked for previous releases (but you should take a backup so you can revert everything at any time )


Turn Ubuntu desktop into an headless server


This is one way to turn a Ubuntu desktop install into a headless server. A headless server is a server without a graphical desktop, and GUI-based apps. A common example of a headless server is a LAMP server, aka Linux Apache Mysql PHP/Python. All of these commands must be run as root, do not do this if you do not need to run a server.

Remove packages for graphics

% apt-get remove --purge libx11-6

Remove large package

This might be useful to further shrink the server and remove large and unused software. You can easily discover large packages with:

% dpkg-query -W --showformat='${Installed-Size} ${Package} [depends: ${Depends}]\n' | sort -n

Remove orphaned package

% apt-get install deborphan
% deborphan
% deborphan --guess-all

Repeat this until no more packages are deleted:

% apt-get remove --purge `deborphan`
% apt-get remove --purge `deborphan --guess-all`
% apt-get autoremove --purge

Remove unused kernel headers and images

The list of large packages above returned many unused linux-headers-* and linux-image-*. This command will make sure that you DO NOT remove the packages for the kernel currently in use. To avoid disasters, I put this into 2 separate steps. Please check the output of this command first:

% dpkg -l 'linux-headers*' 'linux-image*' | sed '/^ii/!d;/'"$(uname -r | sed "s/\(.*\)-\([^0-9]\+\)/\1/")"'/d;s/^[^ ]* [^ ]* \([^ ]*\).*/\1/;/[0-9]/!d'

If the output is OK (different than what you get with uname -r), rerun the last command and send it to apt-get purge:

% (last cmd) | xargs apt-get -y purge

Autoremove and clean

% apt-get autoremove --purge
% apt-get clean


Not the answer you're looking for? Browse other questions tagged or ask your own question.