制作CentOS 5.9自动安装光盘iso镜像

准备环境:先手动安装一台centos5.9系统

[root@localhost ~]# mkdir /iso
[root@localhost ~]# mount -o loop /dev/cdrom /media
#注意有了两个.开头的文件,也要拷过去 .treeinfo与.discinfo这两个隐藏文件
[root@localhost ~]# cp -a /media/ /iso
[root@localhost ~]# cp ks.cfg /iso/media/ #一般按照我下面配就行了
[root@localhost ~]# vim ks.cfg #rootpw可以在手动安装系统的anaconda-ks.cfg找到当时设置加密后的密码
# Kickstart file automatically generated by anaconda.

install
text
cdrom
lang en_US.UTF-8
keyboard us
network --device eth0 --bootproto dhcp
rootpw --iscrypted $1$c/EHNTH5$3bRky/m4LJpozrExEQpMP1
firewall --disabled
authconfig --enableshadow --enablemd5
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
# not guaranteed to work
clearpart --all --initlabel
part /boot --fstype ext3 --size=200 --ondisk=sda
part / --fstype ext3 --size=30720 --ondisk=sda
part swap --size=6144 --ondisk=sda
part /data --fstype ext3 --size=1 --grow --ondisk=sda
skipx
reboot

%packages
@base
@core
@development-tools
@editors
@text-internet
keyutils
iscsi-initiator-utils
trousers
fipscheck
device-mapper-multipath
lrzsz


[root@localhost ~]# cd /iso/media/
[root@localhost ~]# chmod +w isolinux/isolinux.cfg

[root@localhost ~]# vim isolinux/isolinux.cfg #一般按照我下面配就行了
default elive
prompt 1
timeout 50
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label elive
  kernel vmlinuz
  append ks=cdrom:/ks.cfg initrd=initrd.img
label linux
  kernel vmlinuz
  append initrd=initrd.img
label text
  kernel vmlinuz
  append initrd=initrd.img text
label ks
  kernel vmlinuz
  append ks initrd=initrd.img
label local
  localboot 1
label memtest86
  kernel memtest
  append -


#精简rpm包缩小iso镜像文件
[root@localhost ~]# cd /iso/media/CentOS
#删除java、openoffice、eclipse的rpm包,寻找占用空间大且不必要的rpm包删除
[root@localhost CentOS]# ls|grep ^java |xargs rm -f 
[root@localhost CentOS]# ls|grep ^openoffice|xargs rm -f
[root@localhost CentOS]# ls|grep ^eclipse|xargs rm -f
[root@localhost CentOS]# rm -f gimp-help-2-0.1.0.10.1.1.noarch.rpm kdelibs-apidocs-3.5.4-26.el5.centos.1.x86_64.rpm thunderbird-10.0.11-1.el5.centos.x86_64.rpm kde-i18n-Spanish-3.5.4-1.noarch.rpm evolution-help-2.12.3-19.el5.x86_64.rpm
[root@localhost CentOS]# du -sh
3.5G  #嗯,差不多了就这样吧
[root@localhost CentOS]# cd ..

#如果没有mkisofs命令 自己rpm包安装一下
[root@localhost media]# mkisofs -r -T -J -V "CentOS" -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -o /tmp/CENTOS_5.9_FINAL-NEW.iso /iso/media/

[root@localhost tmp]# ls -lh /tmp/
-rw-r--r-- 1 root root 3.7G Mar 29 15:10 CENTOS_5.9_FINAL-NEW.iso


接下来来刻录DVD光盘:(将空的光盘放入光驱中)

打开UltraISO



慢慢等待刻录完成收工

如果要对已做好的iso镜像里的文件进行修改(如ks.cfg),操作如下:

需求:原ks.cfg在分区的时候只对应sda这种硬盘,而HP硬盘的不支持(/dev/cciss/c0d0p)

part /boot --fstype ext3 --size=200 --ondisk=sda
part / --fstype ext3 --size=30720 --ondisk=sda
part swap --size=6144 --ondisk=sda
part /data --fstype ext3 --size=1 --grow --ondisk=sda

只要把上面的--ondisk=sda全部删除,就可以支持所有硬盘了

 

1.把镜像里的文件提取到桌面,修改ks.cfg,把--ondisk=sda全部删除

 

2.把桌面修改后的ks.cfg添加到iso镜像覆盖原ks.cfg

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值