Unable to install cuda 10.0 on Ubuntu 18.04 on EC2 AWS

I have downloaded Nvidia GPU drivers from Official Drivers | NVIDIA for CUDA 10.0

First I chose “Linux”. However, when installing I was getting errors like:
nvidia graphic driver error: “NV_BUILD_MODULE_INSTANCES” is not defined

which didn’t allow me to advance. I saw that it could be due a kernel incompatibility, and therefore I downloaded specifically the 18.04 LTS Ubuntu version, which is my OS. This allowed me to install the GPU driver. However, after rebooting (both sudo reboot and reboot instance), if I do nvidia-smi I get:

NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running

I checked if the service was running, but if I do:

sudo systemctl status nvidia-persistenced

I get an error something like:
start request repeated too quickly

At this step I tried directly to install CUDA and let’s see. I downloaded the toolkit for 10.0 and run it (Is there any way to skip all these lines apart from pressing enter for a long time?). This toolkit had a different Nvidia graphic card driver, so I let it to unninstall the previous one and install the new one. Just after starting it crashes. (I tried again removing the previous installation using drivers - NVIDIA-SMI couldn't find libnvidia-ml.so library and nothing in /usr/lib/nvidia - Ask Ubuntu). First, it doesn’t recognize the headers, even I give to them and the folder exists. I executed it as:

sudo sh cuda_10.0.130_410_48.run --kernel-source-path /usr/src/linux-headers-$(uname -r)

Second, again NV_BUILD_MODULE_INSTANCES error.

I have been trying it for 4 h, and I don’t know what to do else.

PS. I’m using g4dn.xlarge, which operates a T4

You must have kernel 4.15 in Ubuntu. After installing the kernel:

sudo apt-get install linux-generic


Well… cuda is instaled, but nvidia-smi says there’s no gpu…