How to turn a desktop Linux box headless
Solution 1:
You want to change the default runlevel, on ubuntu the way to do that is in the grub configuration.
Plagiarizing heavily from this askubuntu answer (go on, upvote it...):
For Ubuntu 11.10 and higher
Edit /etc/default/grub with your favorite editor,
sudo nano /etc/default/grub
Find out this line:
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
Change it to:
GRUB_CMDLINE_LINUX_DEFAULT="text"
Update Grub:
sudo update-grub
Solution 2:
the grub configuration did nothing for me on lubuntu. The os simply launched itself with the usual graphical login screen.
On a hunch I pulled out the keyboard,mouse and display monitor cables from my desktop backplane. And waited for a fresh boot.
I had earlier configured my laptop to connect to the box through ssh.
In a short while the machine booted up and then I was able to connect to it over ssh.
I plugged in the monitor, the keyboard and mouse to the desktop to check what would happen. apparently the mouse has power because its led is glowing red. The keyboard does nothing. The monitor remains blank.
So to make my lubuntu headless all I need to do is to just pull out the peripherals. That is all.
I had used the monitor to make some initial configurations right after installation. including the installation of an ssh server. and fixing some minor problems otherwise.
I am running lubuntu 18.04 on a cheap locally assembled desktop with an intel core 2 duo 8400 cpu. and 2 gb ram.