Centos – How to install CentOS 6 via USB mass storage device

centossystem-installationusb-drive

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?)

Best Answer

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).

Related Question