If you are wishing to compile kernel modules or other software you may be required to install the kernel headers on your Cloud Server. By default the kernel modules are not installed to save space and are not typically used by most software.
This tutorial will walk you through installing them on a Cloud Server. This tutorial assumes you logged in as the root user. Note that this tutorial has been tested on Ubuntu and CentOS-based distributions -- others have not been tested and may vary slightly.
The first thing we will need to do is download the header files from Ubuntu, where our kernel originates from. To do that, run the following commands:
$ cd / $ wget http://mirrors.kernel.org/ubuntu/pool/main/l/linux-ec2/linux-headers-2.6.31-302-ec2_2.6.31-302.7_amd64.deb $ wget http://mirrors.kernel.org/ubuntu/pool/main/l/linux-ec2/linux-headers-2.6.31-302_2.6.31-302.7_all.deb
Note that the file names are a bit long so you will need to copy and paste them. Be sure that you are located in the root of the filesystem by running the cd / command!
Now we need to use a program called ar to unpack the Debian .deb files in CentOS. Run the following commands to unpack the files and perform cleanup functions:
$ ar x linux-headers-2.6.31-302-ec2_2.6.31-302.7_amd64.deb data.tar.gz; tar -zxvf data.tar.gz; rm -f data.tar.gz $ ar x linux-headers-2.6.31-302_2.6.31-302.7_all.deb data.tar.gz; tar -zxvf data.tar.gz; rm -f data.tar.gz
Note once again that these commands are a bit long so you may need to copy and paste them.
Now we need to perform the final step of symbolically linking our newly unpacked headers to the correct directory. To do this simply run the following commands:
$ cd /usr/src $ ln -s linux-headers-2.6.31-302-ec2 linux
You can verify that it worked by typing ls and you should see something similar to the following:
linux -> linux-headers-2.6.31-302-ec2
Now you are ready to compile your software!
© 2011-2013 Rackspace US, Inc.
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported License