Sunday, August 30, 2009

How to install kernel headers to build modules against the Xen kernel - Amazon EC2

If you are using a Ubuntu/Debian AMI, and need to install kernel headers to build modules: apt-get would not work almost all of the time. You would probably end up with doing something like following,
root@domU-XX-XX-XX-XX-XX-E1:~$ apt-get install linux-headers-`uname -r`
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Couldn't find package linux-headers-
I used the following method to get Kernel headers and compile a VMWare 2 instance. This method will always work,
alien -k --scripts kernel-xen-devel-
dpkg -i kernel-xen-devel_2.6.21.7-2.fc8_i386.deb
ln -s /usr/src/kernels/ /lib/modules/
ln -s /usr/src/kernels/ /usr/src/linux
Make sure to include symbolic links to .configure to work properly.