Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to install CentOS 6.2 on a laptop (Thinkpad R40) which comes without CD/DVD-drive but with USB 2.0 ports.

It seems that CentOS does not provide ready-to-use dd-able USB images for installation.

Thus my question: How to install CentOS via a USB device (e.g. a 16 GB USB flash drive)?

Regarding using different available iso-images as base: the laptop has net-access - but I want to make sure that the CentOS installer is not loading unchecked packages from the net during installation - perhaps a netinstall image does not check cryptographically signed packages during installation (as with the Fedora 14 installer).

There is a CentOS InstallFromUSBkey which just provides outdated, cryptic and wrong information.

Especially, the instructions for CentOS 6 are missing details and contain errors (10 MB for the first partition is not enough, syslinux device fails and what are they talking about grub?)

share|improve this question
add comment

10 Answers

First obtain the following:

  1. A valid, checked CentOS ISO. There are quite a few mirrors available.
  2. uNetBootin: This little app ROX!
  3. A 16GB Flashstick/thumbdrive, or whatever you want to call it. Keep in mind that booting from flash is ALSO dependent on the flashstick. Some wont work... which ones? Lemme know if you find out. 7 of my 19 didn't work!
  4. Free Time. Waiting for the thing to finish drove me up the wall last night!

Once you have all your software on your machine, fire up uNetBootin. Point it at your flashstick and your ISO and tell it to go. Go make coffee, have a smoke and then go back one out... it is going take that long. Once its done, you have one more step: copy the ISO to the Flashstick. You'll need it later! Once done, plug the flashstick into the target machine and boot it up. Considering the range of machines out there, I cannot tell you how to setup your machine to boot from flash, but you have to go into your BIOS and do this. The machine will pickup the flashstick an boot from it to a Unetbootin screen.

Go ahead and install until the installer asks for a source for the ISO. Select HDD and point it at /dev/sda.

This should then fire up Anaconda and Bobs your Aunt.

share|improve this answer
add comment

Based on the instructions, I finally got the USB install working using livecd-iso-to-disk, and posted the instructions at

http://brakkee.org/site/2013/05/09/creating-a-usb-install-for-centos-6-4/

The post with the commandline for livecd-iso-to-disk on this page got me to try something else than before (basically using /dev/sdb1 instead of /dev/sdb in the commandline).

share|improve this answer
add comment

If you are in Fedora/Centos Based system you can use livecd-tools.

Simple steps.

yum install livecd-tools.x86_64 -y
livecd-iso-to-disk --format --reset-mbr /home/vmimage/CentOS-6.3-x86_64-minimal.iso /dev/sdg

where sdg is your usb storage device.

HTH

share|improve this answer
add comment
up vote 11 down vote accepted

Following method works with CentOS 6.2:

Requirements: USB flash drive (at least 4 GB, I used a 16 GB one)

Download an ISO image from a mirror - I chose the full 1st DVD image to avoid a network install (because it is not clear if the cryptographic package signatures are checked by the installer or not), e.g.:

$ wget http://ftp.uni-bayreuth.de/linux/CentOS/6.2/isos/i386/CentOS-6.2-i386-bin-DVD1.iso
$ md5sum CentOS-6.2-i386-bin-DVD1.iso

Check the md5sum against a md5sum.txt file from another mirror (and check md5sum.txt against md5sum.txt.asc via gpg).

Partition your flash drive (say it is /dev/sdb), i.e. delete all partitions, create just one, set the boot-flag and perhaps the FS-type:

# dd if=/dev/zero of=/dev/sdb bs=512 count=1
# fdisk /dev/sdb
> n
> p
> 1
(defaults)
> a
> 1
(toggles boot flag)
> t
> c
(filesystem type, default is 83, probably no need to change it)
> w
(write the new table)

Create a filesystem of type VFAT:

# mkfs.vfat /dev/sdb1

Fetch the Fedora-LiveCD tools:

$ git clone git://git.fedorahosted.org/livecd

(We need livecd/tools/livecd-iso-to-disk.sh - it also supports non-livecd ISO-images as source!)

Install some packages needed by the script, e.g. under a Debian-like system:

# apt-get install isomd5sum syslinux extlinux

Execute the script:

# bash livecd-iso-to-disk.sh CentOS-6.2-i386-bin-DVD1.iso /dev/sdb1

Test the device:

$ qemu -hda /dev/sdb -m 256 -vga std

For this to work you user (temporarily) needs rw permissions on /dev/sdb.

PS: As a side node, RHEL 6 has dropped support for non PAE hardware - i.e. the kernel does not run on such an old system like a Thinkpad R40 (which is Centrino based).

share|improve this answer
    
to use this method with netinstall, see my answer below. –  carillonator Dec 1 '12 at 18:44
    
I tried this today with CentOS-6.5-x86_64-bin-DVD1.iso and it failed. Error: rsync: write failed on "/media/usbdev.VSHuFU/CentOS-6.5-x86_64-bin-DVD1.iso": File too large (27) This is most likely because the .iso is 4.2GB, too big for vfat. Can we make the filesystem ext? Or NTFS? –  0xSheepdog Mar 20 at 20:57
add comment

If you want to just put the netinstall iso on your USB device and install CentOS via URL, do this:

  1. use maxschlepzig's method above to get the netinstall iso on your USB device. That method only works with self-contained ISOs that have all the packages you need for installation.

  2. boot the USB device

  3. at the bootloader screen ("Install or upgrade an existing system" etc.), press TAB to edit boot options

  4. remove the whole stage2=... section.

  5. add "inst.repo=", where the url is something like http://mirror.stanford.edu/mirrors/centos/6.3/os/x86_64

  6. press Enter to boot

it will first try to find preview.img and one other file that doesn't exist, but will eventually timeout and fetch install.img and allow you to go through the netinstall.

see http://wwoods.fedorapeople.org/doc/boot-options.html for Anaconda boot options

share|improve this answer
add comment

The problem that you are having with Centos (Fedora & RHEL) are that they install from a kickstart (ks.cfg) file and not directly from the image/iso/CD/DVD.

Running a live CD/DVD is a different animal. Many ISO to USB tools are based on using a Live CD image and not a install image. On many Linux distros there is no difference in Live to Install, but the Centos/RHEL, Fedora distros do have different ISO's for a reason (good or not is debatable).

So far I have only found that iso2usb, unetbootin and Xboot handle this task somewhat correctly. The underlying problem is that the kickstart file contents have more information that needs changing to work correctly. There are also differences in Centos/RHEL versions 6.2 to 6.3 that change the kickstart file so that the method that I worked out for 6.2 doesn't work for 6.3.

Basically these distros install almost everything from RPM files and not binaries contained in the ISO. This RPM method works for install, upgrade, modification, updates from CD or Network or local file, but makes installing from USB tough.

Change #1, The USB stick can look like a local drive and not a CD, then that mounting location can change depending on the type/brand of USB stick you have. Some are recognized as hard drives behind a USB Hub, others are seen as a harddrive (no USB) others are not recognized at all by the BIOS and some are recognized by the BIOS and when the install process gets handed off to the Centos installer for completion then that no longer works because the USB stick changes mount point and can not be found (change #2).

I have found that different brands/types/formats of USB sticks change mounting locations during the install process and that causes two kinds of failures.

  1. Your hard drive changes mount point, or
  2. the USB changes mount point. (that is the 6.3 problem)

You can take the easier path and install from a LiveCD or LiveDVD image on a USB stick. Just boot the live image and the perform the install from the desktop or do the init 6 thing. I believe that performing an install using the net install ISO file from a USB stick should work because the point where the installer looks for the RPM files is going to be looking on the NET and not on the USB drive that has moved mount points, but I have not tried that yet.

share|improve this answer
add comment

This really helps: http://iso2usb.sourceforge.net/

ISO2USB utility creates bootable USB drive from CentOS/RedHat 5.x/6.x installation disk or corresponding ISO image. Created USB drive may be used to perform installation on machines that lack optical drive. Custom installation disks (with kickstart configuration files) are fully supported.

ISO2USB source code is based on UNetbootin project, but features the following distinctions:

  • Created USB drive is fully self-contained and doesn't rely on network install.
  • Custom installation disks are fully supported (kickstart configuration files are adapted for USB install mode).
  • Original optical media (CD or DVD) may be used instead of ISO images.
  • Image may be adapted for installation from RS-232 serial console.
share|improve this answer
    
This will only work if you have an Windows-computer nearby. –  Jonas May 4 '13 at 11:10
add comment

I downloaded the ISO for the LiveCD and plugged a 1 GB Kingston USB in and ran the command

sudo dd if=/path/to/CentOSiso of=/dev/sdb (path of the USB device) bs=1M

When I issued an init 6, I booted into the CentOS 6 LiveCD and chose install. Not elegant, but it worked.

share|improve this answer
1  
Perhaps this method does not work for all BIOSes - could you provide the exact URL of the ISO image you used? –  maxschlepzig Mar 28 '12 at 8:02
add comment
  1. Create a bootable stick with cat '/path_to_iso_file >> /dev/pendrive' && sync

  2. Boot box/laptop from USB

share|improve this answer
    
I ignored this answer due to the downvotes, but I found out CentOS 6.3 ISO images (or at least the netinstall one) are actually hybrid images that can be dd'ed to USB devices and will still be bootable. The method described in the accepted answer on the other hand did not work for me and had me struggling for a bit. –  aphax Dec 20 '12 at 22:59
add comment

If you use windows, use unetbootin and prepare the Centos ISO. Plug the usb drive, run unetbootin and then from unetbootin burn the ISO to the usb drive.

share|improve this answer
    
unetbootin is also available for Linux. Actually, I tried unetbootin which is packaged for Ubuntu 11.10, but it did not work with a current CentOS ISO. –  maxschlepzig Feb 8 '12 at 8:56
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.