简介
Cobbler 是一个免费开源系统安装部署软件,用于自动化网络安装操作系统;基于Python开发,是对 PXE 的二次封装,提供了 CLI 和 Web 的管理形式,也提供了API接口,方便二次开发使用。
它不仅可以安装物理机,同时也支持虚拟化、GuestOS的安装。另外,Cobbler还能结合 Puppet 等集中化管理软件,实现自动化管理。
Cobbler各组件关系:
安装过程:
- 安装Cobbler:
cobbler由epel源提供,故此需要事先配置指向 epel 的 yum 源;cobbler 会把依赖的服务一并安装,如 tftp-server、httpd;还需要安装 dncp、rsync 等。
- [root@node0 ~]# yum install cobbler pykickstart debmirror dhcp rsync cman fence-agents
- [root@node0 ~]# service httpd start
- [root@node0 ~]# chkconfig tftp on
- [root@node0 ~]# chkconfig rsync on
- 配置Cobbler:
- [root@node0 ~]# vim /etc/cobbler/settings
- server: 192.168.1.4
-
next_server: 192.168.1.4
-
[root@node0 ~]# cobbler get-loaders
- [root@node0 ~]# vim /etc/debmirror.conf
- #@dists="sid";
-
#@arches="i386";
- [root@node0 ~]# openssl passwd -1 -salt `openssl rand -hex 4`
- $1$ca6a7d72$KDte4ZK00OCLiK4PLE4tp0
- [root@node0 ~]# vim /etc/cobbler/settings
-
default_password_crypted: "$1$ca6a7d72$KDte4ZK00OCLiK4PLE4tp0"
- [root@node0 ~]# service cobblerd start
- [root@node0 ~]# chkconfig cobblerd on
- [root@node0 ~]# cobbler sync
- 配置DHCP:
- [root@node0 ~]# cp /usr/share/doc/dhcp-4.1.1/dhcpd.conf.sample /etc/dhcp/dhcpd.conf
- [root@node0 ~]# vim /etc/dhcp/dhcpd.conf
- subnet 192.168.1.0 netmask 255.255.255.0 {
- range 192.168.1.1 192.168.1.100;
- option routers 192.168.1.1;
- next-server 192.168.1.4;
- filename "pxelinux.0";
- }
- [root@node0 ~]# service dhcpd start
- [root@node0 ~]# chkconfig dhcpd on
- 添加distro:挂载镜像,添加到cobbler;
- [root@node0 ~]# mount /mnt/hgfs/lin/CentOS-6.7-x86_64-bin-DVD1.iso /mnt/cdrom/
- [root@node0 ~]# cobbler import --name=CentOS-6.7-x86_64 --path=/mnt/cdrom/ --kickstart=/root/anaconda-ks.cfg
- task started: 2016-03-08_203724_import
- task started (id=Media import, time=Tue Mar 8 20:37:24 2016)
- Found a candidate signature: breed=redhat, version=rhel6
- Found a matching signature: breed=redhat, version=rhel6
- Adding distros from path /var/www/cobbler/ks_mirror/CentOS-6.7-x86_64:
- skipping import, as distro name already exists: CentOS-6.7-x86_64
- No distros imported, bailing out
- !!! TASK FAILED !!!
- 查看当前distro:
root@node0 ~]# cobbler distro list
- CentOS-6.7-x86_64
- 测试安装:
作者:马帮学员
来源:51CTO