How to compile linux kernel in Debian / Ubuntu the Easy Way
- Category : Linux Helpline (Easy Guide)
- Posted on : Mar 30, 2019
- Views : 1,890
- By : Icarus M.
Sometimes you may need to compile for enabling a specific module in Linux. It is easy to compile and update the linux kernel to latest stable version for your computer or server. At the time of writing of this article the latest stable version of linux kernel is 3.12. So in this article , I show you how to compile the latest kernel in debian.
First of all you need to download and install a set of building tools that required to compile the linux kernel in your desktop.
1 . In stall all the build essentials for your compilation process,
apt-get update
apt-get install kernel-package libncurses5-dev fakeroot wget bzip2 build-essential
2. Download the latest stable kernel form https://www.kernel.org/ and extract it
cd /usr/src wget -c https://www.kernel.org/pub/linux/kernel/v3.x/linux-3.12.tar.xz tar -xJf linux-3.12.tar.xz cd linux-3.12
3.The easy way of configuring the kernel
Before compiling the kernel we have to configure the option. That means we have to enable all required modules using the command “make menuconfig ” . This article title says , it is an easy way. So let us copy the older configuration if your current kernel into the “.config” file which is the configuration file for kernel build
root@myhome:/usr/src/linux-3.12# cp -v /boot/config-`uname -r` ./.config
4. Adding your extra kernel modules
Now run the following command and load this .config file form the “load” table
make menuconfig
After loading the .config file old option , you can add or remove any additional kernel modules as you wish
5. Now build the kernel package
you may need to use the following commands from your debian shell
# make-kpkg clean # fakeroot make-kpkg -j4 --initrd --append-to-version=-new kernel_image kernel_headers
The option “-j4” will multi thread your compilation process between 4 cpu cores and increase the compilation time . Also the option –append-to-version=-new add a tag “new” to the kernel . The kernel compilation will take 3o to 45 minutes depend on the options you selected in the make menuconfig .
6. After Finishing the compil
You may look into the directory /usr/src for seeing two debian packages named like as follows,
linux-headers-3.12.0-new_3.12.0-new-10.00.Custom_amd64.deb linux-image-3.12.0-new_3.12.0-new-10.00.Custom_amd64.deb
Install these packages as follows,
dpkg -i linux-headers-3.12.0-new_3.12.0-new-10.00.Custom_amd64.deb dpkg -i linux-image-3.12.0-new_3.12.0-new-10.00.Custom_amd64.deb
7. Updating the grub
You may now update the grub configuration using the following command
# update-grub
If you like to change the boot options please make sure to edit it in /etc/default/grub and update the grub after that. In debian and ubuntu this toll will automatically propagate the grub configuration. If you are compiling it in a remote server, please make sure to set automatic PANIC options and reboot options in grub for a crash recovery too. After that reboot into new kernel.
Categories
- cPanel Question 47
- cPanel Software Management 29
- cPanel Tutorials 13
- Development 29
- Domain 13
- General 19
- Linux Helpline (Easy Guide) 156
- Marketing 47
- MySQL Question 13
- News 2
- PHP Configuration 14
- SEO 4
- SEO 42
- Server Administration 84
- SSL Installation 54
- Tips and Tricks 24
- VPS 3
- Web Hosting 44
- Website Security 22
- WHM questions 13
- WordPress 148
Subscribe Now
10,000 successful online businessmen like to have our content directly delivered to their inbox. Subscribe to our newsletter!Archive Calendar
Sat | Sun | Mon | Tue | Wed | Thu | Fri |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 | 29 |
30 |
Recent Articles
-
Posted on : Sep 17
-
Posted on : Sep 10
-
Posted on : Aug 04
-
Posted on : Apr 01
Tags
- ts
- myisam
- vpn
- sql
- process
- kill
- tweak
- server load
- attack
- ddos mitigation
- Knowledge
- layer 7
- ddos
- webmail
- DMARC
- Development
- nginx
- seo vpn
- Hosting Security
- wireguard
- innodb
- exim
- smtp relay
- smtp
- VPS Hosting
- cpulimit
- Plesk
- Comparison
- cpu
- encryption
- WHM
- xampp
- sysstat
- optimize
- cheap vpn
- php-fpm
- mariadb
- apache
- Small Business
- Error
- Networking
- VPS
- SSD Hosting
- Link Building
- centos
- DNS
- optimization
- ubuntu