How to compile linux kernel from source.

Here’s a quick how-to for those of you who would like to test kernels that are yet to be released on your particular distro. These instructions assume you run a Debian-based box, like Debian, Ubuntu, Linux Mint, Knoppix, Mepis etc.

1. Make sure you have ‘gcc’ and ‘libncurses5-dev’ installed

sudo apt-get install gcc
sudo apt-get install libncurses5-dev
sudo apt-get update && sudo apt-get upgrade


2. Download your choice of kernel from In this case I ‘m using linux-3.3-rc7 (a ‘release candidate’, i.e just about bug-free for public release = safe πŸ™‚ )


3. Extract the files to /usr/src directory. Assuming you’ve downloaded the compressed file to /home/username/Downloads, then

cd ~/Downloads/
sudo tar -xvf linux-3.3-rc7.tar.bz2 -C /usr/src/
cd /usr/src/linux-3.3-rc7

4. Create and save kernel configuration menu. Leave the options “as-is”, unless you know what you are doing (not me), and in that case, you wouldn’t be reading these instructions from a Linux-n00b’s blog anyway… One thing though, make sure that under “filesystems”, ext4 is selected (should be by default).

sudo make menuconfig

5. Compile the kernel. Wait. It’ll take a while… If you have an old and weak box, it’ll take some more.

sudo make

6. Install the new kernel

sudo make modules_install install

7. Reboot, then verify you indeed have the new kernel running

uname -r

8. Report bugs to πŸ™‚


And no, I didn’t come up with this, the original post can be found atΒ HowOpenSource.



Geek? Yes _X_ No ___ Techie? Yes _X_ No ___ Smart? Yes ___ No _X_


Leave a Reply

Your email address will not be published. Required fields are marked *