相对第二版做的修改:
系统换成centos5.5 64位
加入更多的软件包
修改正第二版一些错误
============================================================
实验环境:VMware + CentOS5.5(64bit)
根据自己的习惯,将CentOS重新打包成一个新ISO,可以自动分区、选择原件包,快速安装系统。
先用虚拟机按照正常的流程安装一个CentOS系统,接下来在这系统上去建立我们的定制系统:
1、挂载光驱
2、创建临时目录
mkdir -p /root/iso/CentOS |
3、提取需要的RPM包,正常安装好操作系统在/root目录下会有install.log文件,这个就是操作系统安装RPM包的记录,我们从这些记录中,将所需的RPM包从/mnt/CentOS中复制到/root/iso/CentOS里面去
#!/bin/bash PACKDIR='/root/package.txt'
NEW_DVD='/root/iso/CentOS/'
while read LINE
do
cp ${DVD}/${LINE}*.rpm /${NEW_DVD} || echo "$LINE don't cp......."
done < package.txt
rm -f package.txt |
4、把原镜像除了CentOS目录外的文件全部复制至/root/iso目录下
rsync -a --exclude=CentOS /mnt/ /root/iso |
5、把/root目录下的anaconda-ks.cfg复制至/root/iso目录下,并根据自己实际需要修改安装要求
# Kickstart file automatically generated by anaconda.
install
cdrom
lang en_US.UTF-8
keyboard us
network --device eth0 --bootproto dhcp
firewall --disabled --port=22:tcp
authconfig --enableshadow --enablemd5
selinux --enforcing
timezone --utc Asia/Shanghai
bootloader --location=mbr --driveorder=sda
clearpart --linux --initlabel
part /boot --fstype ext3 --size=100
part swap --size=8192
part / --fstype ext3 --size=100 --grow
%packages
@base
@core
@development-libs
@development-tools
@editors
@system-tools
@text-internet
keyutils
libhbaapi
trousers
fipscheck
device-mapper-multipath
fuse-libs
systemtap-sdt-devel
perl-XML-SAX
pth
perl-XML-Twig
perl-XML-Dumper
perl-TimeDate
perl-libxml-perl
tog-pegasus-devel
perl-Convert-ASN1
libstdc++44-devel
libassuan-devel
perl-XML-NamespaceSupport
perl-DateManip
libksba-devel
libksba-devel
fipscheck-devel
sblim-cmpi-dhcp-devel
perl-Crypt-SSLeay
perl-Mozilla-LDAP
pth-devel
perl-LDAP
perl-XML-Grove
libpciaccess-devel
python-imaging
libhbaapi-devel
fuse-devel
libksba
perl-Archive-Zip
gcc44-c++
gcc44-gfortran
pexpect
dejagnu
imake
java-1.6.0-openjdk-devel
gcc-objc
ElectricFence
memtest86+
gcc-gnat
libgfortran44
gcc44
expect
java-1.6.0-openjdk
unifdef
nasm
audit
%post
for i in `ls /etc/rc3.d/S*`
do
CURSRV=`echo $i|cut -c 15-`
echo $CURSRV
case $CURSRV in
crond | irqbalance | microcode_ctl | lvm2-monitor | network | random | sshd | syslog )
echo "Base services, Skip!"
;;
*)
echo "change $CURSRV to off"
chkconfig --level 235 $CURSRV off
service $CURSRV stop
;;
esac
done
sed -i "8i alias vi='vim'" /root/.bashrc
sed -i "8i alias grep='grep --color=auto'" /root/.bashrc
sed -i "9i alias n='netstat -tunlp'" /root/.bashrc
echo 'syntax on' > /root/.vimrc
sed -i 's/^GSSAPIAuthentication yes$/GSSAPIAuthentication no/' /etc/ssh/sshd_config
sed -i 's/^#UseDNS yes$/UseDNS no/' /etc/ssh/sshd_config
echo "* hard nofile 65535" >> /etc/security/limits.conf
echo "* soft nofile 65535" >> /etc/security/limits.conf
/usr/sbin/eject
reboot
|
6、让ISO按照anaconda-ks.cfg文件来执行安装
vi /root/iso/isolinux/isolinux.cfg
Default linux 修改成default linux ks=cdrom:/anaconda-ks.cfg |
7、生成comps.xml文件
yum -y install createrepo mkisofs
|
8、制作ISO
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 /root/iso/ |
这样一个定制版的Centos就出来了!~~~
本文转自运维笔记博客51CTO博客,原文链接http://blog.51cto.com/lihuipeng/759122如需转载请自行联系原作者
lihuipeng