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


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.

Related posts

109 thoughts on “How to install Ubuntu Linux from USB Stick

  1. Can someone elaborate on step 5? I don’t understand what this means, exactly.

    Copy the Ubuntu CD image in the root directory of your USB device – what from the ubuntu CD image are we copying? We copied the /isolinux directory already… do we just copy everything else too?

  2. what from the ubuntu CD image are we copying?

    You need to download the desktop or server version of ubuntu you need to copy the .iso file in to your root directory of your USB device.

  3. If you have a relatively fast network connection, and/or an apt-proxy handy, you can make an installer much more easily. Just make sure to enter your proxy as the mirror while installing.

    $ wget
    $ zcat boot.img.gz | sudo dd of=/dev/sdb

    – replace “sdb” with your USB drive that you want to turn into an installer.
    – replace “hardy” with gutsy if you don’t want the beta just yet
    – replace “amd64” with i386 if you don’t want to go 64 bit.

    Using this method actually works a lot faster than installing from an ISO (both ubiquity and alternate installer) after you have your cache built up from your first install. Having an apt-proxy around is amazing for this sort of stuff.

  4. Fantastic,

    Just what I was looking for.

    In theory any distro (besides Ubuntu) can be installed following this technic.

    Thanks guys.

  5. Great tutorial! And thanks for the script Niall!

    Any way to make this a persistent boot, so I can write files to the desktop or my home directory and have them remain there after a reboot?

    Thanks guys!

  6. Hi
    Great tutorial, but kind of a long way for a linux newbie. Witch is why I love the script, but unfortunately I can’t get it working!

    Is there anywhere I can find a guide for dummies/newbies? Thanks…

  7. How can this work without modifying “syslinux.cfg”? At boot it keeps saying it cannot find (of course) “/casper/vmlinuz”…

  8. I had the same problem as Davide R, but the netinstaller mentioned by James Harr worked great. Just some small notes about the netinstaller for people who may try it:

    – After installing the base system and when you have selected if you want to put Ubuntu/Kubuntu/Xubuntu/Edubuntu or whatever on top of it, it says “Please wait…” and nothing seems to happen for a long time. I thought that maybe the installer froze and almost rebooted the computer to try again, but in fact during this time it downloads the rest of the installation files off the Internet. Some kind of progress bar at that point would have been nice, but with the way it is now you’ll just have to keep on waiting and hope that the installer really didn’t freeze. Depending on your network connection it may take a while. I had to wait over an hour with mine.

    – After the installation was completed, the grub bootloader was pointing to the wrong hard drive and couldn’t launch Ubuntu. This was apparently because it was setup with the assumption that the USB stick is always connected to the computer and takes the first hard drive letter/number, when in fact it isn’t. So in my case grub was pointing to (hd1,0) when it was supposed to point to (hd0,0). Luckily this was easy to fix in grub by entering the edit mode, and when ubuntu is running, permanently in /boot/grub/menu.lst .

    I wonder why the netinstaller is not mentioned anywhere, even though it’s apparently actively kept up to date? I never knew that there actually _is_ one for Ubuntu, and I missed it from my Debian days.

  9. I used the netinstall USB method since a lot of time…in a simpler way: just

    zcat boot.img.gz > /dev/sdX (not sdX1)

    This way you should not worry about MBR or partitions or whatever…just boot the pendrive. 🙂

    OTOH I solved about booting the livecd, just did it 2 minutes ago with the Xubuntu 8.04 RC Desktop CD ISO on a 1 GB pendrive:

    – I created a FAT16 partition of about 750 MB with parted, only because it creates a MBR by default. Alternatively you can use fdisk, cfdisk, gparted…

    – “mkfs.vfat -F 16 /dev/sdX1” to actually create a file system

    – copy all CONTENT (not the ISO file itself!) on the root of the pendrive

    – copy ALL the CONTENT of “isolinux” dir on the root of the pendrive

    – rename /isolinux.cfg to /syslinux.cfg

    -edit /syslinux.cfg, removing all references to cdrom (in fact, replacing “/cdrom/” to “”)

    – unmount the pendrive and “syslinux /dev/sdX1”

    – If your pendrive doesn’t boot, try “install-mbr /dev/sdX” or “lilo -M /dev/sdX” (pendrive must be umounted)

    Reboot. You mau have to enable USD-HDD and USB-ZIP options in your BIOS, as well as “Boot from other devices” and “USB Legacy mode -> ALL” options.

    Hope it helps

    Greetings from Italy


  10. I have successed with easier way installing ubuntu 7.10 in my desktop using usb stick just couple minutes ago…. 😉

    Here we go…

    1. Download file


    2. Change the permission:

    chmod u+x

    3. Before running the isotostick file, we have to make our usb stick bootable or the script will generate error “The partition isn’t bootable” (or something like that):

    sudo parted /dev/sdb set 1 boot on

    (BE CAREFULL :”/dev/sdb” is my usbstick location, change it when necessary)

    4. And the final step is execute the script:

    sudo ./ ubuntu-7.10-desktop-i386.iso /dev/sdb1

    (i have the iso in my current location, and again “/dev/sdb1” is our destination, our usb stick location)

    5. Umount our usb stick, plug it when power off, and then power on. Violla….our usb stick is now working as Live CD..

    Hope it works..

    Greetings from Indonesia


  11. How to make this persistent?

    If I book with the persistent parameter, it starts initramfs rather than the GUI

    adding: persistent)

    to initrd.gz (the old Gutsy solution) did not help

  12. I was wondering how could it work.. So I’ve just followed all steps and found that:
    It doesn’t 😉 I assume that it’s way to prepare “server” edition of ubuntu live cd, and maybe “alternate” – they are using text based installers and there’s possibility to boot installer from ramdisk and then find iso image on the cd :).
    To run ubuntu from usb flash drive normally please follow instructions on other pages

    greetings from Poland 😉

  13. Thanks for the instructions. I followed them, including renaming the install directory to casper. That solved the problem of the installer not being able to launch, however, the menus I am given are different to the CD and, even if I select ‘live’ option I am dropped into the text based installer. This is a bit scary as I am looking for a way to run the ‘live cd’ from a usb and the last thing I want to do is wipe a computer – also, if I did want to install, I’d rather use the graphical interface that I know comes with the iso I’m trying (i386 Hardy Desktop edition). Any explanation appreciated.

  14. So I am trying to make my UDF boot using cfdisk (open to other options). When running cfdisk ” cfdisk /dev/sdc1″ I get the following message. “FATAL ERROR: Bad primary partition 0: Partition begins after end-of-disk” Ultimately I am trying to get it to boot the Ubuntu install iso. The drive is a cruzer micro 2GB. I would prefer to not wipe it’s contents.

  15. Does anyone know if any usb pen will work (assuming it is big enough to hold the install)? I have seen very cheap 32GB pens on ebay (which would make a great companion for an eee pc) and I’m just concerned that there might be certain drives that this won’t work on.


  16. Davide R
    Thanks for your advice worked like a charm.
    I try almost every thing to get eeeubuntu on my usb drive.
    So now me and my eee pc are running eeeubuntu 🙂

  17. It sounds really cool,
    But Ubuntu will select the drivers for the system where you are installing Ubuntu. Doesn’t that mean that you can’t use your portable Ubuntu on systems with other hardware then the one where you installed it on?

    Sorry for my bad grammar, I still hope a lot of the people here can understand me :p

  18. hello guyz this is exactly what i was looking for , but my prob is i’m under xp at the moment and i want to install the latest ubuntu on my laptop , and i dont have any CD player only USB.
    But it”s seems it doesnt want to boot from my USB hard drive .
    There is a few step to do with a linux already , can those step be done under xp ?

  19. For those of you trying to create a USB drive which is portable (different hardware machines, but runs x86) and yet has persistence (you create & save a file to desktop, it is there next boot) try this web site:

    I’ve created thumb drive installs for the last few ubuntu releases which worked reasonably well using these instuctions. What I’d like is a simple way to apply patches without having to keep the old files around too.

  20. I used unetbootin to install freespire to my usb stick. It was extremely easy. But it loads the OS as live cd. What I want to do now is save changes of freespire to usb stick. Freespire does not have a version to install into usb stick. Any ideas?

  21. For all those who are like me. don’t want to be too geek

    ubuntu 8.04 hardy install in 5 mins I recorded the Time…

    1. ISO image burner which is ultra effective 😉 (Ultraiso will be good as it provide option to make bootable disc or drive but its a commercial tool)
    2. Ubuntu 8.04 ISO image
    3. USB flash drive I had Kingston 4gb. (1 gb is good to go)

    step1. Put you Flash drive in USB port…
    step2. open ISO file with burner tool
    step3. use option “write disk image” in “bootable” menu this for ULTRA ISO.
    step4. before writing image format the drive fat32

    after writing this step is USB drive is ready to boot

    Step5. change BIOS setting to boot form USB drive. Give USB 1st preference.

    Insert the Flash drive… it will show that you have a Live CD of UBUNTU…..

    Option 1. if you don’t want to install then you can use this pen drive on any PC and boot form it. YOU HAD YOUR PORTABLE OS READY

    Option 2. if you want to install… then follow the procedure

    on boot you will get a command prompt like this

    BOOT:____ type in the blank “live-install”

    installation will start do as the saw on screen…

    * if you want dual boot system then “when the screen of partition”

    choose “manual”

    Step1. delete any Fat32 drive which should be atleast a moderate size of 10-15 gb(keep in view of installation of other software’s)

    Step2. Now there will be a free space

    choose option: new partition 1000mb(atleast) as SWAP
    new partition remaining free space as “EXT3 file journaling” and mount ” / ”

    DONE click Fwd button

    Once you done and remember that it will take 1 min to complete the filling form part and 4 mins to install it on disk–total 5 mins.

    happy playing with tools

    I have tried this USB method on there things like trinity rescue disk, bartxp, winpe and so on with other stuffs like dban, memtest86+, systemrescue cd.

    Don’t waste time install “UBUNTU” knowledge sharing 🙂

    Window OS doesn’t sucks..
    as for the bill gates he was a hkr before and still have access to all system(majorly)… MS monopoly of knowledge is what actually sucks…

    UBUNTU—- sharing of knowledge….

    HAVE A GUD DAY/NIT all you geeks and non-geeks like me…

  22. hi

    I have installed ubuntu 7.10 on my 4GB USB Flash few monthsagp and since then my USB shows 710 mb of ubuntu and i couldnt access the rest of the USB. now i need to install 8.04 and i reformated and i got only 710 MB. how can i recover all the space and install the latest ubuntu.


Leave a comment

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