Wednesday, 9 September 2009

Installing Linux from an ISO image file

If you are fed up of burning DVDs or Live CDs and want to install your favorite Linux OS straight from the image file which you have just downloaded, you can do it. This is one of the great options of installing Linux to your system.
All you need is:
1. A partition of EXT2/EXT3 or FAT32.
2. An ISO installable image of any Linux Distro.
I am going to give a tutorial for Fedora Distro. For others you can refer to the Table which I have provided below.
First step is to create a directory under root directory "/"
mkdir /fedora mkdir -p /fedora/images
Copy the downloaded image file to /fedora directory.
cp /home/user/Fedora-11-i386-DVD.iso /fedora
Now all you have to do is to copy 3 of the files from this image file. You can either extract this image file and copy both the files or you can mount this file and then copy these 3 files to the /fedora directory.
The three files which are needed to copy are "vmlinuz" "initrd.img" and "image/install.img"
I will go for the mount option, just because it wont take any extra space.
mount -o loop /fedora/Fedora-11-i386-DVD.iso /media/iso
Note you have to create a directory called /media/iso before executing the above command.
Now enter into this directory:
cd /media/iso/isolinux
Copy the files:
cp vmlinuz initrd.img /fedora cp images/install.img /fedora/images
That's all for the setup. Now you have to edit the grub which is responsible to boot image files.
vi /boot/grub/menu.lst
or
vi /boot/grub/grub.conf
Append the following into the file:
title Install Fedora 11 kernel /fedora/vmlinuz initrd /fedora/initrd.img
The title is the title which you want to display in the GRUB menu.
The ‘root’ is the hard disk partition that contains the ISO image.
The ‘kernel’ is the Linux kernel, which we copied into /fedora directory.
The ‘initrd’ is the initial RAM disk image,  which gets into the RAM.
Now you are ready to install your new Linux distro directly from the hard disk without the need for a CD/DVD drive. Reboot your system and select the ‘Install Fedora 11’ entry from your GRUB menu.
Follow the onscreen instruction and you are ready with a new distro without any hassle to burn DVDs.
Table 1: Names of kernel and RAM disk images in some popular distros
Distro Kernel path RAM disk path
Fedora/RHEL/CentOS /isolinux/vmlinuz /isolinux/initrd.img
openSUSE /boot/i386/loader/linux /boot/i386/loader/initrd
Mandriva /i586/isolinux/alt0/vmlinuz /i586/isolinux/alt0/all.rdz
Ubuntu /casper/vmlinuz /casper/initrd.gz
Debian /install.386/vmlinuz /isolinux/initrd.img
blog comments powered by Disqus