by June 7, 2004 0 comments



There can be times when you need more than one Linux distro on the same machine, like when you’re developing an application and want to make sure that it’s compatible across all the distros. This article will talk about how to set up multiple Linux distros on one machine. In order to do that, it’s important to first understand how Linux does partitioning. A Linux system has three types of partitions, namely:

/boot The boot partition for kernel and initrd images, which boots the PC and loads the kernel.

/- The root partition where files and other applications are installed.

Swap For disk caching. This should be double the size of RAM.

Direct
Hit!
Applies to: Developers wanting to test or develop code on multiple Linux distros
USP: Multiple Linux distros installed using one grub.conf file
Links: www.kerneltrap.org

We in this article will first install PCQLinux 2004 and then RedHat Enterprise 3.0 Edition distro on the same machine. The machine used should be without any OS. We will only install PCQLinux 2004 boot loader. The idea here is that we will configure PCQLinux 2004 grub. conf file and then modify the same grub.file for RedHat Enterprise distro. The reverse can also be done. 

Installing PCQLinux 2004 

  • Start PCQLinux 2004 installation. You will be given a list of installation types. Select the installation type you want. We selected Personal Desktop.
  • Now you need to partition the hard disk. There are two options for this: Automatic Partition and Manual Partition. Select the Automatically Partition option to partition the hard disk. Then, click on Next.
  • This will show three options for partitioning the hard disk. Select ‘Remove all partitions on this system’ option.
  • After this, you have to configure the partition table. As discussed above, three partitions have to be created. First, create the boot partition and don’t change the default size for this partition, which would be around 100 MB. Then create the root partition and allocate space according to your hard disk size. Finally, create the swap partition with the default size
    for it. 
  • Click on Next, which will ask for installing boot loader. Install PCQLinux 2004 boot loader, which is grub. Follow the steps till installation is complete.
  • Now PCQLinux 2004 is installed. Open the terminal screen and run the command fdisk –l. You will see the partition information as shown in the box below. It shows on which device the three partitions are installed. 

The boot partition is installed in /dev/hdc1, root partition in /dev/hdc2 and swap in /dev/hdc3.

Installing RedHat Enterprise 3.0 

  • Start RedHat Enterprise 3.0 edition installation. 
  • Follow the first four steps as above to install the three partitions in the remaining free space.
  • Clicking on Next will give the option of installing the RedHat Enterprise 3.0 boot loader. Here, you should not install the RedHat Enterprise 3.0 boot loader. Click on ‘change boot loader’ option and then select ‘don’t install boot
    loader’. Follow the instructions to complete the installation.

Now, you have both the distros installed. But, you need to configure the PCQLinux 2004
grub.file.

Configuring PCQLinux 2004 grub.conf file
Boot PCQLinux 2004 system and run the command fdisk –l. The partition information for both the distros will be as shown as in the box below. The important thing here is that all the three partitions should be installed for both the
distros.

Partition
info: PCQLinux 2004
Device Boot Start End Blocks Id System
/dev/hdc1 * 1 13 104391 83 Linux
/dev/hdc2   14 842 6658942+ 83 Linux
/dev/hdc3   843 874 257040 82 Linux
swap

Thus, an extended partition is created (/dev/hdc4), and in this the three partitions of RedHat Enterprise 3.0 distro are installed. The boot partition is installed in /dev/ hdc5, root partition in /dev/ hdc6 and swap partition in /dev/ hdc7. 

Now you need to know the kernel version and initrd version for RedHat Enterprise 3.0 distro. For this, you have to mount the boot partition which is installed in /dev/hdc5. Run the following commands.

mount /dev/hdc5 /test
cd test
cd boot
ls

Note the kernel and initrd version for RedHat Enterprise 3.0 distro, which are vmlinuz-2.4.21-4.EL and
initrd-2.4.21-4.EL.img respectively. 

Now you need to configure the PCQLinux 2004 grub.conf file. In this file, add the partition details of the RedHat Enterprise 3.0. For this add the following four lines in PCQLinux 2004 grub.conf file and save it.

  • title RED HAT ENTERPRISE LINUX
  • root (hd0,4)
  • kernel /vmlinuz-2.4.21-4.EL ro root=/dev/hdc6
  • initrd /initrd-2.4.21-4.EL.img

The boot partition of RedHat Enterprise is in /dev/hdc5, so you have to write root (hd0,4) and the root partition is in /dev/hdc6, hence root=/dev/hdc6. Add the kernel version and initrd version you noted above. 

Partition
info: PCQLInux 2004 and RedHat Enterprise 3.0

Device

Boot Start End Blocks Id System
/dev/hdc1 * 1 13 104391 83 Linux
/dev/hdc2   14 842 6658942+ 83 Linux
/dev/hdc3   843 874 257040 82 Linux
swap
/dev/hdc4   875 1826 7646940 5 Extended
/dev/hdc5   875 887 104391 83 Linux
/dev/hdc6   888 1809 7405933+ 83 Linux
/dev/hdc7   1810 1826 136521 82 Linux
swap

Now, save the grub.conf file and reboot the system. After this you will be able to boot both the Linux
distros.

The trick is that you configure only one grub.conf file for the distro that is to be installed. This grub.conf file should, however, have the details of the three partitions of all the Linux distros you install. 

Sushil Oswal

No Comments so far

Jump into a conversation

No Comments Yet!

You can be the one to start a conversation.

Your data will be safe!Your e-mail address will not be published. Also other data will not be shared with third person.