Run sudo ubuntu-drivers devices to find what drivers are available, and then use apt to install the driver. In my case, it is apt install nvidia-driver-390. Reboot after installation completes, and use nvidia-smi command to ensure the driver is loaded.
Use Anaconda to simplify the process of installing tensorflow and related packages. Install it with wget https://repo.anaconda.com/archive/Anaconda3-5.3.0-Linux-x86_64.sh and then execute it.