1、 在虚拟机中安装系统,选择所需的设置和软件包
2、 安装定制光盘所需软件
yum –y install createrepo mkisofs
3、 生成安装系统所需的rpm文件列表
awk '/Installing/{print $2}' install.log |sed 's/^[0-9]*://g' >/root/packages.list
4、 创建定制工作目录
mkdir /home/OS mount /dev/cdrom /mnt rsync –a --exclude=CentOS /mnt/ /home/OS mkdir /home/OS/CentOS
5、 复制系统安装所需rpm包
复制脚本cprpm.sh
#!/bin/bash
DEBUG=0
DVD_CD=/home/OS/CentOS //目标地址,即要复制到的地方
ALL_RPMS_DIR=/mnt/CentOS/ //源目录,以CentOS 5.6为例
DVD_RPMS_DIR=$DVD_CD
packages_list=/root/packages.list
number_of_packages=`cat $packages_list | wc -l`
i=1
while [ $i -le $number_of_packages ] ; do
line=`head -n $i $packages_list | tail -n -1`
name=`echo $line | awk '{print $1}'`
version=`echo $line | awk '{print $3}' | cut -f 2 -d :`
if [ $DEBUG -eq "1" ] ; then
echo $i: $line
echo $name
echo $version
fi
if [ $DEBUG -eq "1" ] ; then
ls $ALL_RPMS_DIR/$name-$version*
if [ $? -ne 0 ] ; then
echo "cp $ALL_RPMS_DIR/$name$version* "
fi
else
echo "cp $ALL_RPMS_DIR/$name-$version* $DVD_RPMS_DIR/"
cp $ALL_RPMS_DIR/$name$version* $DVD_RPMS_DIR/
# in case the copy failed
if [ $? -ne 0 ] ; then
echo "cp $ALL_RPMS_DIR/$name$version* "
cp $ALL_RPMS_DIR/$name* $DVD_RPMS_DIR/
fi
fi
i=`expr $i + 1`
done
运行脚本复制文件到/home/OS/CentOS下
chmod +x cprpm.sh ./cprpm.sh
复制gcc和gcc-c++所需的7个rpm包
gcc: kernel-headers glibc-headers glibc-devel cpp gcc gcc-c++: libstdc++-devel gcc-c++
6、 定制kickstart文件ks.cfg
文件从/root/anaconda-ks.cfg中复制修改,修改如下
① 安装gcc和gcc-c++
② 移除sendmail, firstboot-tui, bluez-utils
③ 关闭不使用的服务
/home/OS/ks.cfg内容如下:
# Kickstart file automatically generated by anaconda. install cdrom lang en_US.UTF-8 keyboard us network --bootproto=dhcp --device=eth0 --onboot=on #network --device eth0 --bootproto dhcp rootpw --iscrypted $1$h8PndJA7$f9cxY4cHR0lSnwaq.5Y0o. #firewall --enabled --port=22:tcp authconfig --enableshadow --enablemd5 firewall --disabled selinux --disabled timezone Asia/Shanghai bootloader --location=mbr --driveorder=sda # 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 #boot 100M 交换分区4096M 其余的全部给 /分区 (见下面的分区配置) part /boot --bytes-per-inode=4096 --fstype="ext3" --size=100 part swap --bytes-per-inode=4096 --fstype="swap" --size=4096 part / --bytes-per-inode=4096 --fstype="ext3" --grow --size=1 %packages @base @core gcc gcc-c++ keyutils iscsi-initiator-utils trousers fipscheck device-mapper-multipath -sendmail -firstboot-tui -bluez-utils %post # Disable unused service chkconfig acpid off chkconfig anacron off chkconfig ip6tables off chkconfig lvm2-monitor off chkconfig netfs off chkconfig nfslock off chkconfig pcscd off chkconfig portmap off chkconfig restorecond off chkconfig rpcgssd off chkconfig rpcidmapd off
7、 修改/home/OS/isolinux/isolinux.cfg
把第一行的default linux改成default text ks=cdrom:/ks.cfg
8、 生成comps.xml
cd /home/OS declare -x discinfo=`head -1 .discinfo` createrepo –g repodata/comps.xml . 或者createrepo –g repodata/comps.xml /home/OS/
9、 生成ISO文件
cd /home/OS mkisofs -o CentOS-5.6-i386-CD.iso -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R -J -v -T /home/OS /home/OS/CentOS-5.6-1386-CD.iso
即生成的ISO文件,可以用虚拟机测试一下哦!
感谢ZERO兄的修正,文章搜集于互联网


![[转]常见的nginx的配置选项](http://www.jiunile.com/wp-content/themes/xupeng/images/random/5.jpg)






最新评论
如何建立自己的特征码呢? 我
怎么修改啊,帮帮忙啊,,,,
你好,我照您的方法做了之后,
可否请教,要如何的调整呢?
拜读……
您这个是是2003的服务器
安装上以后 发现运行了 直接
有点意思,不错!
你QQ号多少?我是智生道顾问
请问你是怎么修改的啊?为什么