This question already has an answer here:
I've installed Ubuntu Server. I'd like to add the GUI with ubuntu-desktop package, but if I do that can I still get the no-gui server interface as the default? What I basically need is the no-gui and the ability to start a gui when needed. Possible?