{"id":435,"date":"2024-11-26T16:04:44","date_gmt":"2024-11-26T08:04:44","guid":{"rendered":"http:\/\/192.168.5.24\/?p=435"},"modified":"2025-04-29T16:10:56","modified_gmt":"2025-04-29T08:10:56","slug":"pxekickstart-%e5%ae%9e%e7%8e%b0%e6%97%a0%e4%ba%ba%e5%80%bc%e5%ae%88%e8%bf%9c%e7%a8%8b%e5%ae%89%e8%a3%85%e6%93%8d%e4%bd%9c%e7%b3%bb%e7%bb%9f","status":"publish","type":"post","link":"https:\/\/bigvip.dpdns.org\/?p=435","title":{"rendered":"PXE+kickstart \u5b9e\u73b0\u65e0\u4eba\u503c\u5b88\u8fdc\u7a0b\u5b89\u88c5\u64cd\u4f5c\u7cfb\u7edf"},"content":{"rendered":"\n<p class=\"has-large-font-size\"><strong>\u4e00<\/strong>\u3001<strong>PXE\u4ecb\u7ecd<\/strong><\/p>\n\n\n\n<p><br>\u6240\u8c13\u7684PXE\u662fPreboot Execution Environment\u7684\u7f29\u5199\uff0c\u5b57\u9762\u4e0a\u7684\u610f\u601d\u662f\u5f00\u673a\u524d\u7684\u6267\u884c\u73af\u5883\u3002<br><strong>\u7279\u70b9\uff1a<\/strong><br>\u89c4\u6a21\u5316\uff1a\u540c\u65f6\u88c5\u914d\u591a\u53f0\u670d\u52a1\u5668<br>\u81ea\u52a8\u5316\uff1a\u5b89\u88c5\u7cfb\u7edf\u3001\u914d\u7f6e\u5404\u79cd\u670d\u52a1<br>\u8fdc\u7a0b\u5b9e\u73b0\uff1a\u4e0d\u9700\u8981\u5149\u76d8\u3001U\u76d8\u7b49\u5b89\u88c5\u4ecb\u8d28<br><strong>\u4f5c\u7528\uff1a<\/strong><br>\u9884\u542f\u52a8\u6267\u884c\u73af\u5883\uff0c\u5728\u64cd\u4f5c\u7cfb\u7edf\u4e4b\u524d\u8fd0\u884c<br>\u53ef\u7528\u4e8e\u8fdc\u7a0b\u5b89\u88c5\u3001\u6784\u5efa\u65e0\u76d8\u5de5\u4f5c\u7ad9<br><strong>\u5de5\u4f5c\u8fc7\u7a0b\uff1a<\/strong><br>1.PXE\u5ba2\u6237\u673a\u53d1\u51faDHCP\u8bf7\u6c42\uff0c\u5411\u670d\u52a1\u5668\u7533\u8bf7IP\u5730\u5740\u3002<br>2.DHCP\u670d\u52a1\u5668\u54cd\u5e94PXE\u5ba2\u6237\u673a\u7684\u8bf7\u6c42\uff0c\u81ea\u52a8\u4eceIP\u5730\u5740\u6c60\u4e2d\u5206\u914d\u4e00\u4e2aIP\u5730\u5740\u7ed9PXE\u5ba2\u6237\u673a\uff0c\u5e76\u4e14\u544a\u77e5PXE\u5ba2\u6237\u673a\uff1aTFTP\uff08\u7b80\u5355\u6587\u4ef6\u4f20\u8f93\u534f\u8bae\uff09\u670d\u52a1\u5668\u7684IP\u5730\u5740\u548cPXE\u5f15\u5bfc\u7a0b\u5e8f\u6587\u4ef6pxelinux.0\u3002<br>3.PXE\u5ba2\u6237\u673a\u5411TFTP\u670d\u52a1\u5668\u53d1\u8d77\u83b7\u53d6pxelinux.0\u5f15\u5bfc\u7a0b\u5e8f\u6587\u4ef6\u7684\u8bf7\u6c42\u3002<br>4.TFTP\u670d\u52a1\u5668\u54cd\u5e94PXE\u5ba2\u6237\u673a\u7684\u8bf7\u6c42\uff0c\u5c06\u5176\u5171\u4eab\u7684pxelinux.0\u6587\u4ef6\u4f20\u8f93\u7ed9PXE\u5ba2\u6237\u673a\u3002<br>5.PXE\u5ba2\u6237\u673a\u901a\u8fc7\u7f51\u7edc\u6765\u542f\u52a8\u5230\u7cfb\u7edf\u5b89\u88c5\u4e3b\u754c\u9762\u3002<br>6.PXE\u5ba2\u6237\u673a\u5411\u6587\u4ef6\u5171\u4eab\u670d\u52a1\u5668\u53d1\u8d77\u83b7\u53d6centos\u6216windows\u7cfb\u7edf\u5b89\u88c5\u6587\u4ef6\u7684\u8bf7\u6c42\u3002<br>7.\u6587\u4ef6\u5171\u4eab\u670d\u52a1\u54cd\u5e94PXE\u5ba2\u6237\u673a\u7684\u8bf7\u6c42\uff0c\u5c06\u5171\u4eab\u7684\u7cfb\u7edf\u5b89\u88c5\u6587\u4ef6\u4f20\u8f93\u7ed9PXE\u5ba2\u6237\u673a\u3002<br>8.PXE\u5ba2\u6237\u673a\u8fdb\u5165\u5230\u5b89\u88c5\u63d0\u793a\u5411\u5bfc\u754c\u9762\uff0c\u7528\u6237\u9700\u8981\u624b\u52a8\u6765\u5b8c\u6210\u7cfb\u7edf\u7684\u64cd\u4f5c<\/p>\n\n\n\n<p class=\"has-large-font-size\"><strong>\u4e8c\u3001\u670d\u52a1\u5668\u7aef\u7684\u5b89\u88c5<\/strong><\/p>\n\n\n\n<p>        1\u3001\u5148\u5b89\u88c5\u914d\u7f6eDHCP\u670d\u52a1\u5668<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@T1 ~]# grep -vE \"^(#|$)\"  \/etc\/dhcp\/dhcpd.conf \ndefault-lease-time 600;\nmax-lease-time 7200;\nlog-facility local7;\nsubnet 192.168.153.0 netmask 255.255.255.0 {  <strong>\/\/\u7f51\u6bb5\u5fc5\u987b\u662fDHCP\u670d\u52a1\u5668\u7f51\u5361\u6240\u5728\u7f51\u6bb5<\/strong>\n  range 192.168.153.200 192.168.153.210;\n  option domain-name-servers 192.168.2.1;\n  option routers 192.168.153.2;\n  option broadcast-address 192.168.153.255;\n  default-lease-time 600;\n  max-lease-time 7200;\n  next-server 192.168.153.138;        <strong>\/\/\u6307\u5411tftp\u670d\u52a1\u5668\u7684IP<\/strong>\n  filename \"pxelinux.0\";            <strong>  \/\/\u6307\u5411tftp\u4e3b\u76ee\u5f55\u4e0b\u7684pxe\u5f15\u5bfc\u6587\u4ef6\u540d<\/strong>\n}<\/code><\/pre>\n\n\n\n<p>       2\u3001\u5b89\u88c5\u914d\u7f6etftp\u670d\u52a1\u5668<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@T1 ~]# grep -vE \"^(#|$)\"  \/etc\/xinetd.d\/tftp \nservice tftp\n{\n        socket_type             = dgram\n        protocol                = udp\n        wait                    = yes\n        user                    = root\n        server                  = \/usr\/sbin\/in.tftpd\n        server_args             = -s \/var\/lib\/tftpboot   <strong>\/\/tftp\u7684\u5171\u4eab\u4e3b\u76ee\u5f55<\/strong>\n        disable                 = no\n        per_source              = 11\n        cps                     = 100 2\n        flags                   = IPv4\n}<\/code><\/pre>\n\n\n\n<p>       3\u3001\u5b89\u88c5\u914d\u7f6eftp\u670d\u52a1\u5668<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;root@T1 ~]# grep -vE \"^(#|$)\"  \/etc\/vsftpd\/vsftpd.conf\nanonymous_enable=YES\nlocal_enable=YES\nwrite_enable=YES\nlocal_umask=022\ndirmessage_enable=YES\nxferlog_enable=YES\nconnect_from_port_20=YES\nxferlog_std_format=YES\nlisten=YES\nlisten_ipv6=NO\npam_service_name=vsftpd\nuserlist_enable=YES\ntcp_wrappers=YES\nanon_root=\/media\/cd\/          <strong>\/\/ftp\u7684\u6839\u76ee\u5f55\u5fc5\u987b\u5b58\u653e\u6709\u51c6\u5907\u5b89\u88c5\u7684\u64cd\u4f5c\u7cfb\u7edf\u6587\u4ef6<\/strong><\/code><\/pre>\n\n\n\n<p>       4\u3001\u521b\u5efaks\u914d\u7f6e\u6587\u4ef6<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>\u9700\u8981\u5b89\u88c5system-config-kickstart\u8f6f\u4ef6\u5305\uff0c\u5e76\u5728<strong>\u56fe\u50cf\u5316\u754c\u9762\u8fd0\u884c<\/strong>\uff0c\u7136\u540e\u6839\u636e\u63d0\u793a\u9009\u62e9\u7cfb\u7edf\u7684\u5b89\u88c5\u914d\u7f6e\u4fe1\u606f\uff0c\u4fdd\u5b58\u540e\u5373\u53ef\u751f\u6210ks\u6587\u4ef6\u3002\n\n&#91;root@localhost linux_soft]# grep -Ev \"^(#|$)\" ks.cfg \ninstall\nkeyboard 'us'\nrootpw --iscrypted $1$pksKO3qg$vwkbyUT6OVkwyyJ8QRnVW\/\nlang en_US\nauth  --useshadow  --passalgo=sha512\ntext\nselinux --disabled\nskipx\nfirewall --disabled\nnetwork  --bootproto=dhcp --device=ens33\nreboot\ntimezone Asia\/Hong_Kong --isUtc\nurl --url=\"ftp:\/\/<strong>pxe_server_ip<\/strong>\/cd\/\"\nbootloader --location=mbr\nzerombr\nclearpart --all\npart \/boot --fstype=\"xfs\" --size=500\npart swap --fstype=\"swap\" --size=2048\npart \/ --fstype=\"xfs\" --grow --size=1\n%packages\n@^minimal\n@core\n@development\nchrony\nkexec-tools\n%end\n%addon com_redhat_kdump --enable --reserve-mb='auto'\n%end\n%anaconda\npwpolicy root --minlen=6 --minquality=1 --notstrict --nochanges --notempty\npwpolicy user --minlen=6 --minquality=1 --notstrict --nochanges --emptyok\npwpolicy luks --minlen=6 --minquality=1 --notstrict --nochanges --notempty\n%end<\/code><\/pre>\n\n\n\n<p>       5\u3001\u914d\u7f6epxe+kickstart<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>tftp\u4e3b\u76ee\u5f55\u4e0b\u6587\u4ef6\uff1a<\/strong> \uff08\u4e3b\u8981\u653epxe\u5f15\u5bfc\u6587\u4ef6\uff09\n&#91;root@T1 ~]# tree \/var\/lib\/tftpboot\/\n\/var\/lib\/tftpboot\/\n\u251c\u2500\u2500 initrd.img                #####\/\u7cfb\u7edf\u5149\u76d8\/isolinux\/                 \n\u251c\u2500\u2500 pxelinux.0                #####\/usr\/share\/syslinux\/pxelinux.0\n\u251c\u2500\u2500 pxelinux.cfg\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 default            #####\/\u5f15\u5bfc\u914d\u7f6e\u6587\u4ef6\n\u2514\u2500\u2500 vmlinuz                   #####\/\u7cfb\u7edf\u5149\u76d8\/isolinux\/\n\n<strong>ftp\u76ee\u5f55\u4e0b\u6587\u4ef6\uff1a<\/strong>\uff08\u4e3b\u8981\u653e\u64cd\u4f5c\u7cfb\u7edf\uff09\n  # tree -L 1\n.\n\u251c\u2500\u2500 cd\n\u2514\u2500\u2500 ks.cfg\n\n<strong>\u5f15\u5bfc\u914d\u7f6e\u6587\u4ef6\uff1a<\/strong>\n&#91;root@T1 ~]# cat \/var\/lib\/tftpboot\/pxelinux.cfg\/default \ndefault auto\nlabel auto\n    kernel vmlinuz\n    append initrd=initrd.img ks=ftp:\/\/<strong>pxe_server_ip<\/strong>\/ks.cfg  method=ftp:\/\/<strong>pxe_server_ip<\/strong>\/cd\/   <strong>\/\/\u6307\u5411\u64cd\u4f5c\u7cfb\u7edf\u5b89\u88c5\u5149\u76d8LiveOS\u6240\u5728\u76ee\u5f55<\/strong>,\u65e0ks\u6587\u4ef6\u5219\u9700\u8981\u624b\u52a8\u9009\u62e9\u5b89\u88c5\u914d\u7f6e\u9879\u3002<\/code><\/pre>\n\n\n\n<p class=\"has-large-font-size\"><strong>\u4e09\u3001\u5ba2\u6237\u7aef\u914d\u7f6e<\/strong><\/p>\n\n\n\n<p>    \u5ba2\u6237\u7aef\u5185\u5b58\u5fc5\u987b\u5927\u4e8e1G\u5426\u5219\u7f51\u7edc\u5b89\u88c5\u7684\u8fc7\u7a0b\u4f1a\u63d0\u793a\u5b58\u50a8\u4e0d\u8db3\uff0c\u65e0\u6cd5\u5b89\u88c5\u3002<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e00\u3001PXE\u4ecb\u7ecd \u6240\u8c13\u7684PXE\u662fPreboot Execution Environment\u7684\u7f29\u5199\uff0c\u5b57\u9762\u4e0a\u7684\u610f\u601d\u662f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"aside","meta":{"footnotes":""},"categories":[20,36],"tags":[74,73],"class_list":["post-435","post","type-post","status-publish","format-aside","hentry","category-linux","category-36","tag-kickstart","tag-pxe","post_format-post-format-aside"],"_links":{"self":[{"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts\/435","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=435"}],"version-history":[{"count":23,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts\/435\/revisions"}],"predecessor-version":[{"id":1103,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=\/wp\/v2\/posts\/435\/revisions\/1103"}],"wp:attachment":[{"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=435"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=435"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/bigvip.dpdns.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=435"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}