I am trying to install a NVidia Cuda driver on a Amazon EC2. GPU instance (Amazon Linux AMI (HVM) 2013.09.2 - ami-e9a18d80) following the instructions laid out in a blog. It worked for the last two weeks, but today it fails.

The instructions state

sudo yum -y groupinstall "Development Tools"
sudo yum -y install git libcurl-devel python-devel screen rsync yasm numpy openssl-devel
wget http://developer.download.nvidia.com/compute/cuda/5_5/rel/installers/cuda_5.5.22_linux_64.run
sudo sh cuda_5.5.22_linux_64.run

The error is

Installing the NVIDIA display driver... The driver installation is unable to locate the kernel source. Please make sure that the kernel source packages are installed and set up correctly. If you know that the kernel source packages are installed and set up correctly, you may pass the location of the kernel source with the '--kernel-source-path' flag.

There is a comment in the instructions on how to possibly fix it, but I do not understand the commands. I can't seem to navigate to the paths specified. If someone could explain it to me like I am 5, I think it would be helpful.

For people having trouble with installing CUDA (fails with some complaint about the kernel source), here's the fix I found… The kernel source in /usr/src/kernels wasn't the same version as the kernel I was running (which you can find with uname -r). I went into /boot/grub/menu.lst and made sure that the only enabled kernel version was the one I had the source for.

3 Answers 3


First install dkms:

sudo apt-get install dkms

Then do the Cuda installation, e.g.

sudo sh cuda_8.0.61_375.26_linux.run

You simply need to snatch your kernel-source tree (and make sure the build is identical to your bootable kernel.)

So, yum -y install kernel-devel kernel-headers

uname -r will also tell you the specific kernel build, important to make sure it matches the devel packages!


As Adam answered, you need to install the kernel-devel and kernel-headers packages. To make sure the version you installed is the right one for your system, especially when you are offline, add the release version string of your target system to the package name:

release=$(uname -r)
yum install kernel-devel-$release kernel-headers-$release

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .