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
Source