PXE+Kickstart无人值守安装CentOS 7(3)

mount /dev/cdrom /test mkdir /tftpboot/CentOS7.2 cp /test/isolinux/{vmlinuz,initrd.img} /tftpboot/CentOS7.2 cp /test/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default

其实仅需要vmlinuz和initrd.img两个文件即可,不过这里还将isolinux.cfg这个文件拷贝出来了,这个文件里提供了开机选项,可以以它作为修改开机选项和菜单的模板,这样修改起来比较容易,也更便捷!

1.8 设置开机菜单并提供系统安装文件

以下是CentOS 7.2中syslinux包中提供的isolinux.cfg中提供的默认内容。

[root@linuxidc ~]# cat /tftpboot/pxelinux.cfg/default default vesamenu.c32 # 这是必须项,或者使用menu.c32 timeout 600 # 超时等待时间,60秒内不操作将自动选择默认的菜单来加载 display boot.msg # 这是为选项提供一些说明的文件 # Clear the screen when exiting the menu, instead of leaving the menu displayed. # For vesamenu, this means the graphical background is still displayed without # the menu itself for as long as the screen remains in graphics mode. menu clear menu background splash.png # 背景图片 menu title CentOS 7 # 大标题 menu vshift 8 menu rows 18 menu margin 8 #menu hidden menu helpmsgrow 15 menu tabmsgrow 13 # Border Area menu color border * #00000000 #00000000 none # Selected item menu color sel 0 #ffffffff #00000000 none # Title bar menu color title 0 #ff7ba3d0 #00000000 none # Press [Tab] message menu color tabmsg 0 #ff3a6496 #00000000 none # Unselected menu item menu color unsel 0 #84b8ffff #00000000 none # Selected hotkey menu color hotsel 0 #84b8ffff #00000000 none # Unselected hotkey menu color hotkey 0 #ffffffff #00000000 none # Help text menu color help 0 #ffffffff #00000000 none # A scrollbar of some type? Not sure. menu color scrollbar 0 #ffffffff #ff355594 none # Timeout msg menu color timeout 0 #ffffffff #00000000 none menu color timeout_msg 0 #ffffffff #00000000 none # Command prompt text menu color cmdmark 0 #84b8ffff #00000000 none menu color cmdline 0 #ffffffff #00000000 none # Do not display the actual menu unless the user presses a key. All that is displayed is a timeout message. menu tabmsg Press Tab for full configuration options on menu items. menu separator # insert an empty line menu separator # insert an empty line label linux menu label ^Install CentOS 7 # 菜单文字 kernel vmlinuz # 内核文件路径,注意相对路径是从tftp的根路径/tftpboot开始的,所以要改为"./CentOS7.2/vmlinuz" append initrd=initrd.img inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 quiet # 内核启动选项,其中包括initrd的路径,同样要改为"./CentOS7.2/initrd.img" # stage2文件的搜索路径,搜索的文件一般是".treeinfo",找不到该文件则找LiveOS/squashfs.img # 一般pxe环境下此路径直接指向系统安装文件的路径,具体做法见下文示例 label check menu label Test this ^media & install CentOS 7 menu default # menu default表示开机时光标一开始默认停留在此label上 kernel vmlinuz append initrd=initrd.img inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 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=CentOS\x207\x20x86_64 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=CentOS\x207\x20x86_64 rescue quiet label memtest menu label Run a ^memory test text help If your system is having issues, a problem with your system's memory may be the cause. Use this utility to see if the memory is working correctly. endtext kernel memtest menu separator # insert an empty line label local menu label Boot from ^local drive localboot 0xffff menu separator # insert an empty line menu separator # insert an empty line label returntomain menu label Return to ^main menu menu exit menu end

所以,将其稍作修改,使其适合做pxe的菜单配置文件。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/13580.html