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版本兼容性的问题

你可能感兴趣的:(运维技术)