Ubuntu – How to set up Ubuntu Server 16.04 to load a GUI on demand

16.04grub2guilightdmstartup

I would like my server to boot to command line by default but load a GUI when I need one.

I have a virtual machine set up just for testing and I got the standard UNITY GUI installed on it no problem. I also modified the /etc/default/grub file to boot to text mode. It wasn't working at first and would still boot to the GUI by default but after some research I found that disabling lightdm got me back to the normal terminal login. My issue is I can not launch back into the full GUI anymore. I can use the command 'startx' to launch into a pretty much featureless GUI but that doesn't really help me.

Best Answer

Run systemctl start lightdm to start lightdm, and by extension, the rest of the gui, when you desire. systemctl stop lightdm will shut it down.