Roll your own kernel
PRO's and Con's
There are both advantages and disadvantages to compiling your own Linux kernel. This is an attempt at siding the pro's and con's, as we see them
PRO
- It's fun! (no, really!)
- Better performance than a stock Debian kernel, because of system specific optimizations
- Better hardware support, because we can use a newer kernel with newer drivers
- Extra features, because we can use a newer kernel with those newer features
CON
- No automatic security system à la APT: if there's a security issue in the kernel that you're using, you'll have to find out about it, and then compile a new kernel. As con's go, this is a pretty big one, we reckon. Still, we run our own kernels...
- You'll need to delve into hardware specific things, expressed in obscure kernel-hacking terms (what's "sparse memory support" for, anyway?)
- Like everything, this takes time to master, and time to implement. Time spent on kernel compiling tasks (be it learning or executing) cannot be spent on other tasks
Prerequisites
To compile your own kernel, you'll need some software. First up, you'll need to install the following packages, using "apt-get install <package>" or aptitude. This is the list of packages we advise you to install (if they're not installed already):
sudo bzip2 ftp make libncurses5-dev (plus all its dependencies, including the gcc GNU C Compiler)
Now it's time to get that kernel. To get it on a base server, there are many ways; we'll outline two of them.
Putting a kernel source on your server using WinSCP
This is pretty easy, although it requires the following things
- First up, you'll need to have the SSH server installed (which we presuppose anyway)
- Next, you'll need a computer on your network running Microsoft Windows, on which you need to install WinSCP.
- After installing WinSCP, you start it up, fill in the host name or IP number of your server, your user name (as it exists on the Debian server, and which must have rights to use the SSH server), and click "save" (we advise you never to save your password in WinSCP for security reasons).
- After saving the SSH account, you can find it under "stored sessions"; select it and click "login". A login window should appear, and you're asked for your password. After providing that, you're presented with a GUI, that allows you to copy and move files from and to the server. While you can theoretically save to and read from any location on the server, restrictions apply that have to do with the rights of the ordinary user that you are, so for simplicity we assume you'll put files in your home directory (e.g. /home/saruman), and then from a shell on the server move the files to the proper location.
- Now, you download the kernel source from the famous kernel.org. From a European location, the latest v2.6 kernel source can be found in here. Download the newest file that is named "linux-2.6.xxxxxx.tar.bz2" (like linux-2.6.25.4.tar.bz2), or alternatively, the same file in .gz instead of .bz2. The bz2 files are compressed slightly better, but uncompressing it requires the bzip2 program, which is not available on every Unix platform - fortunately it is on Debian.
- Use WinSCP to upload the kernel source file to your home directory on the server
Getting the kernel source on your server straight from the 'Net
- Log in to your server using your user account
- use ftp ftp.eu.kernel.org to connect to the kernel website; use username "anonymous" and password "whatever" (when you use username anonymous, the password doesn't get checked).
- if you type the command "lcd" the program should respond with "/home/<yourname>", which is your home directory on your server
- if you type the command "pwd" the program should respond with "/", to indicate you're at the root folder of the kernel.org FTP server
- if you type the command "cd pub/linux/kernel/v2.6" the program should respond with "250 Directory successfully changed.". Type pwd to check.
- dir lets you see the contents of the remote directory, and dir linux-2.6.2*.bz2 limits the listing to managable sizes
- get linux-2.6.25.4.tar.bz2 will copy the indicated kernel source file to your home directory; the ftp client will end the transfer with a message like "226 File send OK."
- now you can exit the ftp client with exit
Extracting the kernel source
- Log on to the server using your user account, either onto the console, or on an SSH shell (e.g. using PuTTy on a Windows client)
- Move the kernel source file from your home directory to the directory /usr/src, change the owner of the file to root:root, and unpack the file using bzip2 (or gzip if you've downloaded the .tar.gz file):
sudo mv linux-2.6.25.4.tar.bz2 /usr/src cd /usr/src