{"id":43900,"date":"2024-10-06T11:21:15","date_gmt":"2024-10-06T03:21:15","guid":{"rendered":"https:\/\/server.hk\/cnblog\/43900\/"},"modified":"2024-10-06T11:21:16","modified_gmt":"2024-10-06T03:21:16","slug":"centos-7-%e4%b8%8b%e5%88%a9%e7%94%a8-cobbler-%e5%ae%89%e8%a3%9d%e9%83%a8%e7%bd%b2-centos","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/43900\/","title":{"rendered":"CentOS 7 \u4e0b\u5229\u7528 Cobbler \u5b89\u88dd\u90e8\u7f72 CentOS"},"content":{"rendered":"<h1 id=\"centos-7-%e4%b8%8b%e5%88%a9%e7%94%a8-cobbler-%e5%ae%89%e8%a3%9d%e9%83%a8%e7%bd%b2-centos-BmtOGjryEa\">CentOS 7 \u4e0b\u5229\u7528 Cobbler \u5b89\u88dd\u90e8\u7f72 CentOS<\/h1>\n<p>\u5728\u73fe\u4eca\u7684\u4f3a\u670d\u5668\u7ba1\u7406\u4e2d\uff0c\u81ea\u52d5\u5316\u5b89\u88dd\u7cfb\u7d71\u7684\u9700\u6c42\u65e5\u76ca\u589e\u52a0\u3002Cobbler \u662f\u4e00\u500b\u5f37\u5927\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u5e6b\u52a9\u7cfb\u7d71\u7ba1\u7406\u54e1\u5feb\u901f\u90e8\u7f72\u548c\u7ba1\u7406\u591a\u53f0\u4f3a\u670d\u5668\u3002\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u5728 CentOS 7 \u74b0\u5883\u4e0b\u5229\u7528 Cobbler \u9032\u884c CentOS \u7684\u5b89\u88dd\u90e8\u7f72\u3002<\/p>\n<h2 id=\"%e4%bb%80%e9%ba%bc%e6%98%af-cobbler%ef%bc%9f-BmtOGjryEa\">\u4ec0\u9ebc\u662f Cobbler\uff1f<\/h2>\n<p>Cobbler \u662f\u4e00\u500b Linux \u4f3a\u670d\u5668\u7684\u5feb\u901f\u90e8\u7f72\u5de5\u5177\uff0c\u4e3b\u8981\u7528\u65bc PXE\uff08Preboot Execution Environment\uff09\u555f\u52d5\u548c\u7cfb\u7d71\u5b89\u88dd\u3002\u5b83\u652f\u6301\u591a\u7a2e Linux \u767c\u884c\u7248\uff0c\u4e26\u63d0\u4f9b\u4e86\u4e00\u500b Web \u754c\u9762\u4f86\u7ba1\u7406\u5b89\u88dd\u904e\u7a0b\u3002Cobbler \u7684\u4e3b\u8981\u529f\u80fd\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\u81ea\u52d5\u5316\u5b89\u88dd\u7cfb\u7d71<\/li>\n<li>\u7ba1\u7406 DHCP \u548c TFTP \u670d\u52d9<\/li>\n<li>\u652f\u6301\u591a\u7a2e Linux \u767c\u884c\u7248<\/li>\n<li>\u63d0\u4f9b Web \u754c\u9762\u9032\u884c\u7ba1\u7406<\/li>\n<\/ul>\n<h2 id=\"%e5%ae%89%e8%a3%9d-cobbler-BmtOGjryEa\">\u5b89\u88dd Cobbler<\/h2>\n<p>\u5728 CentOS 7 \u4e0a\u5b89\u88dd Cobbler \u7684\u904e\u7a0b\u76f8\u5c0d\u7c21\u55ae\u3002\u9996\u5148\uff0c\u78ba\u4fdd\u7cfb\u7d71\u5df2\u7d93\u66f4\u65b0\uff1a<\/p>\n<pre><code>sudo yum update -y<\/code><\/pre>\n<p>\u63a5\u4e0b\u4f86\uff0c\u5b89\u88dd Cobbler \u548c\u76f8\u95dc\u7684\u4f9d\u8cf4\u5305\uff1a<\/p>\n<pre><code>sudo yum install cobbler cobbler-web -y<\/code><\/pre>\n<p>\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u555f\u52d5 Cobbler \u670d\u52d9\u4e26\u8a2d\u7f6e\u958b\u6a5f\u81ea\u555f\uff1a<\/p>\n<pre><code>sudo systemctl start cobblerd\nsudo systemctl enable cobblerd<\/code><\/pre>\n<h2 id=\"%e9%85%8d%e7%bd%ae-cobbler-BmtOGjryEa\">\u914d\u7f6e Cobbler<\/h2>\n<p>\u5728\u5b89\u88dd\u5b8c\u6210\u5f8c\uff0c\u9700\u8981\u9032\u884c\u4e00\u4e9b\u57fa\u672c\u914d\u7f6e\u3002\u9996\u5148\uff0c\u7de8\u8f2f Cobbler \u7684\u4e3b\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<pre><code>sudo vi \/etc\/cobbler\/settings<\/code><\/pre>\n<p>\u5728\u6587\u4ef6\u4e2d\uff0c\u60a8\u9700\u8981\u8a2d\u7f6e\u4ee5\u4e0b\u5e7e\u500b\u53c3\u6578\uff1a<\/p>\n<ul>\n<li><strong>next_server<\/strong>: \u8a2d\u7f6e\u70ba Cobbler \u4f3a\u670d\u5668\u7684 IP \u5730\u5740\u3002<\/li>\n<li><strong>server<\/strong>: \u8a2d\u7f6e\u70ba Cobbler \u4f3a\u670d\u5668\u7684\u4e3b\u6a5f\u540d\u6216 IP \u5730\u5740\u3002<\/li>\n<li><strong>default_password_crypted<\/strong>: \u8a2d\u7f6e\u9810\u8a2d\u7684\u5bc6\u78bc\u3002<\/li>\n<\/ul>\n<p>\u5b8c\u6210\u5f8c\uff0c\u4fdd\u5b58\u4e26\u9000\u51fa\u7de8\u8f2f\u5668\u3002\u63a5\u4e0b\u4f86\uff0c\u60a8\u9700\u8981\u914d\u7f6e DHCP \u548c TFTP \u670d\u52d9\u3002\u7de8\u8f2f DHCP \u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<pre><code>sudo vi \/etc\/cobbler\/dhcp.template<\/code><\/pre>\n<p>\u6839\u64da\u60a8\u7684\u7db2\u7d61\u74b0\u5883\uff0c\u8a2d\u7f6e DHCP \u7bc4\u570d\u548c\u9078\u9805\u3002\u5b8c\u6210\u5f8c\uff0c\u91cd\u65b0\u555f\u52d5 Cobbler \u670d\u52d9\uff1a<\/p>\n<pre><code>sudo systemctl restart cobblerd<\/code><\/pre>\n<h2 id=\"%e5%b0%8e%e5%85%a5-centos-%e5%ae%89%e8%a3%9d%e6%98%a0%e5%83%8f-BmtOGjryEa\">\u5c0e\u5165 CentOS \u5b89\u88dd\u6620\u50cf<\/h2>\n<p>\u5728 Cobbler \u4e2d\u5c0e\u5165 CentOS \u5b89\u88dd\u6620\u50cf\u662f\u4e0b\u4e00\u6b65\u3002\u9996\u5148\uff0c\u4e0b\u8f09 CentOS \u7684 ISO \u6620\u50cf\uff0c\u7136\u5f8c\u5c07\u5176\u653e\u7f6e\u5728 Cobbler \u7684\u6620\u50cf\u76ee\u9304\u4e2d\uff1a<\/p>\n<pre><code>sudo mkdir \/var\/www\/cobbler\/ks_mirror\/centos7\nsudo mount -o loop \/path\/to\/CentOS-7-x86_64-DVD-2009.iso \/mnt\nsudo cp -r \/mnt\/* \/var\/www\/cobbler\/ks_mirror\/centos7\nsudo umount \/mnt<\/code><\/pre>\n<p>\u63a5\u4e0b\u4f86\uff0c\u4f7f\u7528 Cobbler \u547d\u4ee4\u5c0e\u5165\u6620\u50cf\uff1a<\/p>\n<pre><code>sudo cobbler import --path=\/var\/www\/cobbler\/ks_mirror\/centos7 --name=centos7<\/code><\/pre>\n<h2 id=\"%e5%89%b5%e5%bb%ba%e5%92%8c%e9%85%8d%e7%bd%ae%e7%b3%bb%e7%b5%b1%e9%85%8d%e7%bd%ae-BmtOGjryEa\">\u5275\u5efa\u548c\u914d\u7f6e\u7cfb\u7d71\u914d\u7f6e<\/h2>\n<p>\u73fe\u5728\uff0c\u60a8\u53ef\u4ee5\u5275\u5efa\u4e00\u500b\u65b0\u7684\u7cfb\u7d71\u914d\u7f6e\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u5275\u5efa\u4e00\u500b\u65b0\u7684\u7cfb\u7d71\u914d\u7f6e\uff1a<\/p>\n<pre><code>sudo cobbler system add --name=myserver --profile=centos7 --ip-address=192.168.1.100 --mac-address=00:11:22:33:44:55 --hostname=myserver.localdomain<\/code><\/pre>\n<p>\u9019\u88e1\uff0c\u60a8\u9700\u8981\u6839\u64da\u5be6\u969b\u60c5\u6cc1\u66ff\u63db IP \u5730\u5740\u548c MAC \u5730\u5740\u3002\u5b8c\u6210\u5f8c\uff0c\u904b\u884c\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u66f4\u65b0 Cobbler \u914d\u7f6e\uff1a<\/p>\n<pre><code>sudo cobbler sync<\/code><\/pre>\n<h2 id=\"%e5%95%9f%e5%8b%95-pxe-%e5%ae%89%e8%a3%9d-BmtOGjryEa\">\u555f\u52d5 PXE \u5b89\u88dd<\/h2>\n<p>\u6700\u5f8c\uff0c\u78ba\u4fdd\u60a8\u7684\u5ba2\u6236\u7aef\u4f3a\u670d\u5668\u8a2d\u7f6e\u70ba\u5f9e\u7db2\u7d61\u555f\u52d5\u3002\u7576\u5ba2\u6236\u7aef\u4f3a\u670d\u5668\u555f\u52d5\u6642\uff0c\u5b83\u5c07\u901a\u904e PXE \u5f9e Cobbler \u4f3a\u670d\u5668\u7372\u53d6\u5b89\u88dd\u6620\u50cf\u4e26\u958b\u59cb\u5b89\u88dd\u904e\u7a0b\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-BmtOGjryEa\">\u7e3d\u7d50<\/h2>\n<p>\u901a\u904e\u4ee5\u4e0a\u6b65\u9a5f\uff0c\u60a8\u53ef\u4ee5\u5728 CentOS 7 \u74b0\u5883\u4e0b\u6210\u529f\u5229\u7528 Cobbler \u9032\u884c CentOS \u7684\u5b89\u88dd\u90e8\u7f72\u3002\u9019\u4e0d\u50c5\u63d0\u9ad8\u4e86\u5b89\u88dd\u6548\u7387\uff0c\u9084\u80fd\u5920\u8f15\u9b06\u7ba1\u7406\u591a\u53f0\u4f3a\u670d\u5668\u7684\u914d\u7f6e\u3002\u5982\u679c\u60a8\u9700\u8981\u9032\u4e00\u6b65\u7684\u4f3a\u670d\u5668\u89e3\u6c7a\u65b9\u6848\uff0c\u8acb\u8003\u616e\u6211\u5011\u7684 <a href=\"https:\/\/server.hk\">VPS<\/a> \u670d\u52d9\uff0c\u63d0\u4f9b\u7a69\u5b9a\u548c\u9ad8\u6548\u7684\u4f3a\u670d\u5668\u74b0\u5883\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to deploy CentOS 7 using Cobbler for efficient network-based installations and streamlined server management.<\/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-43900","post","type-post","status-publish","format-standard","hentry","category-setup-tutorials"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43900","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=43900"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43900\/revisions"}],"predecessor-version":[{"id":43901,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/43900\/revisions\/43901"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=43900"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=43900"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=43900"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}