准备工具:
1:软碟通
2:centOS7.4镜像
3:8G优盘
制作U盘镜像:
1:使用软碟通把centos镜像写入U盘,完成后更改U盘标签名:CENTOS7(可以随意改,但切记后续都应根据标签名改写,因为优盘路径是根据标签名定位的;)
完成后,如下图所示,U盘LABEL名改成CENTOS7,U盘目录如下:
2:复制 ks.cfg 文件到U盘根目录下,如上图选择的文件,而后编辑 ks.cfg,修改安装源(切记因为是ISO直接写入U盘,所以安装源的选择应该是 cdrom,如果改成U盘路径无效):
3:完成ks.cfg的修改后,开始修改isolinux目录内的两个文件 isolinux.cfg 和 syslinux.cfg:
1):先修改isolinux.cfg的配置如下:
label linux
menu label ^Install CentOS 7
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=CENTOS7 quiet (红色CENTOS7就是U盘的盘符名称,由于我们之前步骤1 把U盘盘符名称修改了,所以这边所有的都需要修改)
label check
menu label Test this ^media & install CentOS 7
menu default
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=CENTOS7 rd.live.check quiet
menu separator # insert an empty line
# utilities submenu
menu begin ^Troubleshooting
menu title Troubleshooting
label vesa
menu indent count 5
menu label Install CentOS 7 in ^basic graphics mode
text help
Try this option out if you're having trouble installing
CentOS 7.
endtext
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=CENTOS7 xdriver=vesa nomodeset quiet
label rescue
menu indent count 5
menu label ^Rescue a CentOS system
text help
If the system will not boot, this lets you access files
and edit config files to try to get it booting again.
endtext
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=CENTOS7 rescue quiet
2):修改syslinux.cfg的配置如下:(这步很重要,上面1步其实可以不做修改的,isolinux)
label linux
menu label ^Install CentOS 7 (正常安装系统,手动选择)
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=CENTOS7 quiet
label check
menu label Test this ^media & install CentOS 7
menu default
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=CENTOS7 rd.live.check quiet
menu separator # insert an empty line
label linux-ks
menu label ^Install CentOS 7 Use ks-install (选择ks.cfg进行自动部署安装)
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=CENTOS7 ks=hd:LABEL=CENTOS7:/ks.cfg quiet
(以上红色部分是我新增的引导条目看下图为例,ks=hd:LABEL=CENTOS7:/ks.cfg 表示ks.cfg的存放路径,CENTOS7表示U盘的盘符即LABEL)
menu separator # insert an empty line
# utilities submenu
menu begin ^Troubleshooting
menu title Troubleshooting
label vesa
menu indent count 5
menu label Install CentOS 7 in ^basic graphics mode
text help
Try this option out if you're having trouble installing
CentOS 7.
endtext
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=CENTOS7 xdriver=vesa nomodeset quiet
label rescue
menu indent count 5
menu label ^Rescue a CentOS system
text help
If the system will not boot, this lets you access files
and edit config files to try to get it booting again.
endtext
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=CENTOS7 rescue quiet
4:以上操作完成后可以测试U盘安装了