Cobbler无人值守安装详解

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服务安装配置好。

注意:虚拟机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服务是批量增加的

猜你喜欢

转载自www.linuxidc.com/Linux/2017-04/142587.htm
今日推荐