搜尋
首頁後端開發php教程自动化运维之cobbler批量部署操作系统(一)_PHP教程

自动化运维之cobbler批量部署操作系统(一)

注:本文只介绍cobbler简单的安装和使用,进阶操作以后有时间再进行整理。
cobbler装机系统是较早前kickstart的升级版,优点比较容易配置,还自带web界面比较易于管理,不过安装cobbler-web时提示如下:
Error: Package: cobbler-web-2.6.11-1.el6.noarch (epel)
Requires: Django >= 1.4
鉴于安装Django比较麻烦,我就没有使用cobbler-web的功能。

环境:centos6.4
IP:192.168.1.105
yum源:
CentOS 5 x86_64
rpm -ivh http://dl.fedoraproject.org/pub/epel/5/x86_64/epel-release-5-4.noarch.rpm
CentOS6 x86_64:
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
CentOS6 i386:
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-7.noarch.rpm

步骤:
1.
<ol style="margin:0 1px 0 0px;padding-left:40px;" start="1" class="dp-css"><li>yum install cobbler httpd rsync tftp-server xinetd dhcp python-ctypes -y </li></ol>
2.
<ol style="margin:0 1px 0 0px;padding-left:40px;" start="1" class="dp-css"><li>cobbler check       检验cobbler,根据提示一步步解决问题 </li></ol>
[root@bogon yum.repos.d]# cobbler check
httpd does not appear to be running and proxying cobbler, or SELinux is in the way. Original traceback:
Traceback (most recent call last):
File "/usr/lib/python2.6/site-packages/cobbler/cli.py", line 252, in check_setup
s.ping()
File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__
return self.__send(self.__name, args)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request
verbose=self.__verbose
File "/usr/lib64/python2.6/xmlrpclib.py", line 1243, in request
headers
ProtocolError:

由第一行得知httpd没有启动,selinux没有关闭,所以照着提示做即可。
/etc/init.d/httpd restart && setenforce 0(或者直接更改配置文件)

然后再次运行cobbler check,提示如下:

<ol style="margin:0 1px 0 0px;padding-left:40px;" start="1" class="dp-css"><li>[root@bogon yum.repos.d]# cobbler check<br /> </li><li>The following are potential configuration items that you may want to fix:<br /></li><li><br /></li><li>1 : The 'server' field in /etc/cobbler/settings must be set to something other than localhost, or kickstarting features will not work. This should be a resolvable hostname or IP for the boot server as reachable by all machines that will use it.<br /></li><li>2 : For PXE to be functional, the 'next_server' field in /etc/cobbler/settings must be set to something other than 127.0.0.1, and should match the IP of the boot server on the PXE network.<br /></li><li>3 : SELinux is enabled. Please review the following wiki page for details on ensuring cobbler works correctly in your SELinux environment:<br /></li><li>https://github.com/cobbler/cobbler/wiki/Selinux<br /></li><li>4 : change 'disable' to 'no' in /etc/xinetd.d/tftp<br /></li><li>5 : some network boot-loaders are missing from /var/lib/cobbler/loaders, you may run 'cobbler get-loaders' to download them, or, if you only want to handle x86/x86_64 netbooting, you may ensure that you have installed a *recent* version of the syslinux package installed and can ignore this message entirely. Files in this directory, should you want to support all architectures, should include pxelinux.0, menu.c32, elilo.efi, and yaboot. The 'cobbler get-loaders' command is the easiest way to resolve these requirements.<br /></li><li>6 : change 'disable' to 'no' in /etc/xinetd.d/rsync<br /></li><li>7 : file /etc/xinetd.d/rsync does not exist<br /></li><li>8 : since iptables may be running, ensure 69, 80/443, and 25151 are unblocked<br /></li><li>9 : debmirror package is not installed, it will be required to manage debian deployments and repositories<br /></li><li>10 : ksvalidator was not found, install pykickstart<br /></li><li>11 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobbler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one<br /></li><li>12 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them<br /></li><li><br /></li><li>Restart cobblerd and then run 'cobbler sync' to apply changes. </li></ol>
除了第9.10.12这三个不用特别关注外,其他都需要修改,根据提示很简单。

3.
修改/etc/cobbler/dhcp.template ,根据实际情况配置即可,也不难。

4.
导入镜像
cobbler import --path=/media/CentOS_5.8_Final --name=CentOS5.8 --arch=x86_64
cobbler profile edit --name=centos5.4-i686-x86_64 --kickstart=kickstart路径
导入完成后使用
cobbler report查看一下

<ol style="margin:0 1px 0 0px;padding-left:40px;" start="1" class="dp-css"><li>[root@bogon ~]# cobbler report<br /> </li><li>distros:<br /></li><li>==========<br /></li><li>Name : CentOS5.8-xen-x86_64<br /></li><li>Architecture : x86_64<br /></li><li>TFTP Boot Files : {}<br /></li><li>Breed : redhat<br /></li><li>Comment : <br /></li><li>Fetchable Files : {}<br /></li><li>Initrd : /var/www/cobbler/ks_mirror/CentOS5.8-x86_64/images/xen/initrd.img<br /></li><li>Kernel : /var/www/cobbler/ks_mirror/CentOS5.8-x86_64/images/xen/vmlinuz<br /></li><li>Kernel Options : {}<br /></li><li>Kernel Options (Post Install) : {}<br /></li><li>Kickstart Metadata : {'tree': 'http://@@http_server@@/cblr/links/CentOS5.8-xen-x86_64'}<br /></li><li>Management Classes : []<br /></li><li>OS Version : rhel5<br /></li><li>Owners : ['admin']<br /></li><li>Red Hat Management Key : <<inherit>><br /></li><li>Red Hat Management Server : <<inherit>><br /></li><li>Template Files : {}<br /></li><li><br /></li><li>Name : CentOS5.8-x86_64<br /></li><li>Architecture : x86_64<br /></li><li>TFTP Boot Files : {}<br /></li><li>Breed : redhat<br /></li><li>Comment : <br /></li><li>Fetchable Files : {}<br /></li><li>Initrd : /var/www/cobbler/ks_mirror/CentOS5.8-x86_64/images/pxeboot/initrd.img<br /></li><li>Kernel : /var/www/cobbler/ks_mirror/CentOS5.8-x86_64/images/pxeboot/vmlinuz<br /></li><li>Kernel Options : {}<br /></li><li>Kernel Options (Post Install) : {}<br /></li><li>Kickstart Metadata : {'tree': 'http://@@http_server@@/cblr/links/CentOS5.8-x86_64'}<br /></li><li>Management Classes : []<br /></li><li>OS Version : rhel5<br /></li><li>Owners : ['admin']<br /></li><li>Red Hat Management Key : <<inherit>><br /></li><li>Red Hat Management Server : <<inherit>><br /></li><li>Template Files : {}<br /></li><li><br /></li><li><br /></li><li>profiles:<br /></li><li>==========<br /></li><li>Name : CentOS5.8-xen-x86_64<br /></li><li>TFTP Boot Files : {}<br /></li><li>Comment : <br /></li><li>DHCP Tag : default<br /></li><li>Distribution : CentOS5.8-xen-x86_64<br /></li><li>Enable gPXE? : 0<br /></li><li>Enable PXE Menu? : 1<br /></li><li>Fetchable Files : {}<br /></li><li>Kernel Options : {}<br /></li><li>Kernel Options (Post Install) : {}<br /></li><li>Kickstart : /var/lib/cobbler/kickstarts/sample.ks              kickstart路径<br /></li><li>Kickstart Metadata : {}<br /></li><li>Management Classes : []<br /></li><li>Management Parameters : <<inherit>><br /></li><li>Name Servers : []<br /></li><li>Name Servers Search Path : []<br /></li><li>Owners : ['admin']<br /></li><li>Parent Profile : <br /></li><li>Internal proxy : <br /></li><li>Red Hat Management Key : <<inherit>><br /></li><li>Red Hat Management Server : <<inherit>><br /></li><li>Repos : []<br /></li><li>Server Override : <<inherit>><br /></li><li>Template Files : {}<br /></li><li>Virt Auto Boot : 1<br /></li><li>Virt Bridge : xenbr0<br /></li><li>Virt CPUs : 1<br /></li><li>Virt Disk Driver Type : raw<br /></li><li>Virt File Size(GB) : 5<br /></li><li>Virt Path : <br /></li><li>Virt RAM (MB) : 512<br /></li><li>Virt Type : xenpv<br /></li><li><br /></li><li>Name : CentOS5.8-x86_64<br /></li><li>TFTP Boot Files : {}<br /></li><li>Comment : <br /></li><li>DHCP Tag : default<br /></li><li>Distribution : CentOS5.8-x86_64<br /></li><li>Enable gPXE? : 0<br /></li><li>Enable PXE Menu? : 1<br /></li><li>Fetchable Files : {}<br /></li><li>Kernel Options : {}<br /></li><li>Kernel Options (Post Install) : {}<br /></li><li>Kickstart : /var/lib/cobbler/kickstarts/sample.ks<br /></li><li>Kickstart Metadata : {}<br /></li><li>Management Classes : []<br /></li><li>Management Parameters : <<inherit>><br /></li><li>Name Servers : []<br /></li><li>Name Servers Search Path : []<br /></li><li>Owners : ['admin']<br /></li><li>Parent Profile : <br /></li><li>Internal proxy : <br /></li><li>Red Hat Management Key : <<inherit>><br /></li><li>Red Hat Management Server : <<inherit>><br /></li><li>Repos : []<br /></li><li>Server Override : <<inherit>><br /></li><li>Template Files : {}<br /></li><li>Virt Auto Boot : 1<br /></li><li>Virt Bridge : xenbr0<br /></li><li>Virt CPUs : 1<br /></li><li>Virt Disk Driver Type : raw<br /></li><li>Virt File Size(GB) : 5<br /></li><li>Virt Path : <br /></li><li>Virt RAM (MB) : 512<br /></li><li>Virt Type : kvm<br /></li><li><br /></li><li><br /></li><li>systems:<br /></li><li>==========<br /></li><li><br /></li><li>repos:<br /></li><li>==========<br /></li><li><br /></li><li>images:<br /></li><li>==========<br /></li><li><br /></li><li>mgmtclasses:<br /></li><li>==========<br /></li><li><br /></li><li>packages:<br /></li><li>==========<br /></li><li><br /></li><li>files:<br /></li><li>========== </li></ol>


<ol style="margin:0 1px 0 0px;padding-left:40px;" start="1" class="dp-css"><li>[root@bogon ~]# cobbler distro list<br /> </li><li>CentOS5.8-x86_64<br /></li><li>CentOS5.8-xen-x86_64</li></ol>
5.客户端使用pxe网络启动即自动进行安装了。




补充:
#重命名安装选项名字:
cobbler profile rename --name='old name' –newname='new name'
#册除选项:
cobbler profile rename --name='old name'




















www.bkjia.comtruehttp://www.bkjia.com/PHPjc/1110194.htmlTechArticle自动化运维之cobbler批量部署操作系统(一) 注:本文只介绍cobbler简单的安装和使用,进阶操作以后有时间再进行整理。 cobbler装机系统是...
陳述
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
PHP與Python:了解差異PHP與Python:了解差異Apr 11, 2025 am 12:15 AM

PHP和Python各有優勢,選擇應基於項目需求。 1.PHP適合web開發,語法簡單,執行效率高。 2.Python適用於數據科學和機器學習,語法簡潔,庫豐富。

php:死亡還是簡單地適應?php:死亡還是簡單地適應?Apr 11, 2025 am 12:13 AM

PHP不是在消亡,而是在不斷適應和進化。 1)PHP從1994年起經歷多次版本迭代,適應新技術趨勢。 2)目前廣泛應用於電子商務、內容管理系統等領域。 3)PHP8引入JIT編譯器等功能,提升性能和現代化。 4)使用OPcache和遵循PSR-12標準可優化性能和代碼質量。

PHP的未來:改編和創新PHP的未來:改編和創新Apr 11, 2025 am 12:01 AM

PHP的未來將通過適應新技術趨勢和引入創新特性來實現:1)適應云計算、容器化和微服務架構,支持Docker和Kubernetes;2)引入JIT編譯器和枚舉類型,提升性能和數據處理效率;3)持續優化性能和推廣最佳實踐。

您什麼時候使用特質與PHP中的抽像類或接口?您什麼時候使用特質與PHP中的抽像類或接口?Apr 10, 2025 am 09:39 AM

在PHP中,trait適用於需要方法復用但不適合使用繼承的情況。 1)trait允許在類中復用方法,避免多重繼承複雜性。 2)使用trait時需注意方法衝突,可通過insteadof和as關鍵字解決。 3)應避免過度使用trait,保持其單一職責,以優化性能和提高代碼可維護性。

什麼是依賴性注入容器(DIC),為什麼在PHP中使用一個?什麼是依賴性注入容器(DIC),為什麼在PHP中使用一個?Apr 10, 2025 am 09:38 AM

依賴注入容器(DIC)是一種管理和提供對象依賴關係的工具,用於PHP項目中。 DIC的主要好處包括:1.解耦,使組件獨立,代碼易維護和測試;2.靈活性,易替換或修改依賴關係;3.可測試性,方便注入mock對象進行單元測試。

與常規PHP陣列相比,解釋SPL SplfixedArray及其性能特徵。與常規PHP陣列相比,解釋SPL SplfixedArray及其性能特徵。Apr 10, 2025 am 09:37 AM

SplFixedArray在PHP中是一種固定大小的數組,適用於需要高性能和低內存使用量的場景。 1)它在創建時需指定大小,避免動態調整帶來的開銷。 2)基於C語言數組,直接操作內存,訪問速度快。 3)適合大規模數據處理和內存敏感環境,但需謹慎使用,因其大小固定。

PHP如何安全地上載文件?PHP如何安全地上載文件?Apr 10, 2025 am 09:37 AM

PHP通過$\_FILES變量處理文件上傳,確保安全性的方法包括:1.檢查上傳錯誤,2.驗證文件類型和大小,3.防止文件覆蓋,4.移動文件到永久存儲位置。

什麼是無效的合併操作員(??)和無效分配運算符(?? =)?什麼是無效的合併操作員(??)和無效分配運算符(?? =)?Apr 10, 2025 am 09:33 AM

JavaScript中處理空值可以使用NullCoalescingOperator(??)和NullCoalescingAssignmentOperator(??=)。 1.??返回第一個非null或非undefined的操作數。 2.??=將變量賦值為右操作數的值,但前提是該變量為null或undefined。這些操作符簡化了代碼邏輯,提高了可讀性和性能。

See all articles

熱AI工具

Undresser.AI Undress

Undresser.AI Undress

人工智慧驅動的應用程序,用於創建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用於從照片中去除衣服的線上人工智慧工具。

Undress AI Tool

Undress AI Tool

免費脫衣圖片

Clothoff.io

Clothoff.io

AI脫衣器

AI Hentai Generator

AI Hentai Generator

免費產生 AI 無盡。

熱門文章

R.E.P.O.能量晶體解釋及其做什麼(黃色晶體)
3 週前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.最佳圖形設置
3 週前By尊渡假赌尊渡假赌尊渡假赌
R.E.P.O.如果您聽不到任何人,如何修復音頻
3 週前By尊渡假赌尊渡假赌尊渡假赌
WWE 2K25:如何解鎖Myrise中的所有內容
3 週前By尊渡假赌尊渡假赌尊渡假赌

熱工具

MinGW - Minimalist GNU for Windows

MinGW - Minimalist GNU for Windows

這個專案正在遷移到osdn.net/projects/mingw的過程中,你可以繼續在那裡關注我們。 MinGW:GNU編譯器集合(GCC)的本機Windows移植版本,可自由分發的導入函式庫和用於建置本機Windows應用程式的頭檔;包括對MSVC執行時間的擴展,以支援C99功能。 MinGW的所有軟體都可以在64位元Windows平台上運作。

PhpStorm Mac 版本

PhpStorm Mac 版本

最新(2018.2.1 )專業的PHP整合開發工具

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

SublimeText3 英文版

SublimeText3 英文版

推薦:為Win版本,支援程式碼提示!

禪工作室 13.0.1

禪工作室 13.0.1

強大的PHP整合開發環境