自動化安裝linux--cobbler

   

      因爲公司前期已經部署好cobbler,現在需要導入新封裝的操作系統。關鍵就是導入!!以前也沒接觸過cobbler,所以就部署一次!!。清楚裏面的流程以及原理。。。。


一、cobbler環境

系統爲 centos 6.5 ip:192.168.10.38 自動安裝系統爲centos6.5

  

 1、安裝前準備

 準備首先安裝epel-release  yum install epel-release

 然後需要關掉selinux:

 vim /etc/selinux/config 

 將selinux的值改爲distabled


 關掉iptables

 chkconfig iptables off 

 重新啓動系統使其生效。


2、安裝必要服務

   (1)cobbler    (cobbler的核心)

   (2)httpd      (提供cobbler的web界面)

   (3)dhcpd       (爲自動安裝系統分配IP地址)

   (4)epel-release (爲之提供yum源)

   (5)rsync        (cobbler需要同步信息)

   (6)cobbler-web   (cobbler的一個web插件)

   (7)xinetd         (爲rsync和tftp的守護進程)

   (8)tftp           (傳送安裝的一些文件的類似ftp)

開始安裝  yum install cobbler httpd rsync tftp-server xinetd dhcp cobbler-web


3、啓動必要服務

啓動服務:/etc/init.d/httpd restart

會出現:、

Starting httpd: httpd: apr_sockaddr_info_get() failed for Gitlab-test

httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName

需要修改:vim /etc/httpd/conf/httpd.conf

ServerName:127.0.0.1

再次重啓httpd就ok了!!

 

啓動cobbler服務

/etc/init.d/cobblerd restart


二、檢查bug


1、用cobbler check 檢查安裝情況


一般情況會出現以下:

The following are potential configuration items that you may want to fix:


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 : change 'disable' to 'no' in /etc/xinetd.d/rsync

6 : file /etc/xinetd.d/rsync does not exist

7 : debmirror package is not installed, it will be required to manage debian deployments and repositories

8 : ksvalidator was not found, install pykickstart

9 : 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

10 : 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.


2、解決問題


(1)、修改cobbler主配置文件

vim /etc/cobbler/settings

next_server: 192.168.10.38

server:192.168.10.38

manage_dhcp: 1

manage_rsync:1

保存退出

重新啓動cobblerd服務: service cobblerd restart


(2)、修改xinetd文件

vim /etc/xinetd.d/tftp

將disable的值改爲no

    vim /etc/xinetd.d/rsync

將disable的值改爲no


再次cobbler check

The following are potential configuration items that you may want to fix:


1 : dhcpd is not installed

2 : 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.

3 : file /etc/xinetd.d/rsync does not exist

4 : debmirror package is not installed, it will be required to manage debian deployments and repositories

5 : ksvalidator was not found, install pykickstart

6 : 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

7 : 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.

錯誤:說dhcpd沒有安裝

(3)、修改cobbler 內嵌的dhcpd模塊

vim /etc/cobbler/dhcp.template

ddns-update-style interim;


allow booting;

allow bootp;


ignore client-updates;

set vendorclass = option vendor-class-identifier;


option pxe-system-type code 93 = unsigned integer 16;


subnet 192.168.10.0 netmask 255.255.255.0 {

     option routers             192.168.10.5;

     option domain-name-servers 192.168.10.1;

     option subnet-mask         255.255.255.0;

     range dynamic-bootp        192.168.10.100 192.168.10.254;

     default-lease-time         21600;

     max-lease-time             43200;

     next-server                $next_server;

其他的就可以默認了。。

通過cobbler sync 來啓動dhcpd服務

當運行完cobbler sync最終會出現:

*** TASK COMPLETE ***

說明沒有問題!!!!


(4)、此時下載數據用:

cobbler get-loaders

同樣會出現

*** TASK COMPLETE ***


按照上述提供的錯誤:debmirror 是當安裝debian系統需要的文件。看着不爽可以yum安裝


(5)、安裝debmirror

yum install debmirror


需要修改: vim /etc/debmirror.conf

註釋掉兩行

#@dists="sid";

@sections="main,main/debian-installer,contrib,non-free";

#@arches="i386";

保存退出

(6)安裝cman和pykickstart

yum install cman 爲了消除那個fencing tools

yum install pykickstart 


(7)生成密碼

此時還需要生成個密碼:openssl passwd -1 -salt 'cobbler'

輸入密碼生成的密碼複製到/etc/cobbler/settings

defaults_password那個選項


三、訪問

重新啓動cobbler

此時就剩下一個沒有rsync文件了。但是實際存在的。沒關係不用管他

你可以去訪問了:http://192.168.10.38/cobbler_web

密碼和用戶都是:cobbler


四、後臺導入DVD

前提掛載鏡像: mount -o loop /tmp/****.iso /tmp/dvd

cobbler import --path=/tmp/dvd --name=任意 --arch=X86_64

會需要點時間,耐心等待!!


五、web頁面導入

import DVD

name=規範寫

架構

系統

path=掛載的路徑


profile 那要選取一下安裝的ks文件


目前我只負責到這。他們後續負責安裝系統!!


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章