How to install Ubuntu Linux from USB Stick

Sponsored Link
This tutorial describes how to install Ubuntu by copying the contents of the installation CD to an USB memory stick (aka flash drive) and making the stick bootable. This is handy for machines like ultra portable notebooks that do not have a CD drive but can boot from USB media.

In short here's what you do:

Prepare the USB flash drive

Boot the computer from your USB flash drive.

Install Ubuntu as you would from a normal boot CD

Prerequisites

A running Ubuntu 8.04 or any ubuntu version installation

A USB device (stick, pen-drive, USB hard disk) that has already been formatted with FAT32 and has enough free space to hold your Ubuntu installation image

A Ubuntu CD image downloaded from the Ubuntu servers or mirrors (*.iso file) or from here
Step 1

On the root directory of your USB device, create a folder “install”
Copy the installer kernel and the initramdisk into this folder (Download source below.You need the files “vmlinux” and “initrd.gz”).

Download source for the installer kernel and initramdisk

For AMD64 Download from here
For i386 Download from here

You need to download the files “vmlinux” and “initrd.gz”.

Step 2

Note: You need to have the installer that fits the architecture of your Ubuntu version you want to install. In other words, you need a amd64 installer if you want to install an amd64 Ubuntu .iso image and the i386 installer for an i386 iso.

Step 3

From the installation iso image you downloaded, copy the folder “isolinux” to the root directory of your USB device (right-click on the .iso file, choose “extract here”). Rename “isolinux” into “syslinux”. Go inside the directroy “syslinux”. There, rename the file “isolinux.cfg” into “syslinux.cfg”.

Step 4

Make the stick bootable: Use fdisk to set the boot flag,

Install syslinux using the following command

sudo aptitude install syslinux

Now use syslinux to install a boot sector on your USB device

sudo syslinux /dev/sdbX

where sdbX is the device name and number of your USB device, check with “sudo mount”. A file called “ldlinux.sys” will be created in the root direcotry of the USB device.

Step 5

Copy the Ubuntu CD image in the root directory of your USB device (Contents of USB you can see as follows).If you are using i386 you need to copy the complete .iso image in to the root directory of your USB device.

You may also like...

109 Responses

  1. Necrofenser says:

    Can i use this tutorial to install Ubuntu Studio? Is this compatibile with Ubuntu Studio installation? Please help me! I cannot install any OS on my comp since my Windows XP cannot detect my DVD-ROM. If someone want to help me, contact me on my email: [email protected]

  2. Paul Mcgurren says:

    Hi. I have installed Isadora on 8gb USB drive. I’m a newbee and getting to like this OS. Problem is I will soon be running out of space and would like to transfer all my data and downloads to my hard drive permanently. Can I make my memory stick installable. Appreciate any help. Paul.

  3. Frank Cox says:

    I did everything exactly as the tutorial said. The Idilinux file was created , everything. When I tried to boot the drive it said no OS.
    I set the boot flag with gparted, any ideas?

  4. Bdgus says:

    ===How to create a Live USB with personal files easily and safely usable by Ubuntu, Windows XP, …===

    I’ll do it with this example:

    32-bit computer (desktop -or laptop-, not netbook)
    USB flash drive of 4 GB
    Persistence option desired (casper-rw file will exist for that)
    Personal files will take up more than half of the memory or space

    1. Download the required ISO file: http://www.ubuntu.com/desktop/get-ubuntu/download (and choose and click) or ftp://swtsrv.informatik.uni-mannheim…sktop-i386.iso (or from other country ….)
    2. Plug the USB flash drive
    3. Copy the files you want to keep to another drive
    4. Hold Alt key and press F2 . Type gnome-terminal and press Enter
    5. Type sudo bash and press Enter. Enter your password
    6. Type ls /dev/disk/by-id/*usb* -l and press Enter . At the end of the first line there should be something like sdb or sdc or sdd … In my case sdb
    7. Type fdisk -l and press Enter . After /dev/sdb I see /dev/sdb1 (there is only 1 partition; no divisions in my USB flash drive)
    8. Type umount /dev/sdb1 and press Enter
    9. Type fdisk /dev/sdb and press Enter
    10. Type m and press Enter to see the options
    11. Type p and press Enter to see the partitions (in my case /dev/sdb1 )
    12. Type d and press Enter (fdisk selects the only partition I have)
    13. Type p and press Enter (now there is no partition so no /dev/sdb1 is shown)
    14. Type n and press Enter then p and Enter then 1 (number of partition) and Enter then Enter (to use the default beginning: 1) then 600 (something more than the half) and Enter
    15. Type p and press Enter. I see /dev/sdb1 with Id of 83 (Linux file system)
    16. We want change it to FAT32: Type l and press Enter . We see that c is our option (W95 FAT32 (LBA) file system)
    17. We change it: Type t and press Enter (it selects the only partition up to now). Type c and press Enter
    18. Type p and press Enter . We see Id of c (W95 FAT32 (LBA) file system)
    19. Type n and press Enter then p and Enter then 2 and Enter then Enter (to use the default: just after first partition) then Enter (to use the default: all the free space, to the end)
    20. Type p and press Enter . We see also /dev/sdb2 . With Id of 83
    21. Type t and press Enter then 2 and Enter then c and Enter
    22. Type p and press Enter . We see Id of c bor both
    23. Type w and press Enter. Changes are written on disk
    24. Type fdisk -l and press Enter . Now we see the 2 partitions.
    25. Now we format the first one: type mkfs.vfat /dev/sdb1 and press Enter
    26. Now we format the second one: type mkfs.vfat /dev/sdb2 and press Enter
    27. Close the terminal or console
    28. Hold Alt key and press F2 . Type gnome-control-center and press Enter
    29. Click on USB Startup Disk Creator (under Hardware)
    30. Click on the button named Other.. (up-right) and choose and open the downloaded ISO file
    31. Under Disk to use click on /dev/sdb2
    32. Down, select Stored in reserved extra space
    33. Move the How much button almost to the limit. In my case the limit is 876.0 MB but I put it in 851.0 (just in case I need to modify some file of booting, …)
    34. Click on the button Make Startup Disk
    35. When it finishes click on Exit

    FINISHED !!!

    Now if we open the terminal and we use fdisk -l we see that there is a * for Boot in /dev/sdb2 . So the second partition is bootable (where Ubuntu GNU/Linux, the operating system, is located)

    To see this working reboot the computer and press the key stated by the BIOS to go to the boot menu (F12, F11, …, then use the arrows to select the USB flash drive and then press Enter). If no boot menu, go to the BIOS main menu (with F2 or Del …), then to boot options ….

    The first time in the middle of the boot we have to choose the language and click on Try Ubuntu v 10.04.1 LTS

    If we click on Places menu and then on 2.4 GB Filesystem the first partition is mounted and the Nautilus File Browser opens there. We can copy, create, delete, edit, open … our personal files: songs, photos, videos, documents …

    If the USB flash drive is inserted in a PC running old operating systems like Windows XP we still can use our personal files, and easily and safely !!

    ENJOY !!!

    NB: If you only have 1 FAT32 (usual in USB flash drives) partition in your Live USB and make casper-rw not to take up all the free space of the Ubuntu files you can also use the remaining space for your personal files, both from the Ubuntu of the Live USB, from an installed (in a hard drive) Ubuntu, Windows XP, … But they are mixed with the OS files (there is risk to delete them) and if you boot from the Live USB the personal files have to be in a not-easy-to-reach place of the file system and you have to be root to manage them …. (if I remember well)

    NB2: The proposed method separates the files of the operating system from the personal data. This way they are better organized and safer: for example Windows XP can only access to the personal files’ partition.

  5. Andrei says:

    Why not simply do this:

    dd if=image.iso of=/dev/sdb1

    where /dev/sdb1 – is unmounted usb device.

    Works juts fine

  6. Anand says:

    The windows xp os in my nebook had got corrupted and i want to install ubuntu via pen drive.Can amy one tell me the instructions how to install ubuntu in the net book.

  7. nai says:

    i dont understand how to do the 4th step. please teach me how.

  8. karthik says:

    ldlinux.sys is not getting created for me

  9. Mark says:

    I also don’t understand the 4th step. After skipping part 1 of step 4 I tried “sudo aptitude install syslinux” in the terminal and I got this “sudo: aptitude: command not found”, I’m a linux noob so a REAL step by step would be helful.

  10. Techblang says:

    Now how to redirect the console messages to serial for headless install? I have a built-in VGA but cannot connect a monitor, How to do the 10.04 Server intall thru TTY/null modem OR via SSH?

    Need it.

  11. Drey says:

    Hi.
    Followed instructions to install ubuntu 10.04, but failed after boot from usb. I got “boot:” promt after booting, that doesn’t booted usual “live” or “ubuntu” and after 50s (i think) timeout it disappeared and I see just rain from whit symbols on black background.
    Every keyboard hit calls beep and nothing else. Only ctrl+alt+del works. What I’m done wrong?

  12. Kirk says:

    Interesting that the instructions to create a bootable ubuntu install usb stick requires a running ubuntu (or equiv) system to create it from.

    Reminds me of back when VHS tape recorders first came out and Sony shipped the instructions on how to set one up on a VHS tape.

    I think something a little more basic is required here.

  13. Anon says:

    It’s just for ubuntu.
    You can create such a USB for various other distributions simply by using tools like SARDU or XBoot.

  14. Jim Rees says:

    I’ve been using this method for the last three years. Thank you for figuring this out.

    But it’s stopped working with the latest oneiric. I’m getting Debootstrap Error “failed to determine the codename for the release.” You can get this error if the script can’t loop mount the iso image, but that’s not the case for me. It’s mounting fine, but something else is failing in the post-base-install.

    The official method (https://help.ubuntu.com/community/Installation/FromUSBStick) is to use grub4dos, which I’d rather not do because I’ve got a bunch of stuff on one usb stick and everything else uses syslinux.

    I’ll keep poking at it but wonder if you have any suggestions.

  15. Ben says:

    I believe Canonical has instructions for creating a bootable USB stick on the Ubuntu.com site. Look around. I know they’re there.

    Also, Sony probably included the instructions on VHS because Sony is dumb and holds business grudges. Sony actually isn’t the creator of the VHS standard. JVC set that. Sony’s potential cassette standard was a much higher quality Beta tape. You couldn’t get nearly as much run time, but the cassettes were smaller and supported higher resolution and generally better clarity on screen than VHS tapes. VHS became the standard because JVC’s and VHS-supporting companies’ systems were lower cost than Beta systems (especially those by Sony). So my theory is that Sony didn’t care to think past their failure to set a standard and decided to use the medium you weren’t yet able to access to instruct a way to access the medium. Kinda like how there are previews of Blu-Ray content, HD content, and 3D content all over standard definition TV stations these days. Haha.

    – Ben

  16. Dave says:

    Type ‘help’
    This will raise the menu.
    Pressing enter again will execute the default install.

    However I get stuck soon after…
    “No common CD-ROM was drive detected”

    Have been hitting a wall for hours now!

  17. Quinn says:

    On Step 4 whenever I type “sudo syslinux /dev/sda1” it gives me the error message of “syslinux: this doesn’t look like a valid FAT filesystem.” Any ideas?

  18. diah says:

    I have tried to install ubuntu from USB stick. It means that the USB stick always have to plug in to the laptop when i want to run ubuntu ?

    Thanks.

Leave a Reply

Your email address will not be published. Required fields are marked *