cobbler_web界面設置

Cobbler作爲一個預備工具,使部署RedHat/Centos/Fedora系統更容易,同時也支持Suse和Debian系統的部署。
它提供以下服務集成:

* PXE服務支持
* DHCP服務管理
* DNS服務管理
* Kickstart服務支持
* yum倉庫管理

Cobbler客戶端Koan支持虛擬機安裝和操作系統重新安裝。

Cobbler服務器部署:

1、確保EPEL倉庫可用,如果不可用先安裝epel包:

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

2、安裝cobbler server需要的的所有包:

yum install cobbler httpd rsync tftp-server xinetd dhcp

3、啓動httpd和cobblerd,並設置爲開機自啓動:

/sbin/service httpd start
/sbin/service cobblerd start

/sbin/chkconfig httpd on
/sbin/chkconfig dhcpd on
/sbin/chkconfig xinetd on
/sbin/chkconfig tftp on
/sbin/chkconfig cobblerd on

4、檢查cobbler相關配置:

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 : you need to set some SELinux content rules to ensure cobbler works correctly in your SELinux environment, run the following: /usr/sbin/semanage fcontext -a -t public_content_t "/tftpboot/.*" && \ /usr/sbin/semanage fcontext -a -t public_content_t "/var/www/cobbler/images/.*"
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/tftp
6 : change 'disable' to 'no' in /etc/xinetd.d/rsync
7 : since iptables may be running, ensure 69, 80, and 25151 are unblocked
8 : debmirror package is not installed, it will be required to manage debian deployments and repositories
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

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

修正上面錯誤:
1)、vi /etc/cobbler/settings
server: 192.168.0.2  #設置cobbler server的IP地址
next-server: 192.168.0.2  #設置PXE server的IP地址
manage_dhcp: 1  #開啓管理DHCP服務
default_kickstart: /var/lib/cobbler/kickstarts/default.ks  #設置默認的kickstart配置文件,此文件建議用system-config-kickstart(需要X環境)生成
2)、關閉防火牆和SElinux
3)、獲取啓動鏡像
cobbler get-loaders
4)、啓動tftp和rsync
vi /etc/xinetd.d/tftp
將disable                = yes改爲:disable                = no
vi /etc/xinetd.d/rsync
將disable                = yes改爲:disable                = no

重啓xinetd服務:
/etc/init.d/xinetd restart
5)、修改DHCP模板,確保DHCP分配的地址和Cobbler在同一網段
vi
/etc/cobbler/dhcp.template
# ******************************************************************
# Cobbler managed dhcpd.conf file
#
# generated from cobbler dhcp.conf template ($date)
# Do NOT make changes to /etc/dhcpd.conf. Instead, make your changes
# in /etc/cobbler/dhcp.template, as /etc/dhcpd.conf will be
# overwritten.
#
# ******************************************************************

ddns-update-style interim;

allow booting;
allow bootp;

ignore client-updates;
set vendorclass = option vendor-class-identifier;

subnet 192.168.0.0 netmask 255.255.255.0 {
  option routers            192.168.0.1;
  # option domain-name-servers 192.168.0.2;
  option subnet-mask        255.255.255.0;
  range dynamic-bootp        192.168.0.100 192.168.0.200;
  filename                  "/pxelinux.0";
  default-lease-time        21600;
  max-lease-time            43200;
  next-server                $next_server;
}

#for dhcp_tag in $dhcp_tags.keys():
  ## group could be subnet if your dhcp tags line up with your subnets
  ## or really any valid dhcpd.conf construct ... if you only use the
  ## default dhcp tag in cobbler, the group block can be deleted for a
  ## flat configuration
# group for Cobbler DHCP tag: $dhcp_tag
group {
      #for mac in $dhcp_tags[$dhcp_tag].keys():
          #set iface = $dhcp_tags[$dhcp_tag][$mac]
  host $iface.name {
      hardware ethernet $mac;
      #if $iface.ip_address:
      fixed-address $iface.ip_address;
      #end if
      #if $iface.hostname:
      option host-name "$iface.hostname";
      #end if
      #if $iface.subnet:
      option subnet-mask $iface.subnet;
      #end if
      #if $iface.gateway:
      option routers $iface.gateway;
      #end if
      filename "$iface.filename";
      ## Cobbler defaults to $next_server, but some users
      ## may like to use $iface.system.server for proxied setups
      next-server $next_server;
      ## next-server $iface.next_server;
  }
      #end for
}
#end for

5、同步cobbler配置,使修改生效:

cobbler sync

6、掛載Linux安裝盤,生成安裝鏡像:

mount /dev/cdrom /mnt/
cobbler import --path=/mnt/ --name=CentOS-5-i386

7、RPM倉庫管理

相關閱讀:https://fedorahosted.org/cobbler/wiki/ManageYumRepos

我們可以爲cobbler添加RPM倉庫:
cobbler repo add --name=CentOS-5-i386 --mirror=http://mirrors.163.com/centos/5/os/i386/
cobbler repo add --name=EPEL-5-i386 --mirror=http://download.fedoraproject.org/pub/epel/5/i386/

同步倉庫到本地:
cobbler reposync

也可以通過設置--mirror-locally=0不下載到本地,而通過kickstart server去倉庫下載rpm包。

添加計劃任務,每天凌晨兩點進行一次同步:
crontab -e
0 2 * * * cobbler reposync --tries=3 --no-fail

8、設置profile和system

profile可以理解爲按角色進行分類。
cobbler profile add --name=webserver --distro=CentOS-5-i386 --repos=EPEL-5-i386 --kickstart=/var/lib/cobbler/kickstarts/webserver.ks

system是對待安裝機器做具體設置,如設置主機名、IP地址、hostname等,這些設置根據MAC應用到具體機器上。
cobbler system add --name=webserver1 --ip=192.168.0.110 --mac=00:0C:29:77:89:c7 --profile=webserver --kickstart=/var/lib/cobbler/kickstarts/webserver.ks --static=1
cobbler system edit --name=webserver1 --dns-name=webserver1.grid.house.sina.com.cn --hostname=webserver1.grid.house.sina.com.cn
cobbler system edit --name=webserver1 --gateway=192.168.0.1 --subnet=255.255.255.0
cobbler system edit --name=webserver1 --interface=eth1 --static=0

可以通過訪問http://192.168.0.2/cblr/svc/op/ks/system/webserver1來查看真正的kickstart配置。

9、啓動待安裝的服務器,開始安裝。

10、重新安裝

yum install koan
koan --server=192.168.0.2 --list=profiles
koan --replace-self --server=192.168.0.2 --profile=webserver
設置Cobbler web界面

Cobbler web界面是一個很好的前端,非常容易管理很多Cobbler操作。可以用它列出和編輯distros, profiles, subprofiles, systems, repos and kickstart文件。

安裝Cobbler web:
yum install cobbler-web

Cobbler web界面訪問地址:
http://192.168.0.2/cobbler_web/
(192.168.0.2爲Cobbler web server地址)

設置用戶名密碼:
爲已存在的用戶重置密碼:
htdigest /etc/cobbler/users.digest "Cobbler" cobbler
添加新用戶:
htdigest /etc/cobbler/users.digest "Cobbler" yourname

設置/etc/cobbler/modules如下:
[authentication] 
module = authn_configfile 
[authorization] 
module = authz_allowall 

重啓Cobbler服務:
service cobblerd restart
 
本次配置還遇到一些小挫折,記錄下來
 
如果配置正確但還是打不開頁面,提示404錯誤,可能http服務啓動有問題,可以重啓httpd服務 /etc/init.d/httpd restart
 
然後IE打開界面後輸入帳號無法登陸,後來用chrome可以,可能是ie版本兼容性的問題
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章