你好,游客 登录 注册 搜索
背景:
阅读新闻

Cobbler无人值守安装详解

[日期:2017-04-07] 来源:Linux社区  作者:ymchaofeng [字体: ]

Cobbler是一个Linux服务器安装的服务,可以通过网络启动(PXE)的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理DHCP,DNS等。

Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用。

Cobbler是较早前的kickstart的升级版,优点是比较容易配置,还自带Web界面比较易于管理。
Cobbler内置了一个轻量级配置管理系统,但它也支持和其它配置管理系统集成,如Puppet,暂时不支持SaltStack。

kickstart是由dhcp、tftp、http这三种服务有机组成,为有pxe功能的客户端提供自动装机服务。kickstart只是这套系统的名字,并没有这个独立的软件。
cobbler是对kickstart进行二次开发,安装cobbler的过程中,其实已经悄悄地安装了和kickstart一样的服务,因此在工作中安装cobbler直接一条yum命令即可,不需要先把kickstart服务安装配置好。

环境
Linux CentOS6 2.6.32-642.el6.x86_64
cobbler-2.6.11-1.el6.x86_64
cobbler-web-2.6.11-1.el6.noarch
dhcp-4.1.1-51.P1.el6.centos.x86_64
tftp-server-0.49-8.el6.x86_64
pykickstart-1.74.20-1.el6.noarch
httpd-2.2.15-56.el6.centos.3.x86_64 

系统环境准备
1234567 [root@CentOS6 ~]# getenforce
Disabled
[root@CentOS6 ~]# /etc/init.d/iptables status
iptables: Firewall is not running.
[root@CentOS6 ~]#  cat /etc/RedHat-release
CentOS release 6.8 (Final)
[root@CentOS6 ~]#wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo

注意:虚拟机VMware模式的DHCP服务关闭,同一台机器上面不允许两个DHCP服务

Cobbler安装配置
[root@CentOS6 ~]#  yum -y install cobbler cobbler-web dhcp tftp-server pykickstart httpd
[root@CentOS6 ~]# /etc/init.d/httpd restart
[root@CentOS6 ~]# /etc/init.d/cobblerd restart
[root@CentOS6 ~]# /etc/init.d/xinetd restart

[root@CentOS6 ~]#  rpm -ql cobbler
/etc/cobbler                  # 配置文件目录
/etc/cobbler/settings        # cobbler主配置文件,这个文件是YAML格式,Cobbler是python写的程序。
/etc/cobbler/dhcp.template    # DHCP服务的配置模板
/etc/cobbler/tftpd.template  # tftp服务的配置模板
/etc/cobbler/rsync.template  # rsync服务的配置模板
/etc/cobbler/iso              # iso模板配置文件目录
/etc/cobbler/pxe              # pxe模板文件目录
/etc/cobbler/power            # 电源的配置文件目录
/etc/cobbler/users.conf      # Web服务授权配置文件
/etc/cobbler/users.digest    # 用于web访问的用户名密码配置文件
/etc/cobbler/dnsmasq.template # DNS服务的配置模板
/etc/cobbler/modules.conf    # Cobbler模块配置文件
/var/lib/cobbler              # Cobbler数据目录
/var/lib/cobbler/config      # 配置文件
/var/lib/cobbler/kickstarts  # 默认存放kickstart文件
/var/lib/cobbler/loaders      # 存放的各种引导程序
/var/www/cobbler              # 系统安装镜像目录
/var/www/cobbler/ks_mirror    # 导入的系统镜像列表
/var/www/cobbler/images      # 导入的系统镜像启动文件
/var/www/cobbler/repo_mirror  # yum源存储目录
/var/log/cobbl              # 日志目录
/var/log/cobbler/install.log  # 客户端系统安装日志
/var/log/cobbler/cobbler.log  # cobbler日志

配置Cobbler
[root@CentOS6 ~]# 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 th
em, 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  # 这是一个bug
7 : debmirror package is not installed, it will be required to manage debian deployments and repositories
8 : The default password used by the sample templates for newly installed machines (default_password_crypted in /etc/cobb
ler/settings) is still set to 'cobbler' and should be changed, try: "openssl passwd -1 -salt 'random-phrase-here' 'your-password-here'" to generate new one9 : 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.
12345678 [root@CentOS6 ~]cp /etc/cobbler/settings{,.ori}  ##备份
1.[root@CentOS6 ~]# sed -i 's#server: 127.0.0.1#server: 172.16.1.101#' /etc/cobbler/settings    ###指定cobbler服务器地址
2.[root@CentOS6 ~]#sed -i 's#yes#no#' /etc/xinetd.d/rsync 
3.[root@CentOS6 ~]# sed 's#manage_dhcp: 0#manage_dhcp: 1#'  /etc/cobbler/settings  ##用Cobbler管理DHCP
4.[root@CentOS6 ~]# sed -n 's/pxe_just_once: 0/ pxe_just_once: 1/' /etc/cobbler/settings  ##防止循环装系统,适用于服务器第一启动项是PXE启动。务
5.[root@CentOS6 ~]# sed -i 's#yes#no#' /etc/xinetd.d/tftp 
6.[root@CentOS6 ~]# sed -ri "/default_password_crypted/s#(.*: ).*#\1\"`openssl passwd -1 -salt 'oldboy' '123456'`\"#" /etc/cobbler/settings
7.[root@CentOS6 ~]# sed -i 's/next_server: 127.0.0.1/next_server: 172.16.1.101/' /etc/cobbler/settings

问题4解决方法

####http://pan.baidu.com/s/1kVqhMT5###需要从官网下载,我这里已经下载好了。
tar xfP cobbler_load.tar.gz

配置DHCP
[root@CentOS6 ~] vim /etc/cobbler/dhcp.template
:%s/192.168.1/172.16.1/g

镜像挂载
[root@CentOS6 ~]# mount /dev/cdrom /mnt

rsync服务是批量增加的

更多详情见请继续阅读下一页的精彩内容http://www.linuxidc.com/Linux/2017-04/142587p2.htm

linux
本文评论   查看全部评论 (0)
表情: 表情 姓名: 字数

       

评论声明
  • 尊重网上道德,遵守中华人民共和国的各项有关法律法规
  • 承担一切因您的行为而直接或间接导致的民事或刑事法律责任
  • 本站管理人员有权保留或删除其管辖留言中的任意内容
  • 本站有权在网站内转载或引用您的评论
  • 参与本评论即表明您已经阅读并接受上述条款