How can I deactivate the gnome desktop of my ubuntu server?
I'm running a home server on my old laptop (atom cpu).
I installed ubuntu 12.04 server edition, but I also installed ubuntu-desktop. So, when I turn it on, ubuntu desktop is shown.
I sometimes use GUI, but I want to turn the ubuntu-desktop (gnome-desktop) off when I don't use it.
I think I can save resources by turning off the GUI. It's necessary since my laptop's performance is not very good and it often becomes very hot.
I guess I can run ubuntu-desktop on my terminal with "startx" command. But, I don't know how to turn the X window off for a moment.
Anybody have an idea?
Thanks in advance.
--- Following is written after I chose the answer.
$ sudo stop lightdm
lightdm stop/waitingwith this command, I can turn off the x window. But, I can't get tty1 on my laptop.
I put that command from outside with ssh connection.
And, I can turn the x window on outside.
X: user not authorized to run the X server, aborting.
xinit: server errorBut, I can get it back with start lightdm command.
$ sudo start lightdm
lightdm start/running, process 5673I'm not sure this is good or not.
And I don't know I can save my resources when I stop lightdm.
14 Answers
To control the X environment, use sudo service gdm stop and sudo service gdm start once the system has booted up. To make permanent changes, you need to update the runlevel at which ubuntu auto-starts gdm (Gnome Desktop Manager), and set it to not start on boot up. You should be able to run these commands from an SSH shell remotely.
I've tried other options with newer version of Ubuntu (Ubuntu 18.04.1 LTS) and they didn't work. What did the trick for me was the following command:
systemctl set-default multi-user.targetReboot and it will show only the console.
You can revert it running:
systemctl set-default graphical.targetAnd reboot again.
3I'm currently not at my Ubuntu machine, but am writing "AFAIR":
check the /etc/init directory, where you should find a file named gdm.conf (which is used to handle the gdm service). If that's there (i.e. I remember it correctly), just type the following in a shell:
sudo echo "manual">/etc/init/gdm.override
sudo service gdm stopNow you've stopped the gdm (Gnome Display Manager) and thus X -- after you told Upstart this service should be handled manually. So it will no longer start automatically; but if you need it, you can simply issue an sudo service gdm start to bring it up again.
Disable
gdmat boot:sudo dpkg-divert --rename --add /etc/init/gdm.confAuthorize users to start
X:echo "allowed_users=console" | sudo tee -a /etc/X11/Xwrapper.configAutomatically start
Xafter login ontty1:In your
.profileor.bash_profile, add:if [ -z "$DISPLAY" ] && [ $(tty) = /dev/tty1 ]; then startx fiLogging in other
ttywill not startgdmorX.
See also this question on serverfault.