虚机镜像:rhel-server-7.9-x86_64-dvd
取消DHCP自动分配:
# yum install system-config-kickstart
# system-config-kickstart
# yum install httpd -y
# df -h
# ln -s /rhel7/ /var/www/html
# cd /var/www/html
# ls
rhel7
# mkdir /rhel7
# umount /dev/sr0
# mount /dev/sr0 /rhel7
[root@localhost tftpboot]# yum search pxelinux #搜索pxe服务 Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. =================================== Matched: pxelinux ==================================== syslinux.x86_64 : Simple kernel loader which boots from a FAT filesystem syslinux-extlinux.x86_64 : The EXTLINUX bootloader, for booting the local system. syslinux-tftpboot.noarch : SYSLINUX modules in /var/lib/tftpboot, available for network : booting [root@localhost tftpboot]# yum install syslinux.x86_64 #下载syslinux.x86_64 Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. Package syslinux-4.05-15.el7.x86_64 already installed and latest version Nothing to do [root@localhost tftpboot]# rpm -ql syslinux.x86_64 | less #查询相关服务文件 [root@localhost tftpboot]# yum install tftp-server.x86_64 -y #下载tftp包 Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. Package tftp-server-5.2-22.el7.x86_64 already installed and latest version Nothing to do [root@localhost tftpboot]# rpm -ql tftp-server.x86_64 #查询相关服务文件 /etc/xinetd.d/tftp /usr/lib/systemd/system/tftp.service /usr/lib/systemd/system/tftp.socket /usr/sbin/in.tftpd /usr/share/doc/tftp-server-5.2 /usr/share/doc/tftp-server-5.2/CHANGES /usr/share/doc/tftp-server-5.2/README /usr/share/doc/tftp-server-5.2/README.security /usr/share/man/man8/in.tftpd.8.gz /usr/share/man/man8/tftpd.8.gz /var/lib/tftpboot [root@localhost tftpboot]# systemctl enable --now tftp #设置开机自启并启动 [root@localhost tftpboot]# df #查看挂载 Filesystem 1K-blocks Used Available Use% Mounted on devtmpfs 12364044 0 12364044 0% /dev tmpfs 12381076 0 12381076 0% /dev/shm tmpfs 12381076 12980 12368096 1% /run tmpfs 12381076 0 12381076 0% /sys/fs/cgroup /dev/mapper/rhel-root 36678148 4954276 31723872 14% / /dev/sda1 1038336 187256 851080 19% /boot tmpfs 2476216 32 2476184 1% /run/user/0 /dev/sr0 4420474 4420474 0 100% /rhel7 [root@localhost tftpboot]# cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot #复制 [root@localhost tftpboot]# cp /rhel7/isolinux/* /var/lib/tftpboot #复制 [root@localhost tftpboot]# cd /var/lib/tftpboot [root@localhost tftpboot]# ls boot.cat grub.conf isolinux.bin memtest pxelinux.cfg TRANS.TBL vesamenu.c32 boot.msg initrd.img isolinux.cfg pxelinux.0 splash.png upgrade.img vmlinuz [root@localhost tftpboot]# mkdir pxelinux.cfg [root@localhost tftpboot]# cp isolinux.cfg pxelinux.cfg/default [root@localhost tftpboot]# vim /etc/dhcp/dhcpd.conf # dhcpd.conf # # Sample configuration file for ISC dhcpd # # option definitions common to all supported networks... option domain-name "timinglee.org"; option domain-name-servers 114.114.114.114; default-lease-time 600; max-lease-time 7200; # Use this to enble / disable dynamic dns updates globally. #ddns-update-style none; # If this DHCP server is the official DHCP server for the local # network, the authoritative directive should be uncommented. #authoritative; # Use this to send dhcp log messages to a different log file (you also # have to hack syslog.conf to complete the redirection). log-facility local7; # No service will be given on this subnet, but declaring it helps the # DHCP server to understand the network topology. #subnet 10.152.187.0 netmask 255.255.255.0 { #} # This is a very basic subnet declaration. subnet 192.168.0.0 netmask 255.255.255.0 { range 192.168.0.130 192.168.0.140; option routers 192.168.0.2; next-server 192.168.0.132; #找下一个文件 filename "pxelinux.0"; #文件指定名称 } [root@localhost tftpboot]# cd /var/lib/tftpboot/ [root@localhost tftpboot]# vim /var/lib/tftpboot/pxelinux.cfg/default default vesamenu.c32 timeout 30 #修改下时间啦~ 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 Red Hat Enterprise Linux 7.9 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 Red Hat Enterprise Linux huolahuolahuola #修改了一下下名字 menu default #下面label check 板块内移上来的 kernel vmlinuz append initrd=initrd.img repo=http://192.168.0.132/rhel7 ks=http://192.168.0.132/ks.cfg quiet #指定镜像位置和ks.cfg位置 label check menu label Test this ^media & install Red Hat Enterprise Linux 7.9 kernel vmlinuz append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.9\x20Server.x86_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 Red Hat Enterprise Linux 7.9 in ^basic graphics mode text help Try this option out if you're having trouble installing Red Hat Enterprise Linux 7.9. endtext kernel vmlinuz append initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.9\x20Server.x86_64 xdriver=vesa nomodeset quiet label rescue menu indent count 5 menu label ^Rescue a Red Hat Enterprise Linux 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=RHEL-7.9\x20Server.x86_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 [root@localhost tftpboot]# systemctl restart httpd #重启服务 [root@localhost tftpboot]# systemctl restart dhcpd
再测试:
安装一个check机,打开时:
然后:
此时运行完成后再关机重启,并打开电源时进入固件:
注意:上下移动时请shift+=
安好后关机,再打开:
成功。