フィードを購読する
Linux 

Editor's note: Modifying Red Hat Enterprise Linux installation media is not a supported process, but this handy workaround may be useful to you. Please see this solution on the Red Hat Customer Portal for more information and other options that you may wish to consider for your environment.

Not everyone has high-speed network connections to locations where they need to install Red Hat Enterprise Linux (RHEL). Customers often ask how they can reduce the installation media to make delivery over slower networks faster. I walk you through the steps to build a custom, small RHEL installation ISO. The default RHEL 7.8 ISO is over 4GB in size; these steps show you how to create a RHEL 7.8 ISO that is 1GB in size and supports a smaller RHEL installation.

Step 1: Build a RHEL 7.8 system with the desired package set

Use any installation method to install/configure RHEL 7.8 to the desired state. I built one with the “minimum” package option using the graphical installer. After rebooting, create a list of all installed RPM packages so you can use that list as the source to build a customized smaller ISO. This source list of RPMs ensures our new smaller ISO has only the packages needed to install, thus reducing the overall size of the ISO required for installation.

The build RPM list is used as the source of the package list in Step 2:

# rpm -qa > rpmlist.txt

Copy rpmlist.txt to your ISO build system directory in Step 2.

Step 2: Build a small ISO

The following instructions build the small ISO directory structure, copy contents from the RPM list provided in Step 1, and then generate a small ISO file to be used for installation.

1. Download the RHEL7.8 Binary ISO:

https://access.redhat.com/downloads/content/69/ver=/rhel---7/7.8/x86_64/product-software

2. Loop mount it so we can copy its contents to a location to manipulate:

# mkdir /mnt/rhel7.8-master
# mount -o loop rhel-server-7.8-x86_64-dvd.iso /mnt/rhel7.8-master

3. Create a working directory structure and copy the master ISO contents:

# mkdir /mnt/rhel7.8-small
# cp -aR /mnt/rhel7.8-master/* /mnt/rhel7.8-small/

4. Remove all existing packages:

# chmod u+w /mnt/rhel7.8-small/Packages
# rm -rf /mnt/rhel7.8-small/Packages/*

5. Remove all add-ons (optional):

# chmod -R u+w /mnt/rhel7.8-small/addons
# rm -rf /mnt/rhel7.8-small/addons/*

6. Copy the RPM list from the RPM list text file generated from Step 1 to /mnt/rhel7.8-small/Packages/:

# for i in `cat rpmlist.txt`; do cp /mnt/rhel7.8-master/Packages/$i* /mnt/rhel7.8-small/Packages/; done

7. Make the ISO:

Install the following ISO tooling:

# yum install genisoimage isomd5sum syslinux

# chmod -R u+w /mnt/rhel7.8-small/isolinux

# cd /mnt/rhel7.8-small

# mkisofs -o ../rhel7small.iso -b isolinux/isolinux.bin -J -R -l -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e images/efiboot.img -no-emul-boot -graft-points -V "RHEL-7.8 Server.x86_64"  -jcharset utf-8 .

8. Implant an MD5 sum into the ISO:

# implantisomd5 rhel7small.iso

9. Convert the ISO image to be compatible for a USB boot image:

# isohybrid -uefi rhel7small.iso

Step 3: Update ISO with latest RPMs from Satellite 6 Content View

If you have Satellite 6, you can use the yumdownloader utility to download updated content from a Satellite Content View. This generates a small ISO updated with the latest content, which alleviates the need to immediately patch your system after deployment.

Install yumdownloader, download the updated content, and create a new updated small ISO.

1. Install the yum-utils plugin:

# yum install yum-utils

2. Download the latest RPMs from Satellite 6 Content View. This assumes the system is currently registered and subscribed to an updated Content View in Satellite 6:

# mkdir /mnt/downloads

# cd /mnt/downloads

Use the RPM list created in Step 1 as a source in a for-loop to download only the x86_64 architecture packages, and ensure you exclude any i686 packages:

# for i in `cat rpmlist.txt | sed -e 's/\([^.]*\).*/\1/' -e 's/\(.*\)-.*/\1/'`;do yumdownloader -x *i686 --archlist=x86_64 $i; done

3. Copy the updated RPMs to the Packages directory structure, then recreate the RPM metadata:

# chmod -R u+w /mnt/rhel7.8-small/Packages

# rm -rf /mnt/rhel7.8-small/Packages

# cp /mnt/downloads/* /mnt/rhel7.8-small/Packages

# cd /mnt/rhel7.8-small

# chmod -R u+w /mnt/rhel7.8-small/repodata

# createrepo -g repodata/*comps*.xml . --update

4. Make the updated ISO:

# cd /mnt/rhel7.8-small

# mkisofs -o ../rhel7small-updated.iso -b isolinux/isolinux.bin -J -R -l -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -eltorito-alt-boot -e images/efiboot.img -no-emul-boot -graft-points -V "RHEL-7.8 Server.x86_64" -jcharset utf-8 .

5. Implant an MD5 sum into the ISO:

# implantisomd5 rhel7small.iso

6. Convert the ISO image to be compatible as a USB boot image:

# isohybrid -uefi rhel7small-updated.iso

Wrap up

In summary, by reducing the number of packages to only those required for the desired installation, one can significantly shrink the size of the installation media ISO file. This size reduction can enable faster deployment or staging times when dealing with slow network connection speeds.

[ Free online course: Red Hat Enterprise Linux technical overview. ]


執筆者紹介

UI_Icon-Red_Hat-Close-A-Black-RGB

チャンネル別に見る

automation icon

自動化

テクノロジー、チームおよび環境に関する IT 自動化の最新情報

AI icon

AI (人工知能)

お客様が AI ワークロードをどこでも自由に実行することを可能にするプラットフォームについてのアップデート

open hybrid cloud icon

オープン・ハイブリッドクラウド

ハイブリッドクラウドで柔軟に未来を築く方法をご確認ください。

security icon

セキュリティ

環境やテクノロジー全体に及ぶリスクを軽減する方法に関する最新情報

edge icon

エッジコンピューティング

エッジでの運用を単純化するプラットフォームのアップデート

Infrastructure icon

インフラストラクチャ

世界有数のエンタープライズ向け Linux プラットフォームの最新情報

application development icon

アプリケーション

アプリケーションの最も困難な課題に対する Red Hat ソリューションの詳細

Original series icon

オリジナル番組

エンタープライズ向けテクノロジーのメーカーやリーダーによるストーリー