Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

We have installed Ubuntu desktop edition on our development server. Now that we have it in a data center we would like to strip it down to a server edition.

Is there an easy way of doing so rather than just going in and uninstalling packages by hand?

share|improve this question
    
Re-installing is best: the server CD has kernel params set that the desktop is lacking (you can get them ofcourse with the desktop too but it is more work then a re-install ;)) –  Rinzwind May 5 '12 at 20:23
    
Also, one should remove x11 cruft too afterwards with sudo apt-get remove x11* –  Rob K Jul 30 '12 at 10:53

3 Answers 3

up vote 12 down vote accepted

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
share|improve this answer
1  
A clean install is the way to go, but if you want to manually remove packages, run dpkg --get-selections "*" >~/applications.txt and delete what you know you don't need. –  tinker Jul 29 '10 at 1:48

You can start with removing ubuntu-desktop.

  • sudo apt-get purge ubuntu-desktop
  • sudo apt-get autoremove will remove the rest

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-*.

Ubuntu 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.

share|improve this answer
1  
Well I removed ubuntu-desktop, but it did nothing, since no packages depends on it. I then removed all the packages that ubuntu-desktop depends on, which works better, but it still leaves a bit of a mess with packages like unity-common, gedit-common, etc. –  Bart van Heukelom May 5 '12 at 19:00
    
@BartvanHeukelom well, did you purge it or just remove it? edited the question. –  Alvar May 5 '12 at 20:25
1  
iirc sudo apt-get remove gnome-* would take care of most packages. Unity should be removed alongside this (cuz of dependencies). (needs confirmation though since I tend to not do this) –  Rinzwind May 5 '12 at 20:27
    
I removed it (accidentally), didn't purge, but AFAIK that shouldn't matter regarding dependencies. –  Bart van Heukelom May 7 '12 at 8:49
    
@BartVanHeukelom did you try Rinzwind's command? sudo apt-get remove gnome-*? –  Alvar May 7 '12 at 9:19

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

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.

tasksel screen

share|improve this answer
1  
+1 for the image ;) –  Rinzwind May 5 '12 at 20:43
    
Can you or someone else confirm this works? You say try, but if it does work this is a great answer. –  djeikyb May 29 '12 at 20:01
    
Excerpt from Ubuntu Tasksel page: WARNING: Use tasksel only to install tasks, never to remove any! According to launchpad.net/bugs/574287 it will remove each package in the list of that task (and possibly render your system unusable). –  Andrejs Cainikovs May 29 '12 at 20:12
    
As per above, I don't recommend you to use tasksel in your case. –  Andrejs Cainikovs May 29 '12 at 20:13
1  
@djeikyb i tried this with ubuntu 9.10 and ubuntu 11.10, and both work (wubi install, remove desktop and installing "server packages"). In 11.10 there's a small glitch: the system boots but dont shows you the login prompt. –  Salem May 30 '12 at 10:27

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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