Saturday, August 28, 2010

Install Ubuntu from a Linux partition

Its been far too long, so I thought I'd post something :)

Generally the prefered method of installing Ubuntu is via CD or (these days) from a USB stick.
But there is also another way if you already have an existing Linux partition around.

I'll list down the steps to installing Ubuntu from the hard disk itself without using any other external media.

To perform this installation I used the Maverick (ubuntu 10.10) pre-beta image from 27th Aug 2010. This has been tested with the alternate ISO. I have not tested this using the live ISO.

Step 1
Download the alternate ISO image from your local mirrors or use bittorent, or any other method.

Step 2
Download the vmlinuz and initrd.gz files from here:


In my case it is "maverick". Change the URL according to the version of ubuntu you want to install

Step 3
You need to place these two files (vmlinuz & initrd.gz) on the existing linux partition from which you plan to install ubuntu.
REMEMBER you cannot install ubuntu to the same partition from where the installer will run.

For example :
Location of installer (existing linux partition) : /dev/sda1
Location of the new installation : /dev/sda2

Create a temporary directory on /dev/sda1 as "/maverick" and place the two files in it.

Also place the alternate iso in the "/" directory of /dev/sda1
This allows the installer to pickup the iso image and read its contents.

Step 4
Now you need to edit GRUB.
In my case I had GRUB2 present on my system.
(You can use legacy GRUB as well for this but I have not tried it)

Add the following lines to the end of the file "/etc/grub.d/40-custom"

menuentry "Install Ubuntu" {
insmod ext2
set root=(hd0,1)
search --no-floppy --fs-uuid --set 8c4ec935-1a99-42c9-bbc9-c0400ba9d7fd
linux /maverick/vmlinuz vga=normal ramdisk_size=14972 root=/dev/rd/0 rw --
initrd /maverick/initrd.gz
}


Remember to change the UUID shown after "set" to the UUID of your partition.
Find that out by seeing the contents of /dev/disk/by-uuid

$ ls -lh /dev/disk/by-uuid

Also change your partition correspondingly if it is not /dev/sda1
Save and close the file.

Before the next step create a backup of your "/boot/grub/grub.cfg" file just in case !

Now run
$ sudo update-grub

The custom entry you just added should be appended to the end of your new /boot/grub/grub.cfg file. It should, of course, contain all your earlier entries too.

Step 5
Reboot and choose the "Install Ubuntu" option from the Grub2 menu.

This should start the installer and it should find your alternate iso image in the / directory as well.
From here on out just follow the steps as they come up in the installer. Even though the alternate installer is text-based, it is really not difficult to understand if you read each step clearly.

Just make sure you are extra careful when the paritioning steps come up and select the correct paritions to format. (As specified in my example, I formatted /dev/sda2 as ext4 and set it as my "/" partition for this new ubuntu installation)

Select the "Ubuntu desktop" option of the installer prompts you for a software selection. This should install the default Ubuntu GNOME desktop.


I made this blog post because I did not find any unified howto for this particular installation method.

I took bits and pieces from the following places:

Ubuntu Forums
Ubuntu Forums
Ubuntu Forums
Ubuntu Commmunity Help


3 comments:

  1. You made my day! Thank you so much for posting this! My really old ( > 10 years!) Toshiba Satellite 5100-603 is running Lucid right now - i've never thought that that would happen after several frustrating tries. The problem was, that my CD-Drive has broken about 5 years ago and even the latest BIOS available didn't support an USB-Boot option!

    The only thing that have been tricky right now was, that i just had one big partition sda1 and a small swap-partition of 1,5 GB. So i had to make a "swing-install" (as i call it ;-) ): First i've installed as described in your post a minimal-install on the swap-partition and afterwards from there i made after your description the full installation to the big partition.
    I'm so lucky right now!

    Greets

    Patrick

    ReplyDelete
  2. i am trying to install it with puppylinux as host but i cant find the 'disk' folder to find the uuid
    how do i change this fit grub1

    ReplyDelete

Follow this blog !!!