營運自動化之Cobbler安裝配置

來源:互聯網
上載者:User

  Cobbler是一個快速網路安裝linux的服務,而且在經過調整也可以支援網路安裝windows。該工具使用python開發,小巧輕便才15k行代碼),使用簡單的命令即可完成PXE網路安裝環境的配置,同時還可以管理DHCP,DNS,以及yum包鏡像。 Cobbler支援命令列管理,web介面管理,還提供了API介面,可以方便二次開發使用。 和Kickstart不同的是,使用cobbler不會因為在區域網路中啟動了dhcp而導致有些機器因為預設從pxe啟動在重啟伺服器後載入tftp內容導致啟動終止。   cobbler的安裝部署配置 環境準備: 1、安裝epel rpm -Uvh 'http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm' 2、安裝dhcp服務 yum -y install dhcp 3、其他服務的安裝 額外需要的服務還有tftp,rsync,xinetd,httpd。所以如果安裝系統的時候如果這幾個包沒裝上,請手動安裝。 4、關閉selinux sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config 關閉後最好重啟一下,讓selinux的設定生效 cobbler安裝配置 1、cobbler安裝 yum -y install cobbler 2、cobbler的配置 啟動cobbler # /etc/init.d/cobblerd start 啟動httpd服務 # /etc/init.d/httpd start 檢查配置,執行 cobbler check 檢查後會出現類似於這樣的日誌 650) this.width=650;" style="background-image: none; border-right- 0px; padding-left: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image001" border="0" alt="clip_image001" src="http://www.bkjia.com/uploads/allimg/131227/194JT622-0.jpg" width="672" height="104" /> 主要的修改: 1,編輯/etc/cobbler/settings檔案,找到 server選項,修改為適當的ip地址,本執行個體配置ip為:192.168.10.1 2,編輯/etc/cobbler/settings檔案,找到 next_server選項,修改為適當的ip地址,本執行個體配置ip為:192.168.10.1 3,SELinux的設定。如果上面已經關閉了SELinux就不用管了 4,執行 cobbler get-loaders,系統將自動下載loader程式,完成提示4的修複工作。 5,編輯/etc/xinetd.d/tftp檔案,將檔案中的disable欄位的配置由yes改為no 6,編輯/etc/xinetd.d/rsync檔案,將檔案中的disable欄位的配置由yes改為no 7,在iptables中將69,80,25151連接埠開啟。如果僅僅只是在內部環境中使用,建議直接將防火牆關掉 8,提示說debmirror沒安裝。如果不是安裝 debian之類的系統,此提示可以忽略,如果需要安裝,為:http://rpmfind.net/linux/rpm2html/search.php?query=debmirrorCentOS 6使用RHEL 5的包就可以。 9,修改cobbler使用者的預設密碼,可以使用如下命令產生密碼,並使用產生後的密碼替換/etc/cobbler/settings中的密碼。產生密碼命令:openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'其中“random-phrase-here”為幹擾碼   所有提示全部fix之後,執行 /etc/init.d/cobblerd restart     cobbler的使用 1、匯入系統鏡像 cobbler import --path=/mnt --name=rhel6.1_x86_64 cobbler會將鏡像中的拷貝到本地一份,放在/var/www/cobbler/ks_mirrors下的rhel6.1_x86_64目錄下。同時會建立一個名字為rhel6.1_x86_64的一個發布版本,以及一個名字為rhel6.1_x86_64的profile檔案,次路徑可以作為今後的yum源使用 2、配置dhcp 首先修改cobbler配置,讓cobbler來管理dhcp服務,編輯檔案/etc/cobbler/settings manage_dhcp: 1 接下來修改/etc/cobbler/dhcp.template,此檔案是cobbler管理dhcp的模板 對於此檔案,本例中只需要修改如下部分 subnet 192.168.10.0 netmask 255.255.255.0 { option routers 192.168.10.1; option domain-name-servers 8.8.8.8; option subnet-mask 255.255.255.0; range dynamic-bootp 192.168.10.100 192.168.10.254; filename                   "/pxelinux.0"; default-lease-time         21600; max-lease-time             43200; next-server                $next_server; } 其餘部分維持預設值即可。 到目前為止,全部的準備工作已經就算全部完成,接下來要做的就是啟動服務了。在之前的調試過程中,很多服務已經啟動過了,這裡只需要啟動xinetd服務即可: /etc/init.d/xinetd start 同步cobbler配置 執行 cobbler sync cobbler會自動進行初始化工作,移除已經存在的啟動項,然後根據模板拷貝loader檔案。之後再產生pxe的設定檔,產生dhcp的設定檔,最後再重啟dhcp服務。 3、設定profile profile可以理解為按角色進行分類。 cobbler profile add --name=webserver --distro= rhel6.1_x86_64 kickstart=/var/lib/cobbler/kickstarts/webserver.ks cobbler的ks 檔案預設都放在/var/lib/cobbler/kickstarts/下面 可以根據不同的需求定製ks檔案   ks檔案執行個體 #platform=x86, AMD64, or Intel EM64T # System authorization information auth --useshadow --enablemd5 # System bootloader configuration bootloader --location=mbr # Partition clearing information clearpart --all --initlabel # Use text mode install text # Firewall configuration firewall --enabled # Run the Setup Agent on first boot firstboot --disable # System keyboard keyboard us # System language lang en_US # Use network installation url --url=$tree # Reboot after installation reboot #Root password rootpw --iscrypted $default_password_crypted # SELinux configuration selinux --disabled # Do not configure the X Window System skipx # System timezone timezone Asia/Shanghai # Install OS instead of upgrade install # Clear the Master Boot Record zerombr # Allow anaconda to partition the system as needed clearpart --all --initlabel part /boot --fstype=ext4 --size=256 part swap --size=1024 part / --fstype=ext4 --size=10240 part /data --fstype=ext4 --grow --size=200 %packages @base @core %end %post mkdir /data/sh mkdir /data/applogs mkdir /data/appbak 與kickstart的ks檔案不太一致,可以根據不同的業務需求編寫不同的ks檔案,以便快速的部署應用到伺服器   到此就可以安裝系統了 與kickstart不同的是可以選擇所需的作業系統安裝可以多制定一些profile 650) this.width=650;" style="background-image: none; border-right- 0px; padding-left: 0px; padding-right: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://www.bkjia.com/uploads/allimg/131227/194JU457-1.png" width="523" height="309" />

本文出自 “向夢想奔跑” 部落格,請務必保留此出處http://liyingjie.blog.51cto.com/2850660/1160264

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.