Skip to content

Instantly share code, notes, and snippets.

@tekwiz
Last active August 29, 2015 14:16
Show Gist options
  • Save tekwiz/a2cd5c2dd2edc5998d65 to your computer and use it in GitHub Desktop.
Save tekwiz/a2cd5c2dd2edc5998d65 to your computer and use it in GitHub Desktop.
Create CentOS 6.6 Bootable USB Installer
#!/bin/bash
###
# Download the ISO if not already done:
# curl -o ~/Downloads/CentOS-6.6-x86_64-minimal.iso \
# http://mirror.lug.udel.edu/pub/centos/6.6/isos/x86_64/CentOS-6.6-x86_64-minimal.iso
#
# Verify the ISO:
# iso_sha256=` openssl sha256 -r ~/Downloads/CentOS-6.6-x86_64-minimal.iso | cut -d ' ' -f1`
# [[ $iso_sha256 != '5458f357e8a55e3a866dd856896c7e0ac88e7f9220a3dd74c58a3b0acede8e4d' ]] && echo "BAD: SHA256 is incorrect!" 1>&2
#
# Determine the DISK_DEV with:
# diskutil list
DISK_DEV=/dev/disk2
ISO_PATH=$HOME/Downloads/CentOS-6.6-x86_64-minimal.iso
IMG_PATH=$HOME/Downloads/CentOS-6.6-x86_64-minimal.img
hdiutil convert -format UDRW -o $IMG_PATH $ISO_PATH
# This is typically not necessary. It partitions & formats the disk
# diskutil partitionDisk $DISK_DEV 1 "Free Space" "UNTITLED" "100%"
diskutil umountDisk $DISK_DEV
sudo dd if=$IMG_PATH.dmg of=$DISK_DEV bs=1m
diskutil eject $DISK_DEV
#!/bin/bash
###
# Download the ISO if not already done:
# curl -o ~/Downloads/CentOS-7.0-1406-x86_64-Minimal.iso \
# http://mirror.lug.udel.edu/pub/centos/7/isos/x86_64/CentOS-7.0-1406-x86_64-Minimal.iso
#
# Verify the ISO:
# iso_sha256=` openssl sha256 -r ~/Downloads/CentOS-7.0-1406-x86_64-Minimal.iso | cut -d ' ' -f1`
# [[ $iso_sha256 != '04e99a4f1a013b95a7ebc9a90ffa9ac64d28eb9872bc193fbd7c581ec9b6a360' ]] && echo "BAD: SHA256 is incorrect!" 1>&2
#
# Determine the DISK_DEV with:
# diskutil list
DISK_DEV=/dev/disk2
ISO_PATH=$HOME/Downloads/CentOS-7.0-1406-x86_64-Minimal.iso
IMG_PATH=$HOME/Downloads/CentOS-7.0-1406-x86_64-Minimal.img
hdiutil convert -format UDRW -o $IMG_PATH $ISO_PATH
# This is typically not necessary. It partitions & formats the disk
# diskutil partitionDisk $DISK_DEV 1 "Free Space" "UNTITLED" "100%"
diskutil umountDisk $DISK_DEV
sudo dd if=$IMG_PATH.dmg of=$DISK_DEV bs=1m
diskutil eject $DISK_DEV
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment