What you need to do is boot the LiveCD and chroot into the Ubuntu system on the USB drive, then install grub2
First thing to do is identify what the device name of the Live file system is. In most cases this will be /dev/sdb, if there is only one other drive in the system, but it could be something else depending the configuration of your hardware.
A little more complicated is to identify which partition Ubuntu lives on. This will depend on exactly how you installed Ubuntu so it's best to check and be sure. Once you've booted the LiveCD use either Disk Manager or Gparted to look at the hard drive and identify the Ubuntu root (/) partition that you set up. You would be looking for an ext4 partition of the correct size.
For the purposes of these instructions I'm going to assume the correct device (drive) is /dev/sdb and that the partition is /dev/sdb3. You should substitute the correct device names as appropriate.
Firstly, in a terminal window mount the Ubuntu root partition:
sudo mount /dev/sdb3 /mnt
Next, export the LiveCD filesystem to the root filesystem on the drive:
sudo mount ‐‐bind /dev /mnt/dev
sudo mount ‐‐bind /proc /mnt/proc
sudo mount ‐‐bind /sys /mnt/sys
Now change the root filesystem to the hard disk:
sudo chroot /mnt
Now install grub2 to /dev/sdb
sudo grub-install /dev/sdb
At this point, while grub2 is installed it might not know about all the filesystems available, such as a windows partition on the hard drive or another Linux partition on either drive.
To fix this run update-grub:
sudo update-grub
and it will find all OS's on your system and add them to the grub menu. You should now be able to boot off the external drive and select the Ubuntu partition or any others to boot from
I note that there is no mention of a swap partition in your configuration. This is not likely to be a problem if there is plenty of RAM in your system and you never want to hibernate the computer. You will still be able to suspend the computer but this does continue to use a small amount of power.
The correct way to do this at the time of installation is to specify the correct hard drive to install the grub bootloader to. This might require selecting the manual configuration instead of the default one, then selecting the correct drive to install grub to. It's also possible to install grub to the internal hard drive and have it configured to boot Ubuntu off the external USB drive.
Best Answer
A very detailed answer would be beyond the scope of a single question, but here's the general outline. It's very easy, but success will partly depend on the ability of your computer to boot from an external hard drive. This depends on the bios.
Before starting, make sure your bios has an option to boot from a USB HD.
If all you need is the basic install, Python 2.7, and the C compiler, you can get away with installing Ubuntu to a fairly small partition. I forget the literal minimum Ubuntu needs to install, but it's roughly 8 GB. I would recommend 10 GB as a minimum, plus another 2-4 GB if you want a swap drive.
Create space for a partition
It's best in your case to create the new partition before doing the install. You will need to shrink the existing partition on your external hard drive first.
I would recommend backing up the USB HD; but if you had a second one, you could just install to that one. Depending on how full the drive is, you may not be able to back it completely; but try at least back up any important files. This is just a general warning and precaution since your data should be safe.
You have two options to shrink the existing partition:
Use the Windows partition manager in administrative tools. I believe these are available in Home Premium. If the partition won't shrink by enough, you may need to delete files to make room. If you have more than enough available but it still doesn't shrink enough, use a free defrag tool like MyDefrag to defrag and move the files to the start of the partition.
Use
gparted
from the Ubuntu live install media. This is probably the easier way to do it.Create a new partition
Create the Ubuntu live installation media and use it to boot your computer. Choose Try Ubuntu.
Plug in the external hard drive. Start the program
gparted
. If you have not already shrunk the partition on the external HD, do it now.In most cases, the internal HD will show up as
sda
and the external assdb
, but this is not guaranteed. Be sure you are looking at the correct HD in gparted.Shrinking the partition will leave unallocated space. Use this to create a new partition. Format it to
ext4
. Jot down the partition number. This will be used for/
.You don't need a swap partition, but if want one, shrink the new partition by the size you want (or just make it a little smaller in the first place). Format that space to
linux-swap
.Note down the numbers of the new partitions.
Run the Installer
Start the installer from the icon on the desktop or on the launcher. When asked how you want to install, choose: Somethine Else.
This will start the partitioner within the installer. This is different than
gparted
and may look a little intimidating to a beginner.Carefully highlight the new partition (check the number and drive carefully) and click Change.
Follow the dialogs to a. Use the partition as
ext4
, b. mount to/
, and c. format.Highlight the swap partition and click Change. Choose use a
linux-swap
and that's all for that one.Very important: change the installation of the bootloader to the USB HD. This will most likely be
/dev/sdb
. This will prevent you from overwriting the master boot record on your hard drive. (If you do this by accident, it's easily fixed).Double-check your partition choices, then click Install Now.
That's it. To run Ubuntu, boot the computer with the USB plugged in. Set your bios order or otherwise move USB HD to the first boot position. The boot menu on the usb will show you both Ubuntu (on the external drive) and Windows (on the internal drive). Choose the one you want. If you boot without the usb, you will boot into Windows normally.
Ubuntu has Python 2.7 installed by default. To install the C comiler, open the terminal, any run:
or
(if you want some additional programs helpful for C programming).
To run Ubuntu in a virtual machine instead, install VirtualBox or VMWarePlayer in Windows. Both are free. Create a new VM and use the installer media to install to the VM. But this time, don't worry about partitions. Choose Install Ubuntu to the entire virtual drive. This doesn't affect the rest of the hard drive.
If you want to put the VM on the external hd, be sure to override the default location when creating the VM and put it on a folder on the external drive.
Creating your installation media with persistence through a Windows program like LiveUSBCreator will also work, but this option will be very slow.