Make a RHEL 6 Bootable USB Installer

This posts outlines the steps required to make a RHEL 6 Installation USB Stick.  Effectively, this is nothing more than a USB stick version of the RHEL 6 DVD ISO.  The steps here will also work with any RHEL 6 based clone.

Note: There is a bug that prevents this from working on RHEL 6.4. However, RHEL 6.5 works properly. I have not tested this with RHEL 6.4 clones, so YMMV with those.

As always, use caution for running elevated commands; I am not responsible for any mistakes you make.

Having a USB stick to install RHEL 6 from is quite convenient, especially when making custom kickstart scripts.  The steps below provide a simple means to accomplish this task.  However, before moving forward, the following items are required:

  1. An 8GB or higher USB Stick that you want to dedicate for this
  2. The regular installation ISO’s for the version of RHEL 6 (or CentOS, Scientific Linux, etc.) you desire to install
  3. The minimal or “netinstall” ISO. This is crucial!

General Layout:
This is basically going to be setup as follows:

  • The USB Stick will have 2 partitions. One partition will be bootable, and be used to load the boot menu. The other partition will have the installation ISO’s (and any additional resources, like Kickstart files) on it.
  • The USB Stick will boot, and present the installation disk boot menu. You will select the option to install RHEL 6 from the ISO file stored on the second USB stick partition for installation.
  • Effectively, this is nothing more than a “Hard Disk” installation; meaning that the installer will look for an ISO file on an external HDD that contains all of the required files to install RHEL. However, we are going to “trick” the installer into thinking that our USB stick is the external HDD. This is actually a lot easier than it sounds.

Prepare Install Media:
Once the ISO’s are downloaded, some work will need to be done to make everything work as simple and fool-proof as possible. As mentioned above, download the net-install, or minimal boot ISO file. We are then going to extract the contents, and make a small modification to tell the installer where to find the installation source. This prevents you from needing to type in extra stuff to get an install going.

So, to do this, we will need to copy all of the contents from the ISO file to a directory that we can work with. Elevate to root and follow the following instructions in this order:

  1. Make a new directory in /tmp called rhelboot with the command:
    $ mkdir /tmp/rhelboot
    This is going to serve as a mount point for the minimal boot ISO file. For the purposes of this tutorial, I am using using the CentOS 6.5 net install ISO.
  2. Make another directory in /tmp called rhelmodboot with the command:
    $ mkdir /tmp/rhelmodboot
  3. Mount the minimal boot ISO file to the newly created directory:
    $ mount -o loop /location/to/downloaded/minimal-boot.iso /tmp/rhelboot
  4. Copy all files from the ISO file into the modification directory we created above:
    $ cp -pr /tmp/rhelboot/* /tmp/rhelmodboot/
  5. At this point, you can unmount the ISO:
    $ umount /tmp/rhelboot
  6. We are now going to add an entry to the boot menu. This entry will load the installer and tell it to select the proper ISO file as an installation source. To do this, we need to modify the file: /tmp/rhelmodboot/isolinux/isolinux.cfg
    This file lists all of the boot menu entries that will load the installer. This is what it looks like:

    default vesamenu.c32
    #prompt 1
    timeout 600
    display boot.msg
    menu background splash.jpg
    menu title Welcome to CentOS 6.5!
    menu color border 0 #ffffffff #00000000
    menu color sel 7 #ffffffff #ff000000
    menu color title 0 #ffffffff #00000000
    menu color tabmsg 0 #ffffffff #00000000
    menu color unsel 0 #ffffffff #00000000
    menu color hotsel 0 #ff000000 #ffffffff
    menu color hotkey 7 #ffffffff #ff000000
    menu color scrollbar 0 #ffffffff #00000000
    label linux
      menu label ^Install or upgrade an existing system
      menu default
      kernel vmlinuz
      append initrd=initrd.img
    label vesa
      menu label Install system with ^basic video driver
      kernel vmlinuz
      append initrd=initrd.img xdriver=vesa nomodeset
    label rescue
      menu label ^Rescue installed system
      kernel vmlinuz
      append initrd=initrd.img rescue
    label local
      menu label Boot from ^local drive
      localboot 0xffff
    label memtest86
      menu label ^Memory test
      kernel memtest
      append -
  7. Add a new label by copying and pasting one of the sections above with the necessary modification. The USB partition that will contain the ISO will be mounted as sda2 (during the installation process). This is important, as you will see later… To make a simple installer (without kickstart), add an entry similar to this:
    label usbinstaller
      menu label ^Install RHEL 6 from the USB Stick
      menu default
      kernel vmlinuz
      append initrd=initrd.img repo=hd:sda2:/

    Note: The label and menu label tags are customized. This particular entry is the default, marked with: menu default. If you copied and pasted, make sure you remove the other menu default entry. Also make note of append. I have added: repo=hd:sda2:/ to it. This follows the convention: repo=hd:device:/path. This will tell the installer that the installation source is located on a HDD (our USB stick in this case), and on the main root directory of it (this example). You can of course change which directory you want to place it in, for example: repo=hd:sda2:/workstation.

    For Kickstart: If you are using kickstart, it will be similar to above. The only difference is that you will need to have an append entry that follows this convention: ks=hd:device:/directory/ks.cfg. For example (keeping with the “workstation” convention earlier, and assuming that the kickstart script is located in the workstation directory):
    append initrd=initrd.img ks=hd:sda2:/workstation/ks.cfg (If you are using Kickstart, you don’t use repo=).

  8. Once done, save the file.
  9. The next steps involve the creation of the bootable ISO file that will be used to present the menu. You will need to run the following commands to generate the boot ISO file:
    $ cd /tmp/rhelmodboot
    $ mkisofs -o /tmp/bootmod.iso -b isolinux/isolinux.bin -c isolinux/ -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -V "RHEL-6-USB-INSTALLER" -T .

    Don’t forget the last “.”, that is needed for the command to work properly!

  10. After the last command, an ISO file will be present at: /tmp/bootmod.iso. The next step is crucial for USB bootability. The ISO will burn to a CD/DVD fine, but it won’t boot from USB until you make it USB bootable. To make it USB bootable, simply run the command: $ isohybrid /tmp/bootmod.iso
  11. The ISO should now be USB bootable. The next step is to get the ISO onto a USB stick. This will involve erasing everything off of the USB stick, as it will be dedicated for this task. To make matters simple, delete all partitions off of the USB stick. To do that, insert a desired USB stick. Unmount all mounted partitions, and then run the commands:
    $ fdisk -cu /dev/DEVICE # Make sure you use the proper drive.  Typically, this is sdb, but could be something else. I take no responsibility for your mistakes...
    # Press 'D' until you see the message: 'No partition is defined yet!'
    # Press 'W' to save the partition table to the device.

    Once the partitions on the USB stick have been removed, you can copy over the ISO. This is accomplished with the dd command, as follows:
    $ dd if=/tmp/bootmod.iso of=/dev/DEVICE # Pick the proper device, typically sdb
    Please use caution when running the dd command!

Final Steps: Copying All Required Files Over:
Below are the final remaining steps needed to complete the task. Please elevate to root to complete all instructions.

  1. Create a new ext4 partition on the USB stick. This will be used to store the installation ISO’s and all other additional content (like kickstart files). To do this, you must have your USB stick connected. Next, follow the commands below to create the partition:
    $ fdisk -cu /dev/DEVICE       # Replace DEVICE with the actual device.  It will most likely be sdb, but please double check.
    # Press 'N'
    # Press 'P'
    # Press '2'
    # Press Enter three times.
    # Press 'W'
    $ mkfs.ext4 /dev/DEVICE(PARTNUMBER) # Replace the device and partition number with the proper one.  Typically, this will be /dev/sdb2.
  2. Create a new mount point for the newly created partition, and mount it:
    $ mkdir /tmp/rhelusb
    $ mount /dev/DEVICE(PART) /tmp/rhelusb  # Remember...
  3. At this point, we can now copy all files over. However, before copying files over, you need to understand how the directory structure of this works. Basically, Hard Disk installs look for a .iso file with the installation files (the standard ISO’s you download and use for installation). However, we need to copy a few files from the installation ISO which tells the installer which ISO files in the directory to use (for installation).

    To do this, we have to mount the installer ISO. That is accomplished by creating another mount point, and mounting the installation ISO:

    $ mkdir /tmp/rheliso
    $ mount -o loop /location/to/installation/iso /tmp/rheliso
  4. You must first create a directory on the flash drive called images: $ mkdir /tmp/rhelusb/images. The purpose of this directory is to contain information about the install media. The primary file that needs to be copied from the ISO’s images directory is: install.img. For official RHEL 6, you must also copy over product.img. Note: RHEL clones may not have a product.img file, and can be omitted. So, copy the files over:
    $ cp /tmp/rheliso/images/install.img /tmp/rhelusb/images/
    # REQUIRED FOR ACTUAL RHEL, (Clones may lack this file):
    $ cp /tmp/rheliso/images/product.img /tmp/rhelusb/images/
  5. At this point, we are done with the mounted ISO image. You can now unmount it: $ umount /tmp/rheliso
    Feel free to copy over any kickstart files, or additional content that you need.
  6. Finally: Copy over all installation ISO’s onto the flash drive. It doesn’t matter if there is more than one, the installer will see them and install the system properly.
    $ cp /location/to/iso/to/copy /tmp/rhelusb
  7. It may be best to change the permissions of files and directories on the flash drive. This may, or may not, be necessary. However, all files on the installation medium are of permissions: 444, and all directories are of permissions: 555. To do this, you would need to run the commands:
    $ cd /tmp/rhelusb
    $ find ./ -type f -exec chmod 444 {} \;
    $ find ./ -type d -exec chmod 555 {} \;
  8. Unmount the USB drive, and test it out! $ umount /tmp/rhelusb (Don’t forget to cd out of the directory if you perform the optional step 7.)

The installer will see the USB stick as HDD sda2. Therefore, if you are using Kickstart, please keep this in mind if you are doing automatic partioning, and clearing out disks.

Additional Reources:

Share and Enjoy:
  • LinkedIn
  • Facebook
  • Twitter
  • Google Bookmarks
  • Reddit
  • Phil N

    Thank you for sharing step by step.
    When I boot up, it sad isolinux.bin corrupt or missing ?
    Need help

    • slashsarc

      I recall having this problem once… Don’t remember entirely why.

      Did you run the ISO through isohybrid?

      • Phil N

        I was doing line by line 5 times. Where is this isolinux.bin locating? In /dev/sdb1 but I can’t replace that one manually because it is bootable partition. I copied official .iso and boot.iso into /dev/sdb2. Did you recalled what need to be done ?

        • slashsarc

          I’m assuming you are using the official RHEL 6 ISO’s.

          The bootable partition is using boot.iso as its image. The official (regular installer) ISO file does not get extracted. You copy the entire ISO file to the second partition on the USB stick.

          The isolinux.bin file comes from steps 3 and 4. When you copy all the files off of the boot.iso image, the isolinux.bin file will be included.

          Are you able to successfully run step 9?

          Once the ISO from Step 9 is generated, you need to run it against isohybrid to make it bootable on USB sticks.

  • jdp231

    Hi Phil, great guidance, thank you. I’ve been banging my head against a problem with kickstarting a local USB media install for a few weeks now, and this post has gotten me closer than anyone else, including the “official” *snark* CentOS 6.5 (lacking) documentation. Everything _mostly_ works beautifully. Just this darn kickstart…

    I am having one issue with isolinux.cfg finding the path as specified with REPO to the kickstart file … Step 7, “For Kickstart:”. I think your documentaiton may have a typo:
    – append initrd=initrd.img repo=hd:sda2:/workstation/ks.cfg

    I don’t think pointing the repo= command at the path explicitly to the ks.cfg will work. I get an error in tty3 or 4 “no stage2= given, assuming hd:sda2:/ks.cfg/images/install.img”

    I tried adding the second option:
    – append initrd=initrd.img repo=hd:sda2:/ ks=hd:sda2:/ks.cfg

    but it fails, too. I have to specify the hd: parameter in the ks.cfg as well, so I think it might be confusing/redundant to do it here; what do you think? You’ve obviously had a lot more success than I with this process. =)

    • slashsarc

      jdp231, thanks for spotting the typo.

      I will try to get an answer for you on Wednesday. I do have kickstart files working properly with this (using official RHEL 6).

      I do recall that in the kickstart script itself, you need to tell it where the installation is located. I will review the kickstart script and provide some more feedback for you when I get back in the office.

      • jdp231

        Thanks! I found this because, as I said, I’ve been fighting a problem in this area for some time now. I *still* can’t figure out…is it even possible to make boot disc (DVD, etc.) with the ks.cfg added to the filesystem that the file.iso was made from? It almost seems like a ks.cfg can’t refer to a source or path or volume for install that itself resides in.
        I thought this would be easy to test, but I am having a helluva a time figuring it out.

        • slashsarc

          You can make a DVD with the KS file at the path. To do so, you must extract the regular ISO contents to a file, copy the KS file in, and then run the mkisofs command to generate the ISO. This site in the sources has more info on that:

          As for the USB thing, I looked at my USB stick and here is what I have for the initrd.conf file:
          append initrd=initrd.img ks=hd:sda2:/location/to/ks.cfg
          In my case, sda2 was the drive that contained the ISO contents and the KS script.

          As for the kickstart script, you need the following for the install source:
          harddrive --dir=/location/to/the/directory/housing/the/iso/file

          • jdp231

            You rock, man. Thanks very much. If I come across any other gems I’ll be sure to share them. Much appreciated.

          • slashsarc

            You’re welcome. Please let me know if there are any additional issues.

          • slashsarc

            Disqus is acting strange with my edits. Make sure the KS installation source reads:
            harddrive --dir=/location/to/the/directory/housing/the/iso/file --partition=sda2

          • figuemat

            –dir=/location/to/the/directory/housing/the/iso/file (so ‘/’ with this tutorial) or –dir=/images/install.img ?

            Because when I put just –dir=/ I have the error “The installation source given by device [‘sda2′] could not be found. Please check your parameters and try again”, and when I put –dir=/images/install.img I have a message error to (but after in the process) “Unable to read group information from repositories. This is a problem with the generation of your install tree”.

            Thank you 😉

          • Ian Nicholls

            I also have an issue with “Unable to read group information from repositories. This is a problem with the generation of your install tree”. – What is actually causing this message (im sure its from yum but what is it complaining about!) and I’ve tried various createrepo versions – no difference

            I’ve trying to do a remote KS using a second hard drive thats not being formatted similar to here

          • slashsarc

            Please see my response to @figuemat in the discussion.

            Please let me know if that does not resolve the issue, and I will try to take another stab as to why it may throw the issue.

          • Ian Nicholls

            Aha! I figured it out (at last)

            I redid the repo for the ISO using

            createrepo -o . .

            and missed out the vitally important bit of including the comps.xml!!!

            -g –groupfile

            Now it KS wonderfully :)

            I’ve finally done my remote CentOS 5 32bit to CentOS 6 64bit upgrade – needs a spar BIOS presented drive to store cfg’s and the ISO etc but it works

            Thanks for the help

          • slashsarc

            Sorry for not replying sooner…

            See my response to the other post above. The second is correct. Not sure why you are getting the error. I do know that if you are running a version of 6 before 6.5, you will experience that error due to a bug in Anaconda.

    • slashsarc

      Now that I remember… I don’t think you need “repo” if you are using kickstart… I think you only need “ks=” instead of “repo=”. Can you try that and see if it works?

    • slashsarc

      Don’t forget… When you perform partitioning with Kickstart, make sure you specify the device!!

      Otherwise, if you tell it to re-create all partitions, it will clear the partition table on the USB stick!! I’ve made that mistake a few times…

  • leecallen

    Thank you!!! I needed to create a USB install source with a kickstart file. I had tried recipes from a couple other sites and none of them quite worked. Ultimately I think the key difference is the ‘isohybrid’ command. Thank you for putting all of this together in one place.

  • leecallen

    Very minor corrections and embellishments…

    Under “Prepare Install Media”, step 7, I appended both of these sections to the isolinux.cfg:
    label usbinstaller
    menu label ^Install CentOS 6.5 from the USB Stick
    menu default
    kernel vmlinuz
    append initrd=initrd.img repo=hd:sda2:/
    label kickstart
    menu label ^Kickstart install CentOS 6.5 from the USB Stick
    # menu default
    kernel vmlinuz
    append initrd=initrd.img ks=hd:sda2:/ks/ks.cfg

    Under “Final Steps”, step 3, command #2:
    change /tmp/reliso to /tmp/rheliso

    Step 5 “Feel free to copy over any kickstart files” I did this:
    mkdir /tmp/rhelusb/ks
    cp /data/images/ks.cfg /tmp/rhelusb/ks

    Steps 7 & 8: if you perform the ‘optional’ commands you must cd out of the directory before unmounting.

    • slashsarc

      Thank you. I have made some of the minor improvements you mentioned.

  • figuemat


    Thanks for this article !
    I have a problem : when the process is installation of packages, i have a error message : “Unable to read group information from repositories. This is a problem with the generation of your install tree.”

    My isolinux.cfg : “[…] append initrd=initrd.img ks=hd:sda2:/ks.cfg […]”
    And my ks.cfg : “[…] harddrive –partition=sda2 –dir=/images/install.img […]”

    Thank you for the support 😉

    • slashsarc

      Which version are you running? (CentOS/SL/RHEL)

      I recall having this error message with RHEL 6 versions < 6.5. Red Hat actually fixed a bug in anaconda that prevented this from functioning properly.

      • figuemat

        My version is RHEL 6.3.

        For future support, it’s work with “ks=hd:sda2:./ks.cfg”
        Note the dot before /ks.cfg !

        • slashsarc

          Interesting. I wonder if that is something specific to RHEL 6.3. It works on 6.5 without the ‘.’.

  • 127wexfordroad

    RHEL7 here, not working with a straight dd as the RHEL docs suggest that it should. I’ll try your method soon. If it works, maybe a job at Red Hat should be in your future 😛

  • rberk

    when partitioning the USB I needed to specify partition 2 after copying the boot disk iso

    $ fdisk -cu /dev/DEVICE # Replace DEVICE with the actual device. It will most likely be sdb, but please double check.

    # Press ‘N’

    # Press ‘P’

    # Enter the number 2 <<<<<—- this is what I needed to do

    # Press Enter three times.

    # Press 'W'

    $ mkfs.ext4 /dev/DEVICE(PARTNUMBER) #

    • slashsarc

      Thank you for posting this!

      I have finally gotten around to adding the fix.

  • eprinz

    Any experience creating this for RHEL 7?

Copyright © /sarc All Rights Reserved · Using modified version of Green Hope Theme by Sivan & schiy · Proudly powered by WordPress