Cobbler是一个Linux服务器安装的服务,可以通过网络启动(PXE)的方式来快速安装、重装物理服务器和虚拟机,同时还可以管理DHCP,DNS等。
Cobbler可以使用命令行方式管理,也提供了基于Web的界面管理工具(cobbler-web),还提供了API接口,可以方便二次开发使用。
Cobbler是较早前的kickstart的升级版,优点是比较容易配置,还自带web界面比较易于管理。
Cobbler内置了一个轻量级配置管理系统,但它也支持和其它配置管理系统集成,如Puppet,暂时不支持SaltStack。
Cobbler官网http://cobbler.github.io
所用到的环境
Server: CentOS 7
client: CentOS 6
# yum -y install httpd dhcp tftp cobbler cobbler-web pykickstart xinetd
# systemctl start httpd
systemctl start cobblerd
`# 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 thg features will not work. This should be a resolvable hostname or IP for the boo machines that will use it.
2. For PXE to be functional, the ‘next_server‘ field in /etc/cobbler/settings mu 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 download them, or, if you only want to handle x86/x86_64 netbooting, you may ensa *recent* version of the syslinux package installed and can ignore this message ectory, should you want to support all architectures, should include pxelinux.0, oot. The ‘cobbler get-loaders‘ command is the easiest way to resolve these requir
5. enable and start rsyncd.service with systemctl
6. debmirror package is not installed, it will be required to manage debian depl
7. The default password used by the sample templates for newly installed machinein /etc/cobbler/settings) is still set to ‘cobbler‘ and should be changed, try: "dom-phrase-here‘ ‘your-password-here‘" to generate new one
8. fencing tools were not found, and are required to use the (optional) power maman or fence-agents to use them
Restart cobblerd and then run ‘cobbler sync‘ to apply changes.
272 next_server: 192.168.30.45
384 server: 192.168.30.45
把disable = yes
改disable = no
####启动rsync
# systemctl start rsyncd
####下载所需的文件 cobbler get-loaders
####生成密码:
# openssl passwd -1 -salt ‘cobler‘ ‘cobler‘
####修改 /etc/cobbler/settings 把刚刚生成的密码放进去.
在101行 default_password_crypted: "$1$cobler$XJnisBweZJlhL651HxAM00"
####重启cobbler服务systemctl restart cobblerd
####再次检查
# cobbler check(以下这三点可以忽略对后续实验没什么影响)
The following are potential configuration items that you may want to fix:
1 : enable and start rsyncd.service with systemctl
2 : debmirror package is not installed, it will be required to manage debian deployments and repositories
3 : 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.
####修改dchp管理、及dhcp模版文件
vim /etc/cobbler/settings
242 manage_dhcp: 1`
编辑dhcp的模版文件
# vim /etc/cobbler/dhcp.template 改成局域网的地址断
subnet 192.168.30.0 netmask 255.255.255.0 {
option routers 192.168.30.1;
option domain-name-servers 192.168.30.1;
option subnet-mask 255.255.255.0;
range dynamic-bootp 192.168.30.210 192.168.30.220;
default-lease-time 21600;
max-lease-time 43200;
next-server $next_server;
重启 # systemctl restart cobblerd
自动生成dhcp配置文件 # cobbler sync
挂载镜像:
# mount /dev/sr0 /mnt
定义仓库
# cobbler import --path=/mnt/ --name=CentOS-7-x86_64 --arch=x86_64
# cobbler import --path=/mnt/ --name=CentOS-6-x86_64 --arch=x86_64
镜像导入目录:
/var/www/cobbler/ks_mirror
查看都有哪些文件
# cobbler profile
usage
=====
cobbler profile add
cobbler profile copy
cobbler profile dumpvars
cobbler profile edit
cobbler profile find
cobbler profile getks
cobbler profile list
cobbler profile remove
cobbler profile rename
cobbler profile report
修改自定义kickstart配置文件
# cobbler profile edit --name=CentOS-7-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS-7-x84_64.cfg
# cobbler profile edit --name=CentOS-6-x86_64 --kickstart=/var/lib/cobbler/kickstarts/CentOS-6-x84_64.cfg
修改7的网卡名称为eth0
# cobbler profile edit --name=CentOS-7-x86_64 --kopts=‘net.ifnames=0 biosdevname=0‘
查看配置
[root@web ~]# cobbler profile report
Name : CentOS-7-x86_64
TFTP Boot Files : {}
Comment :
DHCP Tag : default
Distribution : CentOS-7-x86_64
Enable gPXE? : 0
Enable PXE Menu? : 1
Fetchable Files : {}
Kernel Options : {‘biosdevname‘: ‘0‘, ‘net.ifnames‘: ‘0‘}
Kernel Options (Post Install) : {}
Kickstart : /var/lib/cobbler/kickstarts/CentOS-7-x84_64.cfg
Kickstart Metadata : {}
Management Classes : []
Management Parameters : <<inherit>>
Name Servers : []
Name Servers Search Path : []
Owners : [‘admin‘]
Parent Profile :
Internal proxy :
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Repos : [‘openstack-queens‘]
Server Override : <<inherit>>
Template Files : {}
Virt Auto Boot : 1
Virt Bridge : xenbr0
Virt CPUs : 1
Virt Disk Driver Type : raw
Virt File Size(GB) : 5
Virt Path :
Virt RAM (MB) : 512
Virt Type : kvm
Name : CentOS-6-x86_64
TFTP Boot Files : {}
Comment :
DHCP Tag : default
Distribution : CentOS-6-x86_64
Enable gPXE? : 0
Enable PXE Menu? : 1
Fetchable Files : {}
Kernel Options : {}
Kernel Options (Post Install) : {}
Kickstart : /var/lib/cobbler/kickstarts/CentOS-6-x86_64.cfg
Kickstart Metadata : {}
Management Classes : []
Management Parameters : <<inherit>>
Name Servers : []
Name Servers Search Path : []
Owners : [‘admin‘]
Parent Profile :
Internal proxy :
Red Hat Management Key : <<inherit>>
Red Hat Management Server : <<inherit>>
Repos : []
Server Override : <<inherit>>
Template Files : {}
Virt Auto Boot : 1
Virt Bridge : xenbr0
Virt CPUs : 1
Virt Disk Driver Type : raw
Virt File Size(GB) : 5
Virt Path :
Virt RAM (MB) : 512
Virt Type : kvm
配置好所有操作之后记得从新生成
# cobbler sync
到这为止cobbler自动安装系统server已经安装完成了,接下来就是找台客户端来验证
原文地址:http://blog.51cto.com/dklwj/2095544