首先当然是下载一个CentOS 6.3
CentOS 6.3下载地址:
32位:http://mirror.centos.org/centos/6.3/isos/i386/CentOS-6.3-i386-bin-DVD1to2.torrent
64位:http://mirror.centos.org/centos/6.3/isos/x86_64/CentOS-6.3-x86_64-bin-DVD1to2.torrent
[root@localhost ~]# yum -y install createrepo mkisofs isomd5sum
[root@localhost ~]# awk '/Installing/{print $2}' install.log |sed 's/^[0-9]*://g' >/root/packages.list
[root@localhost ~]# mkdir /mnt/cdrom
[root@localhost ~]# mkdir -p /data/OS
[root@localhost ~]# mount /dev/cdrom /mnt/cdrom/
[root@localhost ~]# rsync -a --exclude=Packages /mnt/cdrom/ /data/OS/
[root@localhost ~]# mkdir /data/OS/Packages
[root@localhost ~]# vim cprpms.sh
#!/bin/bash SRC_RPMS=/mnt/cdrom/Packages DST_RPMS=/data/OS/Packages packages_list=/root/packages.list number_of_packages=`cat $packages_list | wc -l` i=1 while [ $i -le $number_of_packages ] ; do name=`head -n $i $packages_list | tail -n -1` echo "cp $SRC_RPMS/$name* $DST_RPMS/" cp $SRC_RPMS/$name* $DST_RPMS/ i=`expr $i + 1` done
[root@localhost ~]# sh cprpms.sh
[root@localhost ~]# vim /data/OS/isolinux/ks.cfg
#platform=x86, AMD64, or Intel EM64T # Firewall configuration firewall --disabled # Install OS instead of upgrade install # Use CDROM installation media cdrom # Root password default is "redhat" rootpw --iscrypted $1$36bsCbH1$UDJ6eCqPi2Nm1KsgajvHs1 # System authorization information auth --useshadow --passalgo=md5 # Use text mode install text firstboot --disable # System keyboard keyboard us # System language lang en_US # SELinux configuration selinux --disabled # Do not configure the X Window System skipx # Installation logging level logging --level=info # Reboot after installation reboot # System timezone timezone Asia/Shanghai # Network information network --bootproto=dhcp --device=eth0 --onboot=on –noipv6 # System bootloader configuration bootloader --location=mbr # Clear the Master Boot Record zerombr # Partition clearing information clearpart --all --initlabel # Disk partitioning information part /boot --fstype="ext4" --size=100 part / --fstype="ext4" --size=5120 part swap --size=1024 part /data --fstype="ext4" --grow --size=1 %packages @base @core @development @server-policy sgpio ntp
[root@localhost OS]# vim /data/OS/isolinux/isolinux.cfg
default linux
label linux
kernel vmlinuz
append ks=cdrom:/isolinux/ks.cfg initrd=initrd.img #修改行
[root@localhost ~]# cd /data/OS/
[root@localhost OS]# createrepo -g repodata/*-comps.xml /data/OS/
[root@localhost OS]# declare -x discinfo=`head -1 .discinfo`
[root@localhost OS]# createrepo -u "media://$discinfo" -g repodata/*-comps.xml /data/OS/
[root@localhost ~]# cd /data/OS/
[root@localhost OS]# mkisofs -R -J -T -r -l -d -joliet-long -allow-multidot \
-allow-leading-dots -no-bak -o /data/CentOS-6.3-x86_64.iso \
-b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot \
-boot-load-size 4 -boot-info-table /data/OS
[root@localhost ~]# implantisomd5 /data/CentOS-6.3-x86_64.iso