RHEL/CentOS 에서 mkisofs 로 Booting ISO 만들기 (KickStart 파일 포함)
개요
CentOS 설치 ISO 등에 파일을 추가/삭제하기 하는 방법. KickStart 로 자동설치 DVD 를 만들려면 거쳐야 하는 절차임
사전작업
- ISO 파일 다운로드 (CDNetworks, NiceHosting 등)
- ISO 를 Mount 할 폴더 생성
- mkdir iso
- ISO file mount
- mount -o loop CentOS-6.4-x86_64-minimal.iso iso
생성
- 새로운 ISO 및 kickstart 폴더 생성
- mkdir new_iso
- 파일 및 폴더 복사
- cp -a iso/* new_iso/
KickStart 파일이 있을 경우 설정( 해당 파일을 new_iso 에 복사)
my-ks.cfg 가 kickstart 이고 해당 파일을 new_iso/ks 에 복사한다고 가정
kickstart 복사
## KickStart 파일 폴더 mkdir new_iso/ks ## kickstart 복사 cp my-ks.cfg new_iso/ks/ ## booting 할때 kickstart 를 찾게 option 변경하고 저장 vi new_iso/isolinux/isolinux.cfg
BASHlabel linux 항목의 append initrd=initrd.img 를 찾아서 뒤에 ks=cdrom:/ks/my-ks.cfg 추가
isolinux/isolinux.cfg
label linux menu label ^Install or upgrade an existing system menu default kernel vmlinuz append initrd=initrd.img ks=cdrom:/ks/my-ks.cfg
CODEkickstart에 설정된 root 암호는 qwert123 임my-ks.cfg
# Kickstart file automatically generated by anaconda. install #cdrom # 설치 이미지를 잘못 만들었는지 KickStart 로 설치시 cdrom 을 설치 미디어로 지정하면 disk not found 에러 발생하여 url 로 설치방식을 지정해야 함 url --url=http://centos.mirror.cdnetworks.com/6.5/os/x86_64/ # Disable anything graphical skipx text lang ko_KR.UTF-8 keyboard us rootpw --iscrypted $6$H2qg.cYZDbQqZM3y$JKCjG2ceHTEi5QwrstNbrBq47saNvhXqlMePJw6FBojD3U67dox0xBCO.cMCiIKAS8fB5IeFaWKDPN2xP2iLW. firewall --service=ssh --service=http --port=443:tcp authconfig --enableshadow --passalgo=sha512 selinux --enforcing timezone --utc Asia/Seoul # Services running at boot services --enabled network,sshd,httpd ##network --bootproto=static --ip=192.168.100.201 --netmask=255.255.255.0 --gateway=192.168.100.2 --nameserver 192.168.100.2 network --device=bond0 --noipv6 --bootproto=static --onboot=yes --ip=10.0.2.100 --gateway=10.0.2.2 --nameserver=10.0.2.2,203.242.200.5 --netmask=255.255.255.0 --bondslaves=eth0,eth1 --bondopts=mode=active-backup,primary=eth0,miimon=80,updelay=60000 # bond slave network --device=eth0 --noipv6 --nodns --bootproto=static --onboot=yes # bond slave network --device=eth1 --noipv6 --nodns --bootproto=static --onboot=yes bootloader --location=mbr --driveorder=sda --append="crashkernel=auto rhgb quiet" # The following is the partition information you requested # Note that any partitions you deleted are not expressed # here so unless you clear all partitions first, this is # not guaranteed to work ## --initlabel Initializes the disk label to the default for your architecture (for example msdos for x86 and gpt for Itanium). It is useful so that the installation program does not ask if it should initialize the disk label if installing to a brand new hard drive. clearpart --initlabel --all --drives=sda part /boot --fstype=ext4 --size=500 part pv.008002 --grow --size=1 volgroup vg_linux --pesize=4096 pv.008002 logvol / --fstype=ext4 --name=lv_root --vgname=vg_linux --grow --size=1024 logvol /var --fstype ext4 --name=lv_var --vgname=vg_linux --grow --size=2048 logvol swap --name=lv_swap --vgname=vg_linux --grow --size=4000 --maxsize=1000 %packages @base bind-utils wget elinks vim yum-utils sysstat policycoreutils-python setools-console man man-pages httpd mod_ssl git %end %post --log=/root/ks-post.log yum update --skip-broken -y ### create /etc/skel/.bash_profile cat <<_EOF_ > /etc/skel/.bash_profile # .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs export EDITOR=vim export TERM=linux export PS1="\[\e[36;1m\]\u@\[\e[32;1m\]\h:\[\e[31;1m\]\w:> \[\e[0m\]" ; alias vi='vim $*' alias apache='cd /etc/httpd' alias wget='wget --no-check-certificate $*' export LANG=ko_KR.UTF-8 export LC_MESSAGES=en_US _EOF_ ## copy customized profile to root dir cp /etc/skel/.bash_profile /root/ ## forcing syntax coloring for apache config ## http://lesstif.com/x/koBq sed -i "s/BufRead[ \t]\+httpd.conf\*,/BufRead httpd.conf\*,\/etc\/httpd\/conf\/\*,/g" /usr/share/vim/vim72/filetype.vim ## User Add %end reboot
BASH- 기존 폴더 umount
- umount iso
Boot ISO 만들기
- mkisofs -o ./custom-centos-boot.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -J -l -r -T -v -V "Custom CentOS Boot" new_iso/
mkisofs 가 없다고 나오면 yum install genisoimage -y 명령어 실행