第三步:在根目录下编辑一个脚本并且执行它....
#/bin/bash
FILE='/root/packet.txt'
DEST_DIR='/root/iso/CentOS'
SRC_DIR='/media/cdrom/CentOS'
while read LINE
do
cp $SRC_DIR/$LINE.rpm $DEST_DIR || echo "$LINE didn't let you cp ...">> cperr.txt
done < $FILE
此脚本的意思是读取FILE中的每一行,然后在SRC_DIR中提取出这个软件包将其拷贝到DEST_DIR中....
第四步:拷贝/media/cdrom中的文件到/root/iso中去
#cd /media/cdrom
#cp -r .discinfo .treeinfo images/ isolinux/ repodata/ RPM-GPG-
KEG-CentOS-5 EULA GPL /root/iso/
第五步:编辑iso/isolinux/isolinux.cfg文件,将第一行改为default linux ks=cdrom:/ks.cfg然后强行保存退出使用w!(这一步很重要,起着引导的用...)
第六步:将anaconda-ks.cfg拷贝成 iso/ks.cfg
#cd /root
#cp anaconda-ks.cfg iso/ks.cfg
拷贝成功后编辑ks.cfg文件,将第一行中的Install该成text,写入两句bootloader和reboot,下面是ks.cfg的配置文件...
text
cdrom
lang en_US.UTF-8
keyboard us
xconfig --startxonboot
network --device eth0 --bootproto dhcp
rootpw --iscrypted $1$GC0wR7ye$IaqIdT8bmpDJLyhCd7ZPM1
firewall --disable
authconfig --enableshadow --enablemd5
selinux --disabled
timezone --utc America/New_York
bootloader --location=mbr --driveorder=sda --append="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
clearpart --linux
part /boot --fstype ext3 --size=6000
part swap --size=1024
bootloader
reboot
%packages
@base
@core
@dialup
@editors
@gnome-desktop
@games
@graphical-internet
@graphics
@office
@printing
@sound-and-video
@text-internet
@base-x
keyutils
trousers
fipscheck
device-mapper-multipath
libsane-hpaio
xorg-x11-server-Xnest
接下来要安装createrepo包....
#cd /media/cdrom/CentOS
# rpm -ivh createrepo-0.4.11-3.el5.noarch.rpm
安装完成后创建包之间的依赖关系...
#cd /root/iso
#createrepo -g repodata/comps.xml ../iso/
解决包的依赖关系后最后一步就是创建Iso镜像文件了
#cd /root
#mkisofs -o MYCentOS.iso -b isolinux/isolinux.bin -c
isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -T iso/
好了,到这里我们就制作成功了....是不是很简单啊.希望你也能成功...