{"id":45212,"date":"2024-10-06T21:16:42","date_gmt":"2024-10-06T13:16:42","guid":{"rendered":"https:\/\/server.hk\/cnblog\/45212\/"},"modified":"2024-10-06T21:16:42","modified_gmt":"2024-10-06T13:16:42","slug":"%e9%85%8d%e7%bd%ae-pxe-%e8%87%aa%e5%8b%95%e5%8c%96%e5%ae%89%e8%a3%9d-centos-6-7","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/45212\/","title":{"rendered":"\u914d\u7f6e PXE \u81ea\u52d5\u5316\u5b89\u88dd CentOS 6.7"},"content":{"rendered":"<h1 id=\"%e9%85%8d%e7%bd%ae-pxe-%e8%87%aa%e5%8b%95%e5%8c%96%e5%ae%89%e8%a3%9d-centos-6-7-OcdGpckZGI\">\u914d\u7f6e PXE \u81ea\u52d5\u5316\u5b89\u88dd CentOS 6.7<\/h1>\n<p>\u5728\u4f3a\u670d\u5668\u7ba1\u7406\u4e2d\uff0c\u81ea\u52d5\u5316\u5b89\u88dd\u4f5c\u696d\u7cfb\u7d71\u662f\u4e00\u500b\u91cd\u8981\u7684\u6b65\u9a5f\uff0c\u7279\u5225\u662f\u5728\u9700\u8981\u5927\u898f\u6a21\u90e8\u7f72\u7684\u60c5\u6cc1\u4e0b\u3002PXE\uff08Preboot Execution Environment\uff09\u662f\u4e00\u7a2e\u7db2\u8def\u555f\u52d5\u6280\u8853\uff0c\u5141\u8a31\u7528\u6236\u901a\u904e\u7db2\u8def\u5b89\u88dd\u4f5c\u696d\u7cfb\u7d71\uff0c\u800c\u7121\u9700\u4f7f\u7528\u5149\u789f\u6216 USB \u96a8\u8eab\u789f\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u914d\u7f6e PXE \u4ee5\u81ea\u52d5\u5316\u5b89\u88dd CentOS 6.7\u3002<\/p>\n<h2 id=\"pxe-%e7%92%b0%e5%a2%83%e7%9a%84%e5%9f%ba%e6%9c%ac%e7%b5%84%e6%88%90-OcdGpckZGI\">PXE \u74b0\u5883\u7684\u57fa\u672c\u7d44\u6210<\/h2>\n<p>\u8981\u914d\u7f6e PXE \u74b0\u5883\uff0c\u60a8\u9700\u8981\u4ee5\u4e0b\u5e7e\u500b\u7d44\u4ef6\uff1a<\/p>\n<ul>\n<li><strong>DHCP \u4f3a\u670d\u5668\uff1a<\/strong>\u8ca0\u8cac\u5206\u914d IP \u5730\u5740\u4e26\u544a\u8a34\u5ba2\u6236\u7aef\u5f9e\u54ea\u88e1\u555f\u52d5\u3002<\/li>\n<li><strong>TFTP \u4f3a\u670d\u5668\uff1a<\/strong>\u7528\u65bc\u50b3\u8f38\u555f\u52d5\u6620\u50cf\u548c\u5b89\u88dd\u6a94\u6848\u3002<\/li>\n<li><strong>HTTP\/FTP \u4f3a\u670d\u5668\uff1a<\/strong>\u7528\u65bc\u63d0\u4f9b\u5b89\u88dd\u6240\u9700\u7684\u6a94\u6848\u3002<\/li>\n<\/ul>\n<h2 id=\"%e6%ad%a5%e9%a9%9f%e4%b8%80%ef%bc%9a%e5%ae%89%e8%a3%9d%e5%bf%85%e8%a6%81%e7%9a%84%e6%9c%8d%e5%8b%99-OcdGpckZGI\">\u6b65\u9a5f\u4e00\uff1a\u5b89\u88dd\u5fc5\u8981\u7684\u670d\u52d9<\/h2>\n<p>\u9996\u5148\uff0c\u60a8\u9700\u8981\u5728\u4f3a\u670d\u5668\u4e0a\u5b89\u88dd DHCP \u548c TFTP \u4f3a\u670d\u5668\u3002\u4ee5\u4e0b\u662f\u5b89\u88dd\u7684\u57fa\u672c\u6b65\u9a5f\uff1a<\/p>\n<pre><code>yum install dhcp tftp-server syslinux<\/code><\/pre>\n<h2 id=\"%e6%ad%a5%e9%a9%9f%e4%ba%8c%ef%bc%9a%e9%85%8d%e7%bd%ae-dhcp-%e4%bc%ba%e6%9c%8d%e5%99%a8-OcdGpckZGI\">\u6b65\u9a5f\u4e8c\uff1a\u914d\u7f6e DHCP \u4f3a\u670d\u5668<\/h2>\n<p>\u63a5\u4e0b\u4f86\uff0c\u60a8\u9700\u8981\u914d\u7f6e DHCP \u4f3a\u670d\u5668\u3002\u7de8\u8f2f DHCP \u914d\u7f6e\u6a94\u6848\uff1a<\/p>\n<pre><code>vi \/etc\/dhcp\/dhcpd.conf<\/code><\/pre>\n<p>\u5728\u6a94\u6848\u4e2d\u6dfb\u52a0\u4ee5\u4e0b\u5167\u5bb9\uff1a<\/p>\n<pre><code>subnet 192.168.1.0 netmask 255.255.255.0 {\n    range 192.168.1.10 192.168.1.100;\n    option routers 192.168.1.1;\n    option domain-name-servers 192.168.1.1;\n    option bootfile-name \"pxelinux.0\";\n    option tftp-server-name \"192.168.1.2\";\n}<\/code><\/pre>\n<p>\u8acb\u6839\u64da\u60a8\u7684\u7db2\u8def\u74b0\u5883\u8abf\u6574 IP \u5730\u5740\u3002<\/p>\n<h2 id=\"%e6%ad%a5%e9%a9%9f%e4%b8%89%ef%bc%9a%e9%85%8d%e7%bd%ae-tftp-%e4%bc%ba%e6%9c%8d%e5%99%a8-OcdGpckZGI\">\u6b65\u9a5f\u4e09\uff1a\u914d\u7f6e TFTP \u4f3a\u670d\u5668<\/h2>\n<p>\u63a5\u4e0b\u4f86\uff0c\u60a8\u9700\u8981\u914d\u7f6e TFTP \u4f3a\u670d\u5668\u3002\u7de8\u8f2f TFTP \u914d\u7f6e\u6a94\u6848\uff1a<\/p>\n<pre><code>vi \/etc\/xinetd.d\/tftp<\/code><\/pre>\n<p>\u78ba\u4fdd\u4ee5\u4e0b\u884c\u7684\u8a2d\u7f6e\u70ba\uff1a<\/p>\n<pre><code>disable = no<\/code><\/pre>\n<p>\u7136\u5f8c\uff0c\u91cd\u555f xinetd \u670d\u52d9\uff1a<\/p>\n<pre><code>service xinetd restart<\/code><\/pre>\n<h2 id=\"%e6%ad%a5%e9%a9%9f%e5%9b%9b%ef%bc%9a%e6%ba%96%e5%82%99-pxe-%e5%95%9f%e5%8b%95%e6%aa%94%e6%a1%88-OcdGpckZGI\">\u6b65\u9a5f\u56db\uff1a\u6e96\u5099 PXE \u555f\u52d5\u6a94\u6848<\/h2>\n<p>\u5c07 Syslinux \u7684\u555f\u52d5\u6a94\u6848\u8907\u88fd\u5230 TFTP \u6839\u76ee\u9304\uff1a<\/p>\n<pre><code>cp \/usr\/share\/syslinux\/pxelinux.0 \/var\/lib\/tftpboot\/<\/code><\/pre>\n<p>\u63a5\u4e0b\u4f86\uff0c\u5275\u5efa\u4e00\u500b\u76ee\u9304\u4f86\u5b58\u653e\u555f\u52d5\u914d\u7f6e\u6a94\u6848\uff1a<\/p>\n<pre><code>mkdir \/var\/lib\/tftpboot\/pxelinux.cfg<\/code><\/pre>\n<p>\u5728\u8a72\u76ee\u9304\u4e2d\u5275\u5efa\u4e00\u500b\u540d\u70ba <code>default<\/code> \u7684\u6a94\u6848\uff0c\u4e26\u6dfb\u52a0\u4ee5\u4e0b\u5167\u5bb9\uff1a<\/p>\n<pre><code>DEFAULT menu.c32\nPROMPT 0\nTIMEOUT 300\nONTIMEOUT local\nLABEL local\n    MENU LABEL Boot local hard drive\n    LOCALBOOT 0\nLABEL centos\n    MENU LABEL Install CentOS 6.7\n    KERNEL centos\/vmlinuz\n    APPEND initrd=centos\/initrd.img inst.repo=http:\/\/192.168.1.2\/centos\/<\/code><\/pre>\n<h2 id=\"%e6%ad%a5%e9%a9%9f%e4%ba%94%ef%bc%9a%e6%ba%96%e5%82%99-centos-%e5%ae%89%e8%a3%9d%e6%aa%94%e6%a1%88-OcdGpckZGI\">\u6b65\u9a5f\u4e94\uff1a\u6e96\u5099 CentOS \u5b89\u88dd\u6a94\u6848<\/h2>\n<p>\u5c07 CentOS 6.7 \u7684\u5b89\u88dd\u6a94\u6848\u653e\u7f6e\u5728 HTTP \u4f3a\u670d\u5668\u4e0a\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u4e0b\u8f09 ISO \u6a94\u6848\u4e26\u639b\u8f09\uff1a<\/p>\n<pre><code>mount -o loop CentOS-6.7-x86_64-bin-DVD1.iso \/mnt<\/code><\/pre>\n<p>\u7136\u5f8c\u5c07\u6a94\u6848\u8907\u88fd\u5230 HTTP \u4f3a\u670d\u5668\u7684\u6839\u76ee\u9304\uff1a<\/p>\n<pre><code>cp -r \/mnt\/* \/var\/www\/html\/centos\/<\/code><\/pre>\n<h2 id=\"%e6%ad%a5%e9%a9%9f%e5%85%ad%ef%bc%9a%e5%95%9f%e5%8b%95-pxe-%e5%ae%89%e8%a3%9d-OcdGpckZGI\">\u6b65\u9a5f\u516d\uff1a\u555f\u52d5 PXE \u5b89\u88dd<\/h2>\n<p>\u5b8c\u6210\u4e0a\u8ff0\u6b65\u9a5f\u5f8c\uff0c\u60a8\u53ef\u4ee5\u91cd\u555f\u5ba2\u6236\u7aef\u4e26\u8a2d\u7f6e\u5176\u5f9e\u7db2\u8def\u555f\u52d5\u3002\u7576\u5ba2\u6236\u7aef\u555f\u52d5\u6642\uff0c\u5b83\u5c07\u901a\u904e DHCP \u7372\u53d6 IP \u5730\u5740\uff0c\u7136\u5f8c\u5f9e TFTP \u4f3a\u670d\u5668\u4e0b\u8f09\u555f\u52d5\u6a94\u6848\uff0c\u6700\u7d42\u9032\u5165 CentOS \u7684\u5b89\u88dd\u754c\u9762\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-OcdGpckZGI\">\u7e3d\u7d50<\/h2>\n<p>\u900f\u904e PXE \u81ea\u52d5\u5316\u5b89\u88dd CentOS 6.7\uff0c\u60a8\u53ef\u4ee5\u5927\u5e45\u63d0\u9ad8\u4f3a\u670d\u5668\u90e8\u7f72\u7684\u6548\u7387\u3002\u9019\u7a2e\u65b9\u6cd5\u7279\u5225\u9069\u5408\u9700\u8981\u5feb\u901f\u90e8\u7f72\u591a\u53f0\u4f3a\u670d\u5668\u7684\u74b0\u5883\u3002\u82e5\u60a8\u9700\u8981\u9032\u4e00\u6b65\u7684\u4f3a\u670d\u5668\u89e3\u6c7a\u65b9\u6848\uff0c\u8acb\u53c3\u8003\u6211\u5011\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u670d\u52d9\uff0c\u63d0\u4f9b\u7a69\u5b9a\u7684\u4f3a\u670d\u5668\u6027\u80fd\u548c\u9748\u6d3b\u7684\u914d\u7f6e\u9078\u64c7\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5b78\u7fd2\u5982\u4f55\u914d\u7f6e PXE \u81ea\u52d5\u5316\u5b89\u88dd CentOS 6.7\uff0c\u7c21\u5316\u5b89\u88dd\u904e\u7a0b\uff0c\u63d0\u9ad8\u6548\u7387\uff0c\u9069\u5408\u4f3a\u670d\u5668\u548c\u5927\u898f\u6a21\u90e8\u7f72\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4924],"tags":[],"class_list":["post-45212","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/45212","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=45212"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/45212\/revisions"}],"predecessor-version":[{"id":45213,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/45212\/revisions\/45213"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=45212"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=45212"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=45212"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}