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-2.6.21.7-2.fc8xen
root@domU-XX-XX-XX-XX-XX-E1:~$
I used the following method to get Kernel headers and compile a VMWare 2 instance. This method will always work,
wget http://kojipkgs.fedoraproject.org/packages/kernel-xen-2.6/2.6.21.7/2.fc8/i686/kernel-xen-devel-2.6.21.7-2.fc8.i686.rpm
alien -k --scripts kernel-xen-devel-2.6.21.7-2.fc8.i686.rpm
dpkg -i kernel-xen-devel_2.6.21.7-2.fc8_i386.deb
ln -s /usr/src/kernels/2.6.21.7-2.fc8-xen-i686 /lib/modules/
2.6.21.7-2.fc8xen/build
ln -s /usr/src/kernels/2.6.21.7-2.fc8-xen-i686 /usr/src/linux
Make sure to include symbolic links to .configure to work properly.

2 comments:

Adrian Penișoară said...

You should rather try to use the Ubuntu EC2 PPA repository.

Joe Carlson said...

Wonderful, just what a blog it is! This blog has provided the helpful data to us continue the good work.
branding firms