準備環境:先手動安裝一臺centos5.9系統html
[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
# Kickstart file automatically generated by anaconda.java
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
rebootlinux
%packages
@base
@core
@development-tools
@editors
@text-internet
keyutils
iscsi-initiator-utils
trousers
fipscheck
device-mapper-multipath
lrzszexpress
[root@localhost ~]# cd /iso/media/
[root@localhost ~]# chmod +w isolinux/isolinux.cfgvim
[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
label linux
label text
label ks
label local
label memtest86
#精簡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 ..api
#若是沒有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/app
[root@localhost tmp]# ls -lh /tmp/
-rw-r--r-- 1 root root 3.7G Mar 29 15:10 CENTOS_5.9_FINAL-NEW.isoless
接下來來刻錄DVD光盤:(將空的光盤放入光驅中)eclipse
打開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所有刪除