Ricerca

Questo contenuto non è disponibile nella lingua selezionata.

2. Working with ISO Images

download PDF
This section will explain how to extract an ISO image provided by Red Hat, and how to create a new boot image containing changes you made following other procedures in this book.

2.1. Extracting Red Hat Enterprise Linux Boot Images

Before you start customizing the installer, you must download Red Hat-provided boot images. These images will be required to perform all procedures described in this book.
You can obtain Red Hat Enterprise Linux 7 boot media from the Red Hat Customer Portal after logging in to your account. Your account must have sufficient entitlements to download Red Hat Enterprise Linux 7 images.
Download either the Binary DVD or Boot ISO image from the Customer Portal. Either of these can be modified using procedures in this guide; other available downloads, such as the KVM Guest Image or Supplementary DVD can not. The variant of the image (such as Server or ComputeNode) does not matter in this case; any variant can be used.
For detailed download instructions and description of the Binary DVD and Boot ISO downloads, see the Red Hat Enterprise Linux 7 Installation Guide.
After your chosen iso image finishes downloading, follow the procedure below to extract its contents in order to prepare for their modification.

Procedure 1. Extracting ISO Images

  1. Mount the downloaded image.
    # mount -t iso9660 -o loop path/to/image.iso /mnt/iso
    Replace path/to/image.iso with the path to the downloaded ISO. Also make sure that the target directory (/mnt/iso) exists and nothing else is currently mounted there.
  2. Create a working directory - a directory where you want to place the contents of the ISO image.
    $ mkdir /tmp/ISO
  3. Copy all contents of the mounted image to your new working directory. Make sure to use the -p option to preserve file and directory permissions and ownership.
    # cp -pRf /mnt/iso /tmp/ISO
  4. Unmount the image.
    # umount /mnt/iso
After you finish unpacking, the ISO image is extracted in your /tmp/ISO where you can modify its contents. Continue with Section 3, “Customizing the Boot Menu” or Section 5, “Developing Installer Add-ons”. Once you finish making changes, create a new, modified ISO image using the instructions in Section 2.3, “Creating Custom Boot Images”.

2.2. Creating a product.img File

A product.img image file is an archive containing files which replace existing files or add new ones in the installer runtime. During boot, Anaconda loads this file from the images/ directory on the boot media. Then, it uses files present inside this file to replace identically named files in the installer's file system; this is necessary to customize the installer (for example, for replacing default images with custom ones). The product.img image must contain a directory structure identical to the installer.
Specifically, two topics discussed in this guide require you to create a product image. The table below lists the correct locations inside the image file directory structure:
Table 1. Locations of Add-ons and Anaconda Visuals
Type of custom content File system location
Pixmaps (logo, side bar, top bar, etc.) /usr/share/anaconda/pixmaps/
Banners for the installation progress screen /usr/share/anaconda/pixmaps/rnotes/en/
GUI stylesheet /usr/share/anaconda/anaconda-gtk.css
Installclasses (for changing the product name) /run/install/product/pyanaconda/installclasses/
Anaconda add-ons /usr/share/anaconda/addons/
The procedure below explains how to create a valid product.img file.

Procedure 2. Creating product.img

  1. Navigate to a working directory such as /tmp, and create a subdirectory named product/:
    $ cd /tmp
    $ mkdir product/
  2. Create a directory structure which is identical to the location of the file you want to replace. For example, if you want to test an add-on, which belongs in the /usr/share/anaconda/addons directory on the installation system; create the same structure in your working directory:
    $ mkdir -p product/usr/share/anaconda/addons

    Note

    You can browse the installer's runtime file system by booting the installation, switching to virtual console 1 (Ctrl+Alt+F1) and then switching to the second tmux window (Ctrl+b 2). This opens a shell prompt which you can use to browse the file system.
  3. Place your customized files (in this example, custom add-on for Anaconda) into the newly created directory:
    $ cp -r ~/path/to/custom/addon/ product/usr/share/anaconda/addons/
  4. Repeat the two steps above (create a directory structure and move modified files into it) for every file you want to add to the installer.
  5. Create a .buildstamp file in the root of the directory which will become the product.img file. The .buildstamp file describes the system version and several other parameters. The following is an example of a .buildstamp file from Red Hat Enterprise Linux 7.4:
    [Main]
    Product=Red Hat Enterprise Linux
    Version=7.4
    BugURL=https://bugzilla.redhat.com/
    IsFinal=True
    UUID=201707110057.x86_64
    [Compose]
    Lorax=19.6.92-1
    
    Note the IsFinal parameter, which specifies whether the image is for a release (GA) version of the product (True), or a pre-release such as Alpha, Beta, or an internal milestone (False).
  6. Change into the product/ directory, and create the product.img archive:
    $ cd product
    $ find . | cpio -c -o | gzip -9cv > ../product.img
    This creates a product.img file one level above the product/ directory.
  7. Move the product.img file to the images/ directory of the extracted ISO image.
After finishing this procedure, your customizations are placed in the correct directory. You can continue with Section 2.3, “Creating Custom Boot Images” to create a new bootable ISO image with your changes included. The product.img file will be automatically loaded when starting the installer.

Note

Instead of adding the product.img file on the boot media, you can place this file into a different location and use the inst.updates= boot option at the boot menu to load it. In that case, the image file can have any name, and it can be placed in any location (USB flash drive, hard disk, HTTP, FTP or NFS server), as long as this location is reachable from the installation system.
See the Red Hat Enterprise Linux 7 Installation Guide for more information about Anaconda boot options.

2.3. Creating Custom Boot Images

When you finish customizing boot images provided by Red Hat, you must create a new image which includes changes you made. To do this, follow the procedure below.

Procedure 3. Creating ISO Images

  1. Make sure that all of your changes are included in the working directory. For example, if you are testing an add-on, make sure to place the product.img in the images/ directory.
  2. Make sure your current working directory is the top-level directory of the extracted ISO image - e.g. /tmp/ISO/iso.
  3. Create the new ISO image using genisoimage:
    # genisoimage -U -r -v -T -J -joliet-long -V "RHEL-7.1 Server.x86_64" -volset "RHEL-7.1 Server.x86_64" -A "RHEL-7.1 Server.x86_64" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e images/efiboot.img -no-emul-boot -o ../NEWISO.iso .
    In the above example:
    • Make sure that values for the -V, -volset, and -A options match the image's boot loader configuration, if you are using the LABEL= directive for options which require a location to load a file on the same disk. If your boot loader configuration (isolinux/isolinux.cfg for BIOS and EFI/BOOT/grub.cfg for UEFI) uses the inst.stage2=LABEL=disk_label stanza to load the second stage of the installer from the same disk, then the disk labels must match.

      Important

      In boot loader configuration files, replace all spaces in disk labels with \x20. For example, if you create an ISO image with a label of RHEL 7.1, boot loader configuration should use RHEL\x207.1 to refer to this label.
    • Replace the value of the -o option (-o ../NEWISO.iso) with the file name of your new image. The value in the example will create file NEWISO.iso in the directory above the current one.
    For more information about this command, see the genisoimage(1) man page.
  4. Implant an MD5 checksum into the image. Without performing this step, image verification check (the rd.live.check option in the boot loader configuration) will fail and you will not be able to continue with the installation.
    # implantisomd5 ../NEWISO.iso
    In the above example, replace ../NEWISO.iso with the file name and location of the ISO image you have created in the previous step.
After finishing this procedure, you can write the new ISO image to physical media or a network server to boot it on physical hardware, or you can use it to start installing a virtual machine. See the Red Hat Enterprise Linux 7 Installation Guide for instructions on preparing boot media or network server, and the Red Hat Enterprise Linux 7 Virtualization Getting Started Guide for instructions on creating virtual machines with ISO images.
Red Hat logoGithubRedditYoutubeTwitter

Formazione

Prova, acquista e vendi

Community

Informazioni sulla documentazione di Red Hat

Aiutiamo gli utenti Red Hat a innovarsi e raggiungere i propri obiettivi con i nostri prodotti e servizi grazie a contenuti di cui possono fidarsi.

Rendiamo l’open source più inclusivo

Red Hat si impegna a sostituire il linguaggio problematico nel codice, nella documentazione e nelle proprietà web. Per maggiori dettagli, visita ilBlog di Red Hat.

Informazioni su Red Hat

Forniamo soluzioni consolidate che rendono più semplice per le aziende lavorare su piattaforme e ambienti diversi, dal datacenter centrale all'edge della rete.

© 2024 Red Hat, Inc.