Ubuntu on a Flash Drive
People in this course typically run PCs at home, which typically don't have an installation of Python, SSH, SFTP, or any of the other tools that we'll be using in this course. So how are you going to do your homework?
One solution is to install Linux on a flash drive, and boot your home machine from that drive. Use the drive to run a Terminal shell, to run Python, to ssh into the school server, to transfer files, etc. When you shut down Linux on the thumb drive, your home computer will still boot up into Windows. Best of all, you can use that same flash drive to transfer your files back and forth from school to your home machine.
Sounds ideal, doesn't it? You can get one of these USB sticks from the instructor, or you can make your own. Here's how:
What you'll need:
- A USB stick, minimum 2GB, but 4GB is better
- A blank CD
- A PC with an Internet connection and a CD burner
Prepare your Linux Mint CD and use it to start up Linux Mint
Linux Mint is a distribution ("distro") of Linux based on Ubuntu, one of the most popular distros of the Debian operating system, which in turn is based on the Linux kernel. If none of that makes any sense, the important points are a) it's free, and b) although it's not as user-friendly as your typical Mac or Windows operating system, it has an incredible amount of power.
Oh, and it's free.
- Using your PC, download the Linux Mint .iso image and burn it to the CD using your PC's disk burning utility.
- Restart your computer, booting from the Linux Mint CD that you've just burned.
Your computer may boot from the CD automatically when you restart the machine, or you may need to reset the BIOS—to do this, hit F2, or F12, or perhaps the Delete key as your machine is booting up. A BIOS screen will give you options for changing the boot order for your machine. Set your machine so that it looks to the CD-ROM drive first for booting.
Format the USB flash drive
- Launch a Terminal window from the "Menu" pop-up in the lower-left corner.
- Type into the Terminal window:
sudo gpartedWe're going to use the Graphical partition editor to split your 4GB drive into two partitions, one for Linux Mint, and one for Data.
- In the upper-right corner of the GParted window, select the flash drive from the drop-down menu. The flash drive will probably be named /dev/sdb. Confirm that this is the correct drive by looking at the approximate size of the drive: in my case, it was 3.76GiB for a 4GB drive.
- We're going to reformat the drive to USB 32, and split it up into two partitions, so you'll need to select Device > Create partition table... to wipe out what was there before. Make sure you don't have any data on the drive that you want to save—we're about to wipe it clean!—and confirm by clicking Create.
- Once the USB drive is wiped clean, the device will show up as "unallocated." You'll need to remove the drive from the machine now, then plug it back in for formatting.
- As before, select the device in the upper-right corner of the GParted window (/dev/sdb), click on the unallocated partition, and select Partion > New from the menu. In the "Create new Partition" window set the New Size of this first partition to 1024 MiB, and select a File System of fat32. Insert a Label "LinuxMint8" into the Label field—we'll be using this partition to store the Linux Mint operating system—and click the "Add" button. Then click on the green checkmark "Apply" button at the top of the GParted window, and confirm by clicking "Apply" again in the dialog box.
It'll take a few moments for the partition to be created. If it doesn't work, it may be that there's something wrong with the flash drive, or the drive might not been unmounted correctly. Try again!
- Once the first partition has been successfully created, we can partition the rest of the flash drive to store Data. Click on the remaining "unallocated" space on the drive, select "New partition...", choose fat32 for the File System, and give this partition the label "Data". Click "Add", then confirm by clicking the green checkmark "Apply", and then confirm again by clicking "Apply" again in the dialog box.
- Once the operation has completed successfully, close the window, and close the Gparted window.
- The partitions will have been unmounted in this process, so you can safely remove the USB flash drive from the machine.
Install Linux Mint onto the USB flash drive
- Put the USB flash drive back into the computer. There should be two partitions that are mounted now, one called LinuxMint8 and one called Data. Windows will open revealing the internal contents of these two partitions, but there's nothing there yet. We still need to install Linux Mint on that partition
- Type into the Terminal window:
sudo apt-get install usb-creatorConfirm the installation by typing "Y" in the Terminal window. This will install some software that will allow you to create a USB drive with Linux Mint on it.
- Once the installation process has halted and you have a prompt again, type into the Terminal window:
sudo usb-creator-gtkA "Make Startup Disk" window will appear.
- Select the Source disc image /dev/sr0, and select the Disk to use, which is actually the "LinuxMint8" partition of the flash drive. Also, under "When starting up from this disk, documents and settings will be:" select "Stored in reserved extra space", and drag the slider there all the way to the right. Then click on "Make Startup Disk".
- Go get a cup of coffee while the machine does its magic. When you get back, you should have a USB flash drive with a bootable Linux partition as well as a Data partition that you can use for carrying around other files.