In the case of Ubuntu 16.04. I can download the NVIDIA driver run file and then ctrl+alt+F1 and then do the below
sudo service lightdm stop
sudo ./NVIDIA-Linux-x86_64-390.48.run
I follow on screen instructions to install and reboot and everything works.
Now I am trying to do the same thing on Ubuntu 18.04. I read that Ubuntu 18.04 switched to gdm so I tried
sudo service gdm stop
sudo gdm stop
None of them worked, after some searching I realized it could be gdm3 instead but I tried
sudo service gdm3 stop
sudo gdm3 stop
Still none of them worked, and of course sudo service lightdm stop
doesn't work. When I tried to install the driver it kept telling me the x-server is still on so can't start the installation process.
What is the right way to stop gdm in Ubuntu 18.04?