KickStart CentOS7 ISO 파일 만들기

Jerry(이정훈)
3 min readJan 25, 2021

--

별 거 아니라고 생각했는데 의외로 2~3일 소요했던 CentOS7 설치 자동화 ISO w/ Kickstart 파일 만들기. isolinux.cfg 파일 및 ks.cfg(kickstart 파일) 수정하는게 어려웠다.

먼저 iso 파일 생성을 위한 Tool 설치(window WSL 환경, 윈도우 환경보다 속도도 빠르고 사용도 쉬웠다.)

[spkr@erdia22 21.Etc (dzb01:monitoring)]$ sudo apt-get -y install isomd5sum genisoimage

CentOS7 Download(나는 kubernetes 사용할거라 20년 09월 minimal version 이용)

mkdir /tmp/bootiso
mount -o loop CentOS-7-x86_64-Minimal-2009.iso /tmp/bootiso

iso 파일 수정을 위한 작업 용 디렉토리 생성

mkdir /tmp/bootcustom
cp -r /tmp/bootiso/* /tmp/bootcustom
umount /tmp/bootiso && rmdir /tmp/bootiso
chmod -R u+w /tmp/bootcustom

이제 만들어 둔 .ks script copy

cp /path/to/yourks.cfg /tmp/bootcustom/isolinux/ks.cfg

이제 중요한 isolinux.cfg 파일 수정 (이거 찾느라 오래 걸렸다. 별 거 아닌 것 같은데) 원본에서 단순히 ks=cdrom:/ks.cfg 추가되었다.

sed -i ‘s/append\ initrd\=initrd.img/append initrd=initrd.img\ ks\=cdrom:\/ks.cfg/’ /tmp/bootcustom/isolinux/isolinux.cfg

ISO File 만들기

cd /tmp/bootisoks && \
mkisofs -o /tmp/boot.iso -b isolinux.bin -c boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -V “CentOS 7 x86_64” -R -J -v -T isolinux/. .
implantisomd5 /tmp/boot.iso

이제 USB를 이용해서 부팅하면 아래와 유사한 화면으로 자동으로 설치된다.

사용한 KickStart file

참조

--

--

Jerry(이정훈)
Jerry(이정훈)

Written by Jerry(이정훈)

DevOps/Automation Engineer 60살까지 콘솔 잡는 엔지니어를 목표로 느리게 생각하고 있습니다.

No responses yet