• UEFI는 통합 확장 펌웨어 인터페이스(Unified Extensible Firmware Interface)의 줄임말
  • UEFI는 BIOS를 대체하기 위해 등장한 시스템으로 보안 부팅(Secure Booting)이 가능하며, BIOS에 비해서 더욱 큰 디스크 용량을 지원하고, 더욱 고급스러운 GUI를 제공함
  • 최근에 출시되는 컴퓨터 메인보드에는 기본적으로 UEFI가 탑재되어 출시
  • UEFI는 사용자 입장에서도 손쉽게 하드웨어를 조작할 수 있도록 해줌


기본 ISO 파일 다운

kickstart ISO 파일을 만들기 위한 기초 작업

  • kickstart 파일은 설치된 RHEL/CentOS의 /root 디렉토리에 있는 anaconda-ks.cfg란 파일을 이용하는 것이 가장 효율

  • OS를 설치할 때 설정한 시간대, 패키지, 네트워크, 디스크 파티션 등등의 내용이 모두 들어 있음

  • CDROM을 사용하여 킥스타트 설치를 실행 → 디스크의 최상위 디렉토리에 배치되어야 함

    $ pwd
    /root/kickstart_iso_file
    
    # os파일과 mount할 디렉토리 생성
    $ mkdir uefi_ios
    
    # 현재 /root/kickstart_iso_file 디렉토리 아래의 내용 확인
    $ ls
    uefi_iso  CentOS-7-x86_64-Minimal-2009.iso
    
    # centos7 iso 파일을 수정하기 위해 uefi_iso 디렉토리에 mount
    $ mount -o loop CentOS-7-x86_64-Minimal-2009.iso ueif_iso/
    mount: /dev/loop0 is write-protected, mounting read-only
    
    # loop 디바이스로 mount한 내용 확인
    $ df -h | grep loop
    /dev/loop0      973M  973M     0 100% /root/kickstart_iso_file/uefi_iso
    
    # mount한 기본 Centos7 내용 확인
    $ ls uefi_iso/
    CentOS_BuildTag  EULA  images    LiveOS    repodata              RPM-GPG-KEY-CentOS-Testing-7
    EFI              GPL   isolinux  Packages  RPM-GPG-KEY-CentOS-7  TRANS.TBL
    
    # 커스터마이징할 iso 이미지를 만들기 위한 디렉토리 생성 후 기본 Centos7 내용 복사
    $ mkdir kickstart_uefi_iso
    $ cp -a uefi_iso/. kickstart_uefi_iso/
    
    # kickstart ueif ISO 파일을 만들기 위한 기본 디렉토리 생성
    # cp 명령어 실행 후 반드시 확인 필요 → kickstart_uefi_iso 디렉토리 안에에 .discinfo, .treeinfo 파일이 정상적으로 복사 확인 必
    # 두 개의 파일이 없으면 CD-ROM 이미지가 없다는 메세지가 발생하면서 문제 생김
    $ ls -al kickstart_uefi_iso/
    total 116
    drwxr-xr-x 8 root root  4096 Nov  3  2020 .
    drwxr-xr-x 4 root root  4096 Nov  2 01:30 ..
    -rw-r--r-- 1 root root    14 Oct 30  2020 CentOS_BuildTag
    -rw-r--r-- 1 root root    29 Oct 27  2020 .discinfo
    drwxr-xr-x 3 root root  4096 Oct 27  2020 EFI
    -rw-rw-r-- 1 root root   227 Aug 30  2017 EULA
    -rw-rw-r-- 1 root root 18009 Dec 10  2015 GPL
    drwxr-xr-x 3 root root  4096 Oct 27  2020 images
    drwxr-xr-x 2 root root  4096 Nov  3  2020 isolinux
    drwxr-xr-x 2 root root  4096 Oct 27  2020 LiveOS
    drwxr-xr-x 2 root root 36864 Nov  3  2020 Packages
    drwxr-xr-x 2 root root  4096 Nov  3  2020 repodata
    -rw-rw-r-- 1 root root  1690 Dec 10  2015 RPM-GPG-KEY-CentOS-7
    -rw-rw-r-- 1 root root  1690 Dec 10  2015 RPM-GPG-KEY-CentOS-Testing-7
    -r--r--r-- 1 root root  2883 Nov  3  2020 TRANS.TBL
    -rw-r--r-- 1 root root   354 Oct 27  2020 .treeinfo
    
    # 리눅스에서 iso 파일을 만드는 패키지 설치
    $ yum install -y genisoimage

※ 루프 디바이스(loop device)

  • 파일을 실제 물리적으로 존재하는 블록 디바이스 처럼 접근 가능하도록 한 가상 장치


UEFI 버전 kickstart ISO 파일 생성

1. kickstart를 실행할 uefi_ks.cfg 파일 생성

  • uefi_ks.cfg는 OS 설치하면 생성되는 anaconda-ks.cfg 파일 내용을 변경해서 생성하면 됨

  • uefi_ks.cfg 파일의 위치는 kickstart_uefi_iso 디렉토리 바로 아래에 위치(kickstart_uefi_iso 디렉토리 최상단)

  • 비밀번호는 linux7890으로 임의 지정 → ISO 파일 만들면 초기 설정에서는 변경이 불가능(OS 재설치 후 변경하면 됨)

  • uefi의 경우 → fstype는 efi로 fstype으로 설정

    $ pwd
    /root/kickstart_iso_file
    
    $ vi kickstart_uefi_iso/uefi_ks.cfg
    #version=DEVEL
    # System authorization information
    auth --enableshadow --passalgo=sha512
    # CDROM
    install
    cdrom
    # Use graphical install
    graphical
    # Run the Setup Agent on first boot
    firstboot --enable
    ignoredisk --only-use=sda
    # Keyboard layouts
    keyboard --vckeymap=us --xlayouts='us'
    # System language
    lang en_US.UTF-8
    
    # Network information
    network  --hostname=localhost.localdomain
    
    # Root password
    rootpw --iscrypted $6$WuNr09tS$BqTZlg86ZAyWAxQ//HiH1LY1gPoHleiHuhLPrlvxy8pKAWv5J5xRKlP6BCVos/MvroIIbcQ7OQktD0I1y167E.
    # System services
    services --disabled="chronyd"
    # System timezone
    timezone Asia/Seoul --isUtc --nontp
    # System bootloader configuration
    bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=sda
    # Partition clearing information
    clearpart --all --initlabel --drives=sda
    # Disk partitioning information
    part /boot/efi --fstype="efi" --ondisk=sda --size=500
    part swap --fstype="swap" --ondisk=sda --size=32768
    part / --fstype="ext4" --ondisk=sda --grow
    
    %packages
    @^minimal
    @core
    kexec-tools
    
    %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
    
    #  kickstart_uefi_iso 디렉토리 아래에 kickstart를 실행할 uefi_ks.cfg가 있음을 확인(iso 파일을 만들 디렉토리 최상단에 존재해야함)
    $ ls kickstart_uefi_iso/
    CentOS_BuildTag  EFI  EULA  GPL  images  isolinux  LiveOS  Packages  repodata  RPM-GPG-KEY-CentOS-7  RPM-GPG-KEY-CentOS-Testing-7  TRANS.TBL  uefi_ks.cfg

2. 생성한 uefi_ks.cfg 파일 검증

  • ks.cfg 파일을 검증 → 미리 검증함으로써 iso 파일 만들기 전에 시간 낭비를 비할 수 있음

  • 검증을 했는데 아무 값도 출력되지 않으면 ks.cfg 파일이 정상이라는 의미 → 에러 발생시 수정 옵션 확인 필요

    $ pwd
    /root/kickstart_iso_file
    
    # anaconda_ks.cfg 파일의 문법적 오류 확인 -> 위에서 만들었기에 해당 내용은 통과.... 만약 설치 안했을 경우 설치 필요
    $ yum install -y pykickstart
    
    # 검증 -> 출력 결과가 없어야 OK
    $ ksvalidator kickstart_uefi_iso/uefi_ks.cfg

3. OS 설치 할 때 기본 설정 BOOT MODE가 UEFI인 경우 uefi_ks.cfg 파일 설정을 적용 → grub.cfg 파일 변경

  • kickstart_uefi_iso//EFI/BOOT/grub.cfg 파일 내용 변경 혹은 추가 필요

  • ks=cdrom:/uefi_ks.cfg의 kickstart 파일을 읽음

  • grub.cfg는 UEFI가 OS 설치할 때 실행되는 화면

    $ pwd
    /root/kickstart_iso_file
    
    $ vi kickstart_uefi_iso/EFI/BOOT/grub.cfg
    set default="1"
    [..중략...]
    ### BEGIN /etc/grub.d/10_linux ###
    menuentry 'Install CentOS 7' --class fedora --class gnu-linux --class gnu --class os {
      linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 quiet
      initrdefi /images/pxeboot/initrd.img
    }
    menuentry 'Kickstart UEFI INSTALLATION by CDROM' --class fedora --class gnu-linux --class gnu --class os {
          linuxefi /images/pxeboot/vmlinuz ks=hd:cdrom:/uefi_ks.cfg
          initrdefi /images/pxeboot/initrd.img
    }
    menuentry 'Test this media & install CentOS 7' --class fedora --class gnu-linux --class gnu --class os {
          linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 rd.live.check quiet
          initrdefi /images/pxeboot/initrd.img
    }
    submenu 'Troubleshooting -->' {
          menuentry 'Install CentOS 7 in basic graphics mode' --class fedora --class gnu-linux --class gnu --class os {
                  linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 xdriver=vesa nomodeset quiet
                  initrdefi /images/pxeboot/initrd.img
          }
          menuentry 'Rescue a CentOS system' --class fedora --class gnu-linux --class gnu --class os {
                  linuxefi /images/pxeboot/vmlinuz inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 rescue quiet
                  initrdefi /images/pxeboot/initrd.img
          }
    }

4. ustom iso 이미지 만들기

  • kickstart_uefi_iso/ 디렉토리를 Centos7-Kickstart-Uefi-Install.iso 이름의 iso파일로 생성

  • 완료되면 Centos7-Kickstart-Uefi-Install.iso를 다운 받아서 사용하면 됨

    $ pwd
    /root/kickstart_iso_file
    
    $ mkisofs -r -T -J -V "Centos 7 Custom CD" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -e images/efiboot.img   -boot-load-size 4 -boot-info-table -o ./Centos7-Kickstart-Uefi-Install.iso kickstart_uefi_iso/
    [..중략...]
    Total translation table size: 124656
    Total rockridge attributes bytes: 55185
    Total directory bytes: 92160
    Path table size(bytes): 140
    Max brk space used a1000
    528246 extents written (1031 MB)
    
    $ ls
    bios_iso  Centos7-Kickstart-Uefi-Install.iso  kickstart_bios_iso  kickstart_uefi_iso

+ Recent posts