If you're not using a display manager, logging out of your window manager or typing Ctrl-Alt-Backspace will do it. If you are using a display manager, open an xterm as root and execute "telinit S". You'll be dropped down to single user mode, where you can compile the nvidia driver. When you're done, "telinit 4" will restart the display manager.