linux(rhel5.5)无人值守安装光盘制作
一、生产自动安装kickstart配置文件(可用kickstart配置工具,system-config-kickstart配置)
[root@target ~]#vim /root/ks.cfg
#platform=x86, AMD64, 或 Intel EM64T
# System authorization information
auth --useshadow --enablemd5
key --skip
#跳过安装sn的输入,必须有
# System bootloader configuration
bootloader --location=mbr
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart --all --initlabel
# Use graphical install
#graphical
# Use text mode install
#字符界面安装
text
# Firewall configuration
firewall --disabled
# Run the Setup Agent on first boot
firstboot --disable
# System keyboard
keyboard us
# System language
lang zh_CN
#系统默认语言设置
# Installation logging level
logging --level=info
# Use CDROM installation media
cdrom
#默认安装介质
# Network information
network --bootproto=static --device=eth0 --gateway=192.168.32.254 --ip=192.168.32.30 --netmask=255.255.255.0 --onboot=on
#网络设置
# Reboot after installation
reboot --eject
#安装后弹出cd重新系统,必须弹出cd,否则重启时会再次自动安装系统
#Root password
rootpw --iscrypted $1$m3qF5xHj$nPMaPd2vTvl6Bnm5Do.un.
# SELinux configuration
selinux --disabled
# System timezone
timezone Asia/Chongqing
# Install OS instead of upgrade
install
# X Window System configuration information
xconfig --defaultdesktop=GNOME --depth=16 --resolution=1024x768 --startxonboot
# Disk partitioning information
#硬盘分区设置
part /boot --bytes-per-inode=4096 --fstype="ext3" --ondisk=sda --size=256
part swap --bytes-per-inode=4096 --fstype="swap" --ondisk=sda --size=8192
#part / --bytes-per-inode=4096 --fstype="ext3" --grow --ondisk=sda --size=51200
#LVM install
#逻辑卷创建配置,必须严格按照物理卷、卷组、逻辑卷顺序创建
part pv.01 --ondisk=sda --size 51200
volgroup vg00 pv.01
logvol / --vgname=vg00 --size=1 --grow --name=lv00
#Software packages install
#软件安装包选择
%packages
@base
@gnome-desktop
@development-libs
@base-x
@admin-tools
@legacy-software-development
@development-tools
@chinese-support
@server-cfg
@legacy-network-server
@legacy-software-support
@system-tools
@editors
@text-internet
@graphical-internet
@smb-server
@ftp-server
二、准备光盘源
[root@target ~]#mount -o loop /virhost/soft/rhel-server-5.5-i386-dvd.iso /mnt
[root@target ~]#cp -a /mnt/* /virhost/soft/rhel5src/
[root@target soft]# ls /virhost/soft/rhel5src/
Cluster README-ja.html RELEASE-NOTES-en RELEASE-NOTES-ta.html RELEASE-NOTES-U5-or.html
ClusterStorage README-kn.html RELEASE-NOTES-en.html RELEASE-NOTES-te.html RELEASE-NOTES-U5-pa.html
EULA README-ko.html RELEASE-NOTES-es.html RELEASE-NOTES-U5-as.html RELEASE-NOTES-U5-pt_BR.html
eula.en_US README-ml.html RELEASE-NOTES-fr.html RELEASE-NOTES-U5-bn.html RELEASE-NOTES-U5-ru.html
GPL README-mr.html RELEASE-NOTES-gu.html RELEASE-NOTES-U5-de.html RELEASE-NOTES-U5-si.html
images README-or.html RELEASE-NOTES-hi.html RELEASE-NOTES-U5-en RELEASE-NOTES-U5-ta.html
isolinux README-pa.html RELEASE-NOTES-it.html RELEASE-NOTES-U5-en.html RELEASE-NOTES-U5-te.html
README-as.html README-pt_BR.html RELEASE-NOTES-ja.html RELEASE-NOTES-U5-es.html RELEASE-NOTES-U5-zh_CN.html
README-bn.html README-ru.html RELEASE-NOTES-kn.html RELEASE-NOTES-U5-fr.html RELEASE-NOTES-U5-zh_TW.html
README-de.html README-si.html RELEASE-NOTES-ko.html RELEASE-NOTES-U5-gu.html RELEASE-NOTES-zh_CN.html
README-en README-ta.html RELEASE-NOTES-ml.html RELEASE-NOTES-U5-hi.html RELEASE-NOTES-zh_TW.html
README-en.html README-te.html RELEASE-NOTES-mr.html RELEASE-NOTES-U5-it.html RPM-GPG-KEY-redhat-beta
README-es.html README-zh_CN.html RELEASE-NOTES-or.html RELEASE-NOTES-U5-ja.html RPM-GPG-KEY-redhat-release
README-fr.html README-zh_TW.html RELEASE-NOTES-pa.html RELEASE-NOTES-U5-kn.html Server
README-gu.html RELEASE-NOTES-as.html RELEASE-NOTES-pt_BR.html RELEASE-NOTES-U5-ko.html TRANS.TBL
README-hi.html RELEASE-NOTES-bn.html RELEASE-NOTES-ru.html RELEASE-NOTES-U5-ml.html VT
README-it.html RELEASE-NOTES-de.html RELEASE-NOTES-si.html RELEASE-NOTES-U5-mr.html
三、修改启动加载器设置
[root@target rhel5src]# vim /virhost/soft/rhel5src/isolinux/isolinux.cfg
#default linux
default install
#默认启动的操作系统代号
prompt 1
#timeout 600
timeout 50
#开启后等候时间
display boot.msg
F1 boot.msg
F2 options.msg
F3 general.msg
F4 param.msg
F5 rescue.msg
label install
#新增操作系统代号,install
kernel vmlinuz
append ks=cdrom:/ks.cfg initrd=initrd.img
#指定自动化的kickstart安装配置文件,ks.cfg
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 -
四、制作安装光盘
1、制作自动安装光盘iso文件
[root@target rhel5src]# cd /virhost/soft/rhel5src
[root@target rhel5src]# find -type f -name "TRANS.TBL" | xargs rm -f
#删除各目录中TRANS.TBL文件
[root@target rhel5src]# rm -rf isolinux/boot.cat
#删除isolinux/boot.cat文件
[root@target rhel5src]# chmod +w isolinux/*
#为isolinux下文件添加写权限
[root@target rhel5src]# mkisofs -o ../myrhel5.5.iso -J -r -v \
#制作iso文件,存储在上一层目录
>-b isolinux/isolinux.bin \
#指定安装光盘的启动加载器isolinux
>-c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table \
>-V "RHEL5.5_X86_32_AutoInstall_DVD" \
#设置光盘的卷标识符
>.
#将当前目录中所有文件加入到安装光盘中
INFO:
...
99.35% done, estimate finish Fri Jan 13 19:14:56 2012
99.68% done, estimate finish Fri Jan 13 19:14:56 2012
Total translation table size: 2048
Total rockridge attributes bytes: 274480
Total directory bytes: 415744
Path table size(bytes): 188
Done with: The File(s) Block(s) 1519384
Writing: Ending Padblock Start Block 1519762
Done with: Ending Padblock Block(s) 150
Max brk space used 267000
1519912 extents written (2968 MB)
#mkisofs选项说明:
-o 指定生成镜像的名字
-b 指定哪个文件为光盘光盘自引导启动的文件(目录内以.bin结尾的文件)
-c 将boot.cat文件的配置信息显示出来(目录内以.cat结尾的文件)
-no-emul-boot 不模仿boot这种引导格式(光盘内没有MBR不能进行boot格式的启动)
[root@target rhel5src]# file ../myrhel5.5.iso
#查看iso文件的类型和识别码是否正确
../myrhel5.5.iso: ISO 9660 CD-ROM filesystem data 'RHEL5.5_X86_32_AutoInstall_DVD ' (bootable)
2、为安装光盘加上md5验证码
[root@target rhel5src]# /usr/lib/anaconda-runtime/implantisomd5 --force ../myrhel5.5.iso
Inserting md5sum into iso image...
md5 = a753af4a7c3fb2e128fe5d73b644d2f9
Inserting fragment md5sums into iso image...
fragmd5 = ea4c3e9936bf3fb273d8dffce22edf95924e078e16f398e77c5e5cb6baa1
frags = 20
Setting supported flag to 0
#产生iso文件后,必须为其加上md5验证码,否则anacomda可能会认为这不是一个正确的安装光盘,而无法安装