How-to: Installing Ubuntu Linux on a usb pendrive
July 20, 2009, 4:42 am
Filed under: Tutorial
This tutorial will show how-to install Ubuntu on a usb stick. Even though this tutorial uses Ubuntu as its base distribution, you could virtually use any type of Linux liveCD distribution.
Being able to run Linux out of a usb bar is a great way to enjoy the live CD experience (being able to use Linux on any computer you might get by) and the big advantage of being easier to carry around than a CD.
In order to reproduce this tutorial,
you will need a few items such as:
- a ubuntu liveCD
- a usb bar of at least 1G
- a running Linux operating system
Now that you have all this, it is time to prepare you USB bar do host the Ubuntu liveCD files.
2. Setting up the USB disk
2.1. Finding the device
In the first place, you need to plug your usb drive and check under which device it is associated. To find out the device, run:
$ sudo fdisk -l
On my system, the device appears as being /dev/sdb, I will therefore use /dev/sdb as a reference for this tutorial, please replace it accordingly to your system (might be sda, sdc …).
Once you found your device, you are going to create the partitions.
Using the wrong device name might destroy your system partition, please double check
2.2. Making the partitions
Make sure every of your already mounted partition are unmounted:
$sudo umount /dev/sdb1
and then launch fdisk, a tool to edit partition under linux:
sudo fdisk /dev/sdb
We are going delete all the partition and then create 2 new partition: one fat partition of 750M which will host the files from the live CD iso, and the rest on another partition.
At fdisk prompt type d x where x is the partition number (you can simply type d if you only have one partition), then:
- n to create a new partition
- p to make it primary
- 1 so it is the first primary partition
- Accept the default or type 1 to start from the first cylinder
- +750M to make it 750 Meg big
- a to toggle the partition active for boot
- 1 to choose the 1 partition
- t to change the partition type
- 6 to set it to FAT16
Now we have out first partition set up, let’s create the second one:
- n to create yet again a new partition
- p to make it primary
- 2 to be the second partition
- Accept the default by typing Enter
- Accept the default to make your partition as big as possible
- Finally, type w to write the change to your usb pendrive
Partitions are now created, let’s format them.
2.3. Formatting the partitions
The first partition is going to be formated as a FAT filesystem of size 16 and we are going to attribute it the label “liveusb”.
$ sudo mkfs.vfat -F 16 -n liveusb /dev/sdb1
The second partition is going to be of type ext2 with a blocksize of 4096 bytes and the label casper-rw. Mind that it has to be labeled as casper-rw otherwise the tutorial won’t work!.
$ sudo mkfs.ext2 -b 4096 -L casper-rw /dev/sdb2
At this stage, our usb pendrive is ready to host the liveCD image. Now, let’s copy the files to the usb bar.
3. Installing Ubuntu on the USB stick
3.1. Mounting Ubuntu liveCd image
In the first place we need to mount our ubuntu iso. Depending if you have the .iso file or the CD, there is 2 different ways of mounting it.
3.1.1. Mounting from the CD
People using Ubuntu or any other user-friendly distro, might just have to insert the cd and it will be mounted automatically. If this is not the case:
$ sudo mount /media/cdrom
should mount it.
3.1.2. Mounting from an .iso image file
We will need to create a temporary directory, let say /tmp/ubuntu-livecd and then mount our iso (I will be using a feisty fawn iso).
$ mkdir /tmp/ubuntu-livecd
$ sudo mount -o loop /path/to/feisty-desktop-i386.iso /tmp/ubuntu-livecd
Once the cd image is ready, it is time to mount the newly created usb bar partitions:
3.2. Mounting the usb bar partitions
Same here, you might be able to get both your partition by simply replugging the usb pendrive, partition might appears as: /media/liveusb and /media/casper-rw. If this is not the case, then you will need to mount them manually:
$ mkdir /tmp/liveusb
$ sudo mount /dev/sdb1 /tmp/liveusb
All the partitions we need are now mounted, let’s copy the files.
3.3. Copying the files to the usb bar
Let positionned yourself on the CD image directory (in my case: /tmp/ubuntu-livecd , but it might be /media/cdrom , and copy at the root of your usb first partition:
- the directories: ‘casper’, ‘disctree’, ‘dists’, ‘install’, ‘pics’, ‘pool’, ‘preseed’, ‘.disk’
- The content of directory ‘isolinux’
- and files ‘md5sum.txt’, ‘README.diskdefines’, ‘ubuntu.ico’
- as well as files: ‘casper/vmlinuz’, ‘casper/initrd.gz’ and ‘install/mt86plus’
$ cd /tmp/ubuntu-livecd
$ sudo cp -rf casper disctree dists install pics pool preseed .disk isolinux/* md5sum.txt README.diskdefines ubuntu.ico casper/vmlinuz casper/initrd.gz install/mt86plus /tmp/liveusb/
It might complain about symbolic links not being able to create, you can ignore this.
Now let’s go to the first partition of your usb disk and rename isolinux.cfg to syslinux.cfg:
$ cd /tmp/liveusb
$ sudo mv isolinux.cfg syslinux.cfg
change /tmp/liveusb according to your settings
Edit syslinux.cfg so it looks like:
APPEND file=preseed/ubuntu.seed boot=casper initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash --
menu label ^Start Ubuntu in persistent mode
append file=preseed/ubuntu.seed boot=casper persistent initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash --
menu label ^Start or install Ubuntu
append file=preseed/ubuntu.seed boot=casper initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash --
menu label Start Ubuntu in safe ^graphics mode
append file=preseed/ubuntu.seed boot=casper xforcevesa initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash --
menu label ^Check CD for defects
append boot=casper integrity-check initrd=initrd.gz ramdisk_size=1048576 root=/dev/ram rw quiet splash --
menu label ^Memory test
menu label ^Boot from first hard disk
Woof, finally we have our usb disk almost usuable. We have a last thing to do: make the usb bootable.
3.4. Making the usb bar bootable.
in order to make our usb disk bootable, we need to install syslinux and mtools:
$ sudo apt-get install syslinux mtools
And finally unmount /dev/sdb1 and make it bootable:
$ sudo umount /tmp/liveusb
$ sudo syslinux -f /dev/sdb1
Here we are :D , reboot, set your BIOS to boot from the usb bar and enjoy Ubuntu linux from a pendrive
If you are having trouble booting on the usb bar, this might be due to your MBR being corrupted. In order to fix it up, you can use lilo (I installed lilo on my box only for thid purpose).
$ lilo -M /dev/sdb
will fix the MBR on device /dev/sdb
Free Resource for Schools
Free Resources for Schools
Office and Page Layout
Open Office is the free alternative to MS Office and provides similar functionality for most practical purposes (except those spreadsheets requiring Visual Basic). Version 3 (currently in beta) has many more functions including full PDF and .docx support. Full details at http://www.openoffice.org/
Serif PagePlus SE is a cut down version of a commercial package but still provides many of the DTP tools required. See http://www.freeserifsoftware.com/software/PagePlus/default1.asp .
Scribus is a powerful DTP and page layout application and is an alternative to MS Publisher. Friendly modern interface and easy pdf creation. Available from http://www.scribus.net/ .
Creating Learning Platform Courseware
MOS Solo is a Windows application to create learning courses, presentations, assessments and surveys. The courses created are SCORM conformant and can be viewed in a LMS or directly on the Internet:
The eXe project is developing a freely available Open Source authoring application to assist teachers in the publishing of web content without the need to become proficient in HTML or XML markup. Resources authored in eXe can be exported in IMS Content Package, SCORM 1.2, or IMS Common Cartridge formats or as simple self-contained web pages http://exelearning.org/
Ispring free 3.1 works with all versions of PowerPoint to convert presentations to Flash files for use in learning platforms, download it from – http://www.ispringsolutions.com/
IrfanView is a useful little image editor with many of the features needed to modify and improve photos. Not the most intuitive interface but small, fast and effective. Available from http://www.irfanview.com/ .
GIMP is a well known graphics editor with similar functionality to commercial heavyweights such as Photoshop. Get it from http://www.gimp.org/ .
Inkscape is an Open Source vector graphics editor, with capabilities similar to Illustrator, CorelDraw, or Xara X, using the W3C standard Scalable Vector Graphics (SVG) file format. Inkscape supports many advanced SVG features (markers, clones, alpha blending, etc.) and great care is taken in designing a streamlined interface. It is very easy to edit nodes, perform complex path operations, trace bitmaps and much more. See http://www.inkscape.org/ .
Google SketchUp is software that you can use to create, modify and share 3D models. Online at http://sketchup.google.com/ .
QCAD is a simple 2D CAD system for Unix and Windows. It offers basic support for the construction and modification of CAD drawings. Download from http://sourceforge.net/projects/qcad/ .
VideoSpin is free video editing software that allows you to create your own movie clips in minutes using your own videos and pictures. A free version of the well-known Pinnacle app it can be found at http://www.videospin.com/
Audacity is free, open source software for recording and editing sounds:
http://audacity.sourceforge.net/ . With the addition of a small ultilty can save as MP3 files for podcasting.
GoogleDocs provides online word processor and spreadsheet that can be used individually and as wiki style shared documents. http://docs.google.com/ is the way in. You can register with any email address.
Google Apps provides many more facilities and tools, including the basic GoogleDocs and Gmail emails services and can be integrated with existing facilities. Full details of the Education Edition can be found at http://www.google.com/a/help/intl/en/admins/editions_spe.html . A useful reference article showing how schools are using Google Apps is available at http://education.guardian.co.uk/link/story/0,,2277942,00.html
Acrobat.com is Adobes answer to Google Apps – different interface of course but some additional functionality including the ability to edit images in the word processor. Also includes online conferencing and document sharing. Only I beat at present but worth a look at https://www.acrobat.com
Other free online work spaces are ZoHo at http://www.zoho.com/ and ThinkFree at http://member.thinkfree.com/ .
Firefox is a superb web browser that many consider far superior to Internet Explorer with its simple interface, tabbed browsing and the facility to install a large range of useful add-ons and utilities. Download from www.mozilla.com/firefox/ .
Thunderbird complements Firefox and is an alternative mail client to MS Outlook. Supports both POP and IMAP servers but won’t talk to MS Exchange servers. Get it from www.mozilla.com/thunderbird/ .
KompoZer is a complete web authoring system that combines web file management and easy-to-use WYSIWYG web page editing. KompoZer is designed to be extremely easy to use, making it ideal for non-technical computer users who want to create an attractive, professional-looking web site without needing to know HTML or web coding. Obtainable from http://www.kompozer.net/ .
eyeOS is a new kind of Operating System, where everything resides on a web browser. With eyeOS, you will have your desktop, applications and files always with you, from your home, your college etc. Just open a web browser, connect to your eyeOS System and access your personal desktop and all your stuff just like you left it last time. While eyeOS sits on a public server users can install it on a local Apache server if desired.
Modx – open source website management software
If you need to convert PDF files to Word (and pretty much any other file type to another appropriate one then try the online tool Zamzar found at http://www.zamzar.com/
FreeMind is a premier free mind-mapping software written in Java:
7-Zip is a useful alternative to WinZIP. See http://www.7-zip.org/ .
Scratch is a tool for teaching control technology and environment development from KS2 upwards. Very user friendly and powerful. Get it from http://scratch.mit.edu/ .
VLC media player is a highly portable multimedia player for various audio and video formats (MPEG-1, MPEG-2, MPEG-4, DivX, mp3, ogg, …) as well as DVDs, VCDs, and various streaming protocols. See http://www.videolan.org/vlc/ .
CutePDF Writer allows you to create PDF files from any printable document. Very useful little tool from http://www.cutepdf.com/
And these are just a starting point, much more is available and schools may wish to look at the offerings on the following sites:
http://www.opensourcewindows.org/ contains links to several useful applications and utilities.
Techies may wish to browse http://www.freewarefiles.com/ or the well known http://www.tucows.com/ .
Other useful sites include http://www.nedwolf.com/Freeware.htm and http://www.freesoftwarewindows.com/ .
The Asus EeePC and Acer Aspire One run versions of the Linux operating system. Many useful tools for this may be found at The Free Software Foundation http://www.fsf.org/ and at Sourceforge at http://sourceforge.net/ but do be aware that you are entering geek territory here! Best left to specialists unless a particular application clearly states that it will work under the version of Linux supplied with the EeePC.
NB You are advised save all files to disk and to run appropriate virus checks before installing any free software onto your Windows system. The advice above is provided in good faith and basic checks have been made but we cannot guarantee that any software downloaded from the web is free of virus, Trojans or other infections.
Yes there is copyright free and Creative Commons licensed music available. However, because of the potential for widespread abuse and subsequent litigation all music, MP3 and similar downloads are currently blocked by PCC web filtering. If legitimate download sites can be identified these will be made available to schools.
There are some sources of images which may be used free of charge for educational purposes. These include:
AICT (Art Images for College Teaching): this is a royalty-free image resource for the educational community
DHD photo gallery: over 13,000 very varied images, clip-art, sounds and video clips (from carbon resister strips to Victoria Falls) which may be used subject to very reasonable terms and conditions
FreeFoto.com: over 67,000 images in 117 sections, available for non-commercial use subject to FreeFoto terms and conditions
Flickr hosts a huge and growing library of photographs submitted by individuals. It is possible to search for images with Creative Commons licences allowing educational use.
FreeImages.co.uk: over 2,500 photographs which may be freely used or adapted for use on web sites or in publications, under FreeImages terms and conditions which include that a credit/link is given to the site
Pics4Learning: copyright-friendly images for education. The site is aimed at primary and secondary education teachers but the images available are broad in range and applicability.
Visual Arts Data Service : access to collections of images which may be used for research or teaching purposes but if used for teaching must be restricted so that access is only available to students who have signed an appropriate undertaking – see VADS conditions for use
Philip’s House of Stock Photography (www.photo.net/stock/): This site provides many free images and also provides links to other free image sites.
Botanical Society of America Online Image Collection: education images on botany for instructional use
The Centre for Bioscience ImageBank: thousands of images are available free of charge with copyright cleared for educational use, with due acknowledgement.
Geology by lightplane – 335 colour aerial images of landforms and geological features (in USA), taken from a small airraft, free for non-commercial educational use
Graphic Maps (www.graphicmaps.com) – free images of maps, flags and globes. (The site also contains many maps and images available for a fee, but the free ones are easy to find).
Health Education Assets Library: a digital library providing freely accessible digital teaching materials aimed to meet the needs of today’s health sciences educators and learners.
Microsoft ClipArt Gallery – copyright free images if you have Microsoft Office software legally installed on your computer. This is a searchable gallery of thousands of images.
Another useful list of imagery that can be used for education purposes cane be found at http://www.nottingham.ac.uk/nursing/sonet/resources/image_repositories.html
Note: Do not forget to read the licence information on each site. A web page which promotes a department, as opposed to being part of teaching materials, may or may not be considered “educational purposes”. Copyright and Digital Rights Management (DRM) are complex issues – if an image is not clearly released for open use, whether under a Creative Commons licence or otherwise then it should not be used.