Cobbler快速部署

Cobbler 配置

1. 環(huán)境描述

  • 系統(tǒng)環(huán)境: CentOS 7.3
  • 網(wǎng)絡(luò)環(huán)境: 有兩塊網(wǎng)卡逮栅,第一塊用來(lái)配置正常訪問(wèn)互聯(lián)網(wǎng),第二塊配另一個(gè)網(wǎng)段钱贯,這里配置172.16.1.1挫掏,用來(lái)提供無(wú)人值守安裝系統(tǒng)。
  • SELinux: 關(guān)閉狀態(tài)
  • iptables秩命、firewalld: 防火墻關(guān)閉狀態(tài)

2. 安裝部署

  1. 安裝前請(qǐng)先配好epel源尉共,然后使用yum進(jìn)行安裝:

    rpm -ivh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
    yum install cobbler cobbler-web pykickstart debmirror dhcp tftp-server httpd syslinux xinetd
    
  2. 安裝好后,把/var/lib/tftpboot/ 目標(biāo)下所有文件移動(dòng)到另一位置弃锐,因?yàn)榇四夸浵碌奈募坑蒫obbler自己來(lái)生成袄友。

    mkdir /root/pxeboot
    mv /var/lib/tftpboot/* /root/pxeboot/
    
  3. 這時(shí)再編輯/etc/dhcp/dhcpd.conf,內(nèi)容如下:

    [root@localhost ~]# cat /etc/dhcp/dhcpd.conf
    #
    # DHCP Server Configuration file.
    #   see /usr/share/doc/dhcp*/dhcpd.conf.example
    #   see dhcpd.conf(5) man page
    #
    option domain-name "localhost.localdomain";
    option domain-name-servers 114.114.114.114,223.6.6.6;
    
    default-lease-time 3600;
    max-lease-time 7200;
    
    log-facility local7;
    
    subnet 172.16.1.0 netmask 255.255.255.0 {
        range 172.16.1.2 172.16.1.20;
        option routers 172.16.1.1;
        filename "pxelinux.0";
    }
    
  4. 確保第二塊網(wǎng)卡網(wǎng)絡(luò)配置正確霹菊,這里僅作測(cè)試臨時(shí)配置:

    ifconfig enp6s0f1 172.16.1.1/24
    
  5. 依次啟動(dòng)服務(wù):

    systemctl start dhcpd.service && systemctl enable dhcpd.service
    systemctl start cobblerd.service && systemctl enable cobblerd.service
    systemctl start httpd.service && systemctl enable httpd.service
    systemctl start rsyncd.service && systemctl enable rsyncd.service
    systemctl start xinetd.service && systemctl enable xinetd.service
    
  6. 環(huán)境檢查修改:

    cobbler check
    
  • 報(bào)錯(cuò):

    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.
    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.
    3 : change 'disable' to 'no' in /etc/xinetd.d/tftp.
    4 : 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.
    5 : comment out 'dists' on /etc/debmirror.conf for proper debian support
    6 : comment out 'arches' on /etc/debmirror.conf for proper debian support
    7 : 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
    8 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them
    
  • 解決:
    1剧蚣、2: 修改/etc/cobbler/settings
    server: 172.16.1.1
    next_server: 172.16.1.1
    3: 修改/etc/xinetd.d/tftp
    disable = no
    4: 此問(wèn)題可忽略
    5、6:修改/etc/debmirror.conf旋廷,注釋掉@dists="sid"和@arches="i386"
    #@dists="sid";
    #@arches="i386";
    7: 修改默認(rèn)密碼券敌,注意,此密碼是安裝系統(tǒng)默認(rèn)的管理員root密碼
    生成密碼串
    openssl passwd -1 -salt openssl rand -hex 4
    Password:
    10a7998bbOrhhdGoYj.Ngr2yRzGuKB0 將密碼串粘貼在/etc/cobbler/settings的default_password_crypted 字段 vim /etc/cobbler/settings default_password_crypted: "10a7998bbOrhhdGoYj.Ngr2yRzGuKB0"
    8: 此問(wèn)題可忽略

接著重啟cobblerd服務(wù)柳洋,然后再執(zhí)行cobbler check進(jìn)行檢查待诅,直到只剩可忽略的問(wèn)題:

    systemctl restart cobblerd.service
    cobbler check
        The following are potential configuration items that you may want to fix:

        1 : 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.
        2 : fencing tools were not found, and are required to use the (optional) power management features. install cman or fence-agents to use them

        Restart cobblerd and then run 'cobbler sync' to apply changes.

3. cobbler_web

設(shè)置cobbler_web登錄頁(yè)面的用戶和密碼:

    htdigest /etc/cobbler/users.digest "Cobbler" cobbler
    Changing password for user cobbler in realm Cobbler
    New password: 
    Re-type new password: 
  • 提示:
    "Cobbler":Rename提示信息
    cobbler : 這個(gè)是用戶名
    /etc/cobbler/users.digest :帳號(hào)文件

  • 注意: 在cobbler-web-2.8.0-4.el7.noarch這個(gè)版本上熊镣,要通過(guò)https協(xié)議訪問(wèn)卑雁,用http協(xié)議訪問(wèn)提示403報(bào)錯(cuò)。

此時(shí)正常來(lái)說(shuō)可以從瀏覽器中通過(guò)http(s)://YOUR_COBBLERD_IP/cobbler_web訪問(wèn)绪囱。

4. 鏡像導(dǎo)入

在系統(tǒng)中將CentOS 7.3 鏡像導(dǎo)入测蹲,此功能在cobbler_web上也應(yīng)該可以操作,但沒(méi)有研究過(guò):

    mkdir /media/cdrom
    mount /var/local/iso/CentOS-7-x86_64-DVD-1611.iso /media/cdrom
    cobbler import --name="CentOS-7-x86_64-DVD-1611" --path=/media/cdrom

接著以同樣的方式導(dǎo)入CentOS 6.5鬼吵,此時(shí)在命令行可執(zhí)行cobbler distro list 可查看到已經(jīng)導(dǎo)入進(jìn)來(lái)的鏡像扣甲。默認(rèn)在導(dǎo)入鏡像的同時(shí),已經(jīng)有創(chuàng)建好了對(duì)應(yīng)的profile齿椅,可以安裝使用了琉挖,默認(rèn)是最小化安裝。profile可執(zhí)行cobbler profile list查看涣脚。
如果要自定義profile示辈,可以用下面命令操作:

    cobbler profile add --name="CentOS-7-x86_64-web" --distro=CentOS-7-x86_64-DVD-1611 --kickstart=/var/lib/cobbler/kickstarts/centos7-web.ks
    cobbler sync

最后要特別注意,每次操作后都要執(zhí)行cobbler sync來(lái)同步操作生效遣蚀。上面要用到的centos7-web.ks文件制作矾麻,這里不再介紹纱耻,可以通過(guò)system-config-kickstart圖形化工具來(lái)生成和編輯,可以使用yum來(lái)安裝:

    yum install system-config-kickstart
    
    # 啟動(dòng)可執(zhí)行:
    system-config-kickstart

關(guān)于profile险耀、ks文件制作弄喘、cobbler sync同步等,建議在cobbler_web界面上操作甩牺,比較方便蘑志。

個(gè)人同步博客地址

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末柴灯,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子费尽,更是在濱河造成了極大的恐慌赠群,老刑警劉巖,帶你破解...
    沈念sama閱讀 219,039評(píng)論 6 508
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件旱幼,死亡現(xiàn)場(chǎng)離奇詭異查描,居然都是意外死亡,警方通過(guò)查閱死者的電腦和手機(jī)柏卤,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 93,426評(píng)論 3 395
  • 文/潘曉璐 我一進(jìn)店門(mén)冬三,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái),“玉大人缘缚,你說(shuō)我怎么就攤上這事勾笆。” “怎么了桥滨?”我有些...
    開(kāi)封第一講書(shū)人閱讀 165,417評(píng)論 0 356
  • 文/不壞的土叔 我叫張陵窝爪,是天一觀的道長(zhǎng)。 經(jīng)常有香客問(wèn)我齐媒,道長(zhǎng)蒲每,這世上最難降的妖魔是什么? 我笑而不...
    開(kāi)封第一講書(shū)人閱讀 58,868評(píng)論 1 295
  • 正文 為了忘掉前任喻括,我火速辦了婚禮邀杏,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘唬血。我一直安慰自己望蜡,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 67,892評(píng)論 6 392
  • 文/花漫 我一把揭開(kāi)白布拷恨。 她就那樣靜靜地躺著泣特,像睡著了一般。 火紅的嫁衣襯著肌膚如雪挑随。 梳的紋絲不亂的頭發(fā)上状您,一...
    開(kāi)封第一講書(shū)人閱讀 51,692評(píng)論 1 305
  • 那天勒叠,我揣著相機(jī)與錄音,去河邊找鬼膏孟。 笑死眯分,一個(gè)胖子當(dāng)著我的面吹牛,可吹牛的內(nèi)容都是我干的柒桑。 我是一名探鬼主播弊决,決...
    沈念sama閱讀 40,416評(píng)論 3 419
  • 文/蒼蘭香墨 我猛地睜開(kāi)眼,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼魁淳!你這毒婦竟也來(lái)了飘诗?” 一聲冷哼從身側(cè)響起,我...
    開(kāi)封第一講書(shū)人閱讀 39,326評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤界逛,失蹤者是張志新(化名)和其女友劉穎昆稿,沒(méi)想到半個(gè)月后,有當(dāng)?shù)厝嗽跇?shù)林里發(fā)現(xiàn)了一具尸體息拜,經(jīng)...
    沈念sama閱讀 45,782評(píng)論 1 316
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡溉潭,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 37,957評(píng)論 3 337
  • 正文 我和宋清朗相戀三年,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了少欺。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片喳瓣。...
    茶點(diǎn)故事閱讀 40,102評(píng)論 1 350
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡,死狀恐怖赞别,靈堂內(nèi)的尸體忽然破棺而出畏陕,到底是詐尸還是另有隱情,我是刑警寧澤仿滔,帶...
    沈念sama閱讀 35,790評(píng)論 5 346
  • 正文 年R本政府宣布蹭秋,位于F島的核電站,受9級(jí)特大地震影響堤撵,放射性物質(zhì)發(fā)生泄漏仁讨。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,442評(píng)論 3 331
  • 文/蒙蒙 一实昨、第九天 我趴在偏房一處隱蔽的房頂上張望洞豁。 院中可真熱鬧,春花似錦荒给、人聲如沸丈挟。這莊子的主人今日做“春日...
    開(kāi)封第一講書(shū)人閱讀 31,996評(píng)論 0 22
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)曙咽。三九已至,卻和暖如春挑辆,著一層夾襖步出監(jiān)牢的瞬間例朱,已是汗流浹背孝情。 一陣腳步聲響...
    開(kāi)封第一講書(shū)人閱讀 33,113評(píng)論 1 272
  • 我被黑心中介騙來(lái)泰國(guó)打工, 沒(méi)想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留洒嗤,地道東北人箫荡。 一個(gè)月前我還...
    沈念sama閱讀 48,332評(píng)論 3 373
  • 正文 我出身青樓,卻偏偏與公主長(zhǎng)得像渔隶,于是被迫代替她去往敵國(guó)和親羔挡。 傳聞我的和親對(duì)象是個(gè)殘疾皇子,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,044評(píng)論 2 355

推薦閱讀更多精彩內(nèi)容