Disable GUI in Ubuntu 18.04. desktop? (SSH/Webmin headless setup)

17,133

Solution 1

For Ubuntu 18.04, the following will work without additional modifications.

systemctl set-default multi-user.target

How to disable GDM from being automatically started?

Solution 2

Yes, your desktop is started from a systemd webservice. Disable it and you can still manually start it. systemctl list-units --type service --all will list all services. For me it lists "gdm.service".

This should show the status of your session:

systemctl status gdm.service

This disables it:

systemctl disable gdm.service

And this enables it again:

systemctl enable gdm.service

Replace it with kde if you use kUbutu. Or by any of the other desktop you use.

You might need to kill the current active desktop too.

If you intend to use this system as a server you can also delete the desktop itself with sudo apt purge ubuntu-desktop. Be careful: do this while you have a ssh connection so you can still issue commands; locking yourself out of the system might be fatal.

Share:
17,133

Related videos on Youtube

TOM
Author by

TOM

Updated on September 18, 2022

Comments

  • TOM
    TOM over 1 year

    Is there a way to disable the GUI in the desktop version of Ubuntu 18.04. so save on power consumption during idle states?

    Since I won't have a monitor hooked up to the machine anyway, I'd rather manage Ubuntu through an SSH connection or Webmin.

    • Organic Marble
      Organic Marble about 6 years
      Is there a reason you don't just install the server version?
    • TOM
      TOM about 6 years
      Yes, I'm trying to run Ubuntu on an Intel Apollo Lake-based system, which have problems with the default GRUB bootloader. I'm pretty much only able to boot the specially made ISO from Linuxium.
  • TOM
    TOM about 6 years
    When I delete the desktop, do I have to install the server components afterwards? Or is it enough to just install opensshserver? Will the underlying system still be able to run software like the Plex media server for example?
  • Josh Desmond
    Josh Desmond about 4 years
    How do you undo this command once you run it? What does set-default actually do?