CAOS- Assignment 0 –part 1
We need to download, modify , compile and install a kernel on Ubuntu server
14.10.
Download VMware Workstation and Ubuntu server 14.10.iso image
and mount the downloaded image file to install Ubuntu server
After setting up the server, first of all we need to update the source links to enable the
use of " apt-get" because v14.10 contains outdated links which creates errors
To update the links . you need to become a superuser . After entering superuser mode
enter
cd /etc/apt
chmod -R 777 sources.list
nano sources.list
In this file replace all instances of "in.archive" and "security" by "old-releases" and then
"ctrl+o" and "enter" to save. What this does is that it enables “apt” command to get links to
install packages essential to this assignment otherwise it produces error.
Now enter the commands
sudo apt-get update
sudo apt-get upgrade
“update” and “upgrade” downloads essential packages which 14.10 version Ubuntu
server doesn’t already have
Now we will install some package and modules which are essential to the process of
kernel compilation
enter the command
sudo apt-get install build-essential kernel-package libncurses5-dev fakeroot flex libssl-dev
This will take some time depending on the internet speed. It will install most of the
import and libraries and packages necessary
Now we will download the kernel source v3.16 using the command
apt-get source linux-image-$(uname -r)
“uname -r” gets the old kernel version and this commands download this which in this
case is v3.16
After installing is done type "ls" to view the download files
Now type " cd linux-3.16.0" to enter the linux directory
Now we will enter a command to copy the original kernel config file to the new kernel
cp /boot/config-`uname -r` ./.config
What this command does is it copies the configuration file of the old kernel and paste it
into the new kernel version file
yes ' ' | make oldconfig
This command configures the file by asking questions. “yes ‘ ‘ “ selects yes for every
question automatically so we don’t have enter it manually everytime.
To append the kernel with a customized string enter
make menuconfig
This command opens the kernel configuration file
Go to "General Setup"-->"default hostname" and change it to nandesh
Save and exit
After exiting out of the kernel menu enter the command " make clean " to clean the
directory and to compile enter
make -j `getconf _NPROCESSORS_ONLN` deb-pkg LOCALVERSION=-nandesh
“make” compiles the kernel “getconf_NPROCESSORS_ONLN” selects how mant
processors to use to compile the file and typing anything after “-“ append it to kernel version
string
It will take a lot a time depending upon the processor speed of the machine
After compilation has finished three(or four ) deb files will be installed
cd ..
ls *.deb
Now we will install deb packages using "dpkg"
sudo dpkg -i linux*3.16.7*.deb
This command install the deb files automatically so we don’t have to write the whole
name of the files
After completion we need to update grub
sudo update-grub
This command updates the grub so it boots up the newly install kernel version
Now reboot the system
sudo reboot
Now at the gub menu select ubuntu which will be our modified kernel ubuntu
Now to check the kernel version and the appended string enter
uname -a
We can see the kernel version is the updates one from 3.16.0 --> 3.16.7 and it contains
the appended string "nandesh"