All of the gui driven iso to usb programs were not working correctly for me on CentOS. This document outlines steps to make a CentOS 6 install usb stick.
What you need:
An 8GB or higher usb stick ( I like corsair voyagers )
CentOS 6.6 DVD 1, 2 and Net Install isos ( www.centos.org )
root
The USB Stick will have 2 partitions. One partition will be bootable, and be used to load the boot menu. The other partition will hold the isos, some necessary files, and kickstart scripts.
Create the following directories:
/tmp/boot
/tmp/modboot
/tmp/iso
/tmp/usb
Mount the minimal boot iso file to the newly created directory:
# mount -o loop /location/to/minimal-boot.iso /tmp/boot
Copy all files from the iso into the modification directory.
# cp -pr /tmp/boot/* /tmp/modboot/
Unmount the ISO.
# umount /tmp/boot
Add entries to the boot menu. The entries will load the installer and tell it to select the proper iso file as an installation source.
If you want a custom backsplash for the menu create a 640X480 image and put it in the same directory as isolinux.cfg.
We need to modify the file: /tmp/modboot/isolinux/isolinux.cfg
This file lists all of the boot menu entries that will load the installer.
[root@kaneda isolinux]# cat isolinux.cfg
default vesamenu.c32
#prompt 1
timeout 600
display boot.msg
menu background splash.jpg
menu title Welcome to CentOS 6.6!
label local
menu label Boot from ^Local drive
menu default
localboot 0xffff
label usbinstaller
menu label ^Install CentOS 6.6 from the USB Stick
kernel vmlinuz
append initrd=initrd.img repo=hd:sda2:/
label kickstart
menu label ^Kickstart install CentOS 6.6 from the USB Stick
kernel vmlinuz
append initrd=initrd.img ks=hd:sda2:/ks.cfg
label vesa
menu label Install from USB with ^basic video driver
kernel vmlinuz
append initrd==initrd.img repo=hd:sda2:/ xdriver=vesa nomodeset
label rescue
menu label ^Rescue installed system
kernel vmlinuz
append initrd=initrd.img rescue
label memtest86
menu label ^Memory test
kernel memtest
append –
# yum -y install genisoimage syslinux
# cd /tmp/modboot
# mkisofs -o /tmp/bootusb.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -V “CENTOS-6-USB-INSTALLER” -T .
Make the iso bootable.
# isohybrid /tmp/bootusb.iso
Getting the iso onto the USB stick will wipe the drive.
Copy over the iso with the command below.
# dd if=/tmp/bootusb.iso of=/dev/sdb bs=4M; sync
May take a while.
Create a new ext4 partition on the USB stick.
This will be used to store the installation iso’s and all other additional content.
# fdisk -cu /dev/sdb
# Press ‘n’
# Press ‘p’
# Press ‘2’
# Press Enter twice.
# Press ‘w’
# mkfs.ext4 /dev/sdb2
Mount it:
# mount /dev/sdb2 /tmp/usb
Mount the install DVD iso.
# mount -o loop /location/of/installation/iso /tmp/iso
Create a directory on the flash drive called images:
# mkdir /tmp/usb/images
The purpose of this directory is to contain information about the install media. The file we need is install.img.
# cp /tmp/iso/images/install.img /tmp/usb/images/
Unmount the install iso.
# umount /tmp/iso
Copy over any kickstart files, and isos. See kickstart example below.
# cp /location/of/isos /tmp/usb
Change the permissions of files and directories on the flash drive.
# cd /tmp/usb
# find ./ -type f -exec chmod 444 {} ;
# find ./ -type d -exec chmod 555 {} ;
Unmount the USB drive, and boot.
# umount /tmp/usb
__________________________________
#ks.cfg file
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall –disabled
# Install OS instead of upgrade
install
# Use hard drive installation media
harddrive –dir=/ –partition=sda2
# Root password
rootpw –iscrypted #;laksjdf;alskdjf;alskjdf;lkajsdf;lkajsdf
# System authorization information
auth –useshadow –passalgo=sha512
# Use text mode install
text
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux –disabled
# Do not configure the X Window System
skipx
# Installation logging level
logging –level=info
# Reboot after installation
reboot
# System timezone
timezone –isUtc Etc/UTC
# Network information
network –bootproto=dhcp –device=eth0 –onboot=on
# System bootloader configuration
bootloader –location=mbr –driveorder=sda
# Partition clearing information
clearpart –all –drives=sdb –initlabel
zerombr
ignoredisk –only-use=sdb
# Disk partitioning information
# With a single disk, partition it into three sections: /boot, /, and swap
part swap –size=2048 –ondisk=sdb
part /boot –fstype=ext4 –size=256 –ondisk=sdb
part / –fstype=ext4 –ondisk=sdb –asprimary –grow –size=1
%packages
bison
cmake
file-devel
flex
gcc
gcc-c++
libpcap-devel
make
openssl-devel
python-devel
swig
zlib-devel
%end
2 Comments
brilutz · May 29, 2015 at 12:15 pm
HI there! Thanks for the write up! How do you get the kickstart installation to execute?
Matt Clemons · May 29, 2015 at 12:17 pm
When you select the boot entry associated with the kickstart script, it will auto execute.
label kickstart
menu label ^Kickstart install CentOS 6.6 from the USB Stick
kernel vmlinuz
append initrd=initrd.img ks=hd:sda2:/ks.cfg