Warning: This answer is outdated. As of writing this warning (6.10.2013) the kernel-ppa used here is no longer updated. Please disregard this answer.

Small note: Installing anything but the official standard kernel for your system is not recommended. It might be unstable or buggy. Now to the topic:

This adds the daily build of ubuntu kernel (not mainline):

sudo apt-add-repository ppa:kernel-ppa/ppa
sudo apt-get update
sudo apt-get install PACKAGENAME

You can do the same with Software Center or Synaptic using the menu item "Repositories". From there you'll need to click through some self explanatory stuff.

You might be interested in this answer.


You cannot . you can install like this .

Installing Mainline Kernels

To use the mainline kernel as-is you only only need to download and install the image.deb package that corresponds to your architecture, however if you need to build any external modules you also need the correct header.deb and source.deb packages.

To install, download the common headers, architecture specific headers, and the architecture specific image. For example for 2.6.27.15 we have the following files, for i386 you would need those marked with B and C, amd64 take those marked A & C:

A       linux-headers-2.6.27-02062715-generic_2.6.27-02062715_amd64.deb
B       linux-headers-2.6.27-02062715-generic_2.6.27-02062715_i386.deb
C       linux-headers-2.6.27-02062715_2.6.27-02062715_all.deb
A       linux-image-2.6.27-02062715-generic_2.6.27-02062715_amd64.deb
B       linux-image-2.6.27-02062715-generic_2.6.27-02062715_i386.deb

Once you have those downloaded they will need to be installed using dpkg:

sudo dpkg -i *.deb

Source


Since the kernel ppa is not really maintained anymore, here's a semi-automatic script:

https://github.com/medigeek/kmp-downloader

https://askubuntu.com/a/177586/5538