Kickstart 를 통해 OS 자동 설치를 할 수 있게 구성하고 Custom ISO 이미지를 만듬
- 준비물
- Rocky-8.8-x86_64-minimal.iso
- 빌드환경
- VMWare ESXi 6.7 U3
- VM Spec : 2 vCPU, 4G RAM, 32G Disk
- 빌드 서버 설치
- Rocky-8.8-x86_64-minimal.iso 를 이용하여 VM 설치
- 설치 완료 후 재부팅
- 시스템 세팅
- selinux disabled
- firewalld disable
- Network 셋업
- reboot
- 필요 패키지 설치
- # yum install -y wget vim-enhanced rsync nfs-utils mkisofs
- # mv -f ~/.vimrc ~/.vimrc_bak; wget https://mapoo.net/downfiles/Linux/vimrc -O ~/.vimrc --no-check-certificate
- 빌드 환경 구성
- iso 복사
- VMWare ESXi에서 빌드 VM의 CD-ROM에 Rocky-8.8-x86_64-minimal.iso 파일 Insert
- # mount /dev/sr0 /mnt
- # mkdir /rocky88-isos
- # rsync -avr /mnt/ /rocky88-isos/
- 설정 파일 작성
- Legacy 용
# vim /rocky88-isos/isolinux/isolinux.cfg
label ks-legacy
menu label ^Kickstart Install Rocky Linux 8.8
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=Rocky-8-8-x86_64-dvd quiet inst.ks=cdrom:/ks.cfg - EFI 용
# vim /rocky88-isos/EFI/BOOT/grub.cfg
menuentry 'EFI Kickstart Install Rocky Linux 8.8' --class fedora --class gnu-linux --class gnu --class os {
linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=Rocky-8-8-x86_64-dvd quiet inst.ks=cdrom:/ks.cfg
initrdefi /images/pxeboot/initrd.img
} - kickstart 파일
# vim /rocky88-isos/ks.cfg
# RHEL8
# System authorization information
auth --enableshadow --passalgo=sha512# Create additional repo during installation
#repo --name="AppStream" --baseurl=file:///run/install/repo/AppStream
#repo --name="BaseOS" --baseurl=file:///run/install/repo/BaseOSlang en_US.UTF-8
keyboard --vckeymap=us --xlayouts='us'
timezone Asia/Seoul --nontp
rootpw $2b$10$Fz8/4UpcwEJVDahKsHGAj.t7DAGqrOPxGvfhEYfm5Ezt7YVW8I8JO --iscrypted ### PW : root123 ####harddrive --partition=/dev/sdb --dir=/
#harddrive --partition=/dev/disk/by-label/RHEL8 --dir=/
cdrom
graphical
#bootloader --location=mbr --driveorder=sda --append="crashkernel=auto"
ignoredisk --only-use=sda
zerombr# Disk partitioning information
#part pv.116 --fstype="lvmpv" --ondisk=sdb --size=1 --grow
#part /boot/efi --fstype="efi" --size=512 --fsoptions="defaults,uid=0,gid=0,umask=0077,shortname=winnt"
#part /boot --fstype="xfs" --size=2048
#part pv.110 --fstype="lvmpv" --ondisk=sda --size=1 --grow
#volgroup vg_backup --pesize=4096 pv.116
#volgroup vg_local --pesize=4096 pv.110
#logvol / --fstype="xfs" --size=8000 --name=lv_root --vgname=vg_local
#logvol /tmp --fstype="xfs" --size=512 --name=lv_tmp --vgname=vg_local
#logvol /var --fstype="xfs" --size=1024 --name=lv_var --vgname=vg_local
#logvol /home --fstype="xfs" --size=2048 --name=lv_home --vgname=vg_local
#logvol /var/crash --fstype="xfs" --size=512 --name=lv_crash --vgname=vg_local
#logvol swap --fstype="swap" --size=512 --name=lv_swap --vgname=vg_localclearpart --all --drives=sda
part /boot/efi --fstype="efi" --onpart=sda1
part /boot --fstype="xfs" --label=boot --onpart=sda2
#part prepboot --fstype="prepboot" --onpart=sda3
#part biosboot --fstype="biosboot" --onpart=sda4
part / --size=15000 --fstype="xfs" --mkfsoptions "-m bigtime=0,inobtcount=0" --grow --onpart=sda3firewall --disabled
firstboot --disable
selinux --disabled# Network informationnetwork --hostname=DBTYPE1-4-5-6# Create user
user --name=spadmin --shell=/bin/bash --homedir=/home/spadmin --uid=1100 --gid=100 --iscrypted --password=$6$REVMaU.lNP758WJn$zQuS0eJpbFFMFZTnLkd/rQSPUcGlmkrdhADchUKibgGNe6mHXh0vk/t4yqnY7oia.QR0UcCIzuiuM0uqwBKOf0
user --name=oracle --shell=/bin/bash --homedir=/home/oracle --uid=1000 --gid=1002 --iscrypted --password=$6$zvTPtyL9fRXiCsEA$Tj2j7vYZXm3LGKrnHeNwcYvXtAmr8f27oNfm/h0OvZVOmfxCj4bxPJPHCkNpSQu858jaqyPL8tWu4Ns6vffc71
user --name=oragrid --shell=/bin/bash --homedir=/home/oragrid --uid=1001 --gid=1002 --iscrypted --password=$6$zvTPtyL9fRXiCsEA$Tj2j7vYZXm3LGKrnHeNwcYvXtAmr8f27oNfm/h0OvZVOmfxCj4bxPJPHCkNpSQu858jaqyPL8tWu4Ns6vffc71%packages
@^minimal-environment
%end%addon com_redhat_kdump --enable --reserve-mb='auto'%end
%anaconda
pwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty
pwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok
pwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty
%end%post --nochroot --log=/mnt/sysimage/root/ks-post.log
echo "spadmin ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
(
echo
#make deploy dir
mkdir -p /mnt/sysimage/root/admin# copy eus_update package
#cp -a /run/install/isodir/update.tar /mnt/sysimage/root/admin/
#tar xvf /mnt/sysimage/root/admin/update.tar -C /mnt/sysimage/root/admin/
#cp -a /run/install/isodir/script.tar /mnt/sysimage/root/admin/
#tar xvf /mnt/sysimage/root/admin/script.tar -C /mnt/sysimage/root/admin/
#) >> /mnt/sysimage/root/postnochroot
%end%post --log=/var/log/kickstart_post.log
# yum - by dvd
cat > /etc/yum.repos.d/rhel86.repo << EOF
[RHEL86-BaseOS]
name=RHEL86-BaseOS
baseurl=http://_REPOSERVER_/RHEL86/BaseOS
enabled=0
gpgcheck=0[RHEL86-AppStream]
name=RHEL86-AppStream
baseurl=http://_REPOSERVER_/RHEL86/AppStream
enabled=0
gpgcheck=0
EOF# yum - add update pkg
cat > /etc/yum.repos.d/update.repo << EOF
[RHEL86-update]
name=RHEL86-update
baseurl=file:///root/admin/update
enabled=1
gpgcheck=0
EOF# package_update
yum clean all
#yum repolist --disablerepo="*" --enablerepo="RHEL86-update"#yum -y install --disablerepo="*" --enablerepo="RHEL86-update" gnutls-3.6.16-5.el8_6.x86_64 device-mapper-multipath-0.8.4-22.el8_6.2.x86_64 krb5-libs-1.18.2-22.el8_7.x86_64 sudo-1.8.29-8.el8_7.1.x86_64 openssl-1.1.1k-9.el8_7.x86_64 kernel-4.18.0-425.13.1.el8_7.x86_64
#sleep 2
#yum -y localinstall --disablerepo="*" --enablerepo="RHEL86-update" /root/admin/update/javapackages-filesystem-5.3.0-1.module+el8+2447+6f56d9a6.noarch.rpm#sleep 2
#yum -y install --disablerepo="*" --enablerepo="RHEL86-update" java-1.8.0-openjdk-devel-1.8.0.262.b10-0.el8_2.x86_64sleep 2
#yum -y install --disablerepo="*" --enablerepo="RHEL86-update" bc binutils elfutils-libelf elfutils-libelf-devel fontconfig-devel glibc glibc-devel \
#ksh libaio libaio-devel libXrender libX11 libXau libXi libXtst libgcc libnsl librdmacm libstdc++ libstdc++-devel libxcb libibverbs make \
#policycoreutils policycoreutils-python-utils smartmontools sysstat xorg-x11-utils ncurses-devel ncurses gcc kmod-redhat-oracleasm-2.0.8-12.2.el8.x86_64 xorg-x11-xauth xtermsleep 2
#yum -y install --disablerepo="*" --enablerepo="RHEL86-update" xsosrm -f /root/admin/update.tar
%end
- Legacy 용
- iso 복사
- custom iso 빌드
- # mount -tnfs 192.168.0.250:/data0/mapoo/mapoo7/nfs-share /nfs-share
(ESXi의 데이터스토어 중 일부임. custom-iso를 이용하여 테스트 vm 설치 시 해당 iso를 cd-rom에 넣고 설치 진행) - # mkisofs -o /nfs-share/_ISO/Linux/rocky88-custom.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 -joliet-long -V "Rocky-8-8-x86_64-dvd" .
- 주의할 점은 isolinux.cfg 와 grub.cfg 내의 설정에서 LABEL명과 mkisofs 의 -V 옵션에 붙는 파라메터 값이 동일해야 한다.
- # mount -tnfs 192.168.0.250:/data0/mapoo/mapoo7/nfs-share /nfs-share
- 설치 테스트
- ESXi에 적당한 스펙의 새로운 VM 생성
- CD-ROM에 rocky88-custom.iso 넣고 VM 부팅
- Legacy / EFI에 따라 grub 로딩이 다르게 됨. 메뉴에서 Kickstart Install 선택.
- 자동으로 설치가 진행된다.