yum -y install createrepo mkisofs anaconda-runtime yum -y install rsync
mkdir /yousm/CentOS6.2 #建立鏡像目錄 mount /dev/cdrom /mnt #掛載現有的安裝系統盤 /usr/bin/rsync -a --exclude=Packages/--exclude=repodata/ /mnt/ /yousm/CentOS6.2 #同步鏡像的基本文件(rsync能夠複製隱藏文件) mkdir /yousm/CentOS6.2/Packages mkdir /yousm/CentOS6.2/repodata
獲取系統須要的安裝包 linux
awk '/Installing/{print $2}' install.log|sed 's/^[0-9]*://g' >/root/packages.list #將系統的安裝包寫入packages.list for fileRpm in `cat packages.list`; do cp –r /mnt/Packages/$fileRpm*/yousm/CentOS6.2 /Packages ; done #複製系統安裝包
cp /mnt/repodata/*-minimal-i386.xml /yousm/CentOS6.2/repodata/minimal-i386.xml cd /yousm/CentOS6.2 createrepo -g repodata/minimal-i386.xml ./ declare -x discinfo=`head -1 .discinfo` createrepo -u"media://$discinfo" -grepodata/ebdb6ed3f5842c0d6445a25f41e51d724f5768798d417e6353ff6a4a6ae52024-minimal-i386.xml.
cp isolinux.cfg /yousm/CentOS6.2/isolinux/ mkdir /yousm/CenytOS6.2/ks cp ks.cfg /yousm/CentOS6.2/ks/ ks.cfg文件見附件
封裝iso鏡像和md5校驗
bash
mkisofs -o CentOS-6.2_X86.iso -bisolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4-boot-info-table -R -J -v -T /yousm/CentOS6.2/ /usr/bin/implantisomd5./CentOS-6.2_X86.iso