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 워크로드를 실행할 수 있도록 지원하는 플랫폼 업데이트

open hybrid cloud icon

오픈 하이브리드 클라우드

하이브리드 클라우드로 더욱 유연한 미래를 구축하는 방법을 알아보세요

security icon

보안

환경과 기술 전반에 걸쳐 리스크를 감소하는 방법에 대한 최신 정보

edge icon

엣지 컴퓨팅

엣지에서의 운영을 단순화하는 플랫폼 업데이트

Infrastructure icon

인프라

세계적으로 인정받은 기업용 Linux 플랫폼에 대한 최신 정보

application development icon

애플리케이션

복잡한 애플리케이션에 대한 솔루션 더 보기

Virtualization icon

가상화

온프레미스와 클라우드 환경에서 워크로드를 유연하게 운영하기 위한 엔터프라이즈 가상화의 미래