Mar 132017
 

已经好久没折腾Cobbler,这次主要目的是要解决UEFI的问题。这里主要是记录一下全过程。

已经在Dell 730测试通过,非常完美。其实我基本没做啥。Cobbler 2.8默认就支持。

实验环境

vmware workstation 在NAT网络后面进行实验,关闭NAT网络的DHCP,实验前,你先要关闭selinux,firewalld

参考文章  http://www.chenshake.com/centos-7-x-class/

EPEL

Cobbler最新版本是2.8,已经update到Epel上。

yum install epel-release

Cobbler

yum install cobbler cobbler-web dhcp syslinux pykickstart xinetd fence-agents -y

启动相关服务

systemctl start cobblerd ; systemctl enable cobblerd
systemctl start httpd ; systemctl enable httpd
systemctl start rsyncd.service ; systemctl enable rsyncd.service
systemctl start xinetd ; systemctl enable xinetd

创建一个root账号的加密密码

# openssl passwd -1
Password: 
Verifying - Password: 
$1$j6bXkl6w$D/hKqAG1e5Oz6/77tuSlR.

编辑 /etc/cobbler/settings

default_password_crypted: "$1$j6bXkl6w$D/hKqAG1e5Oz6/77tuSlR."
manage_dhcp: 1
pxe_just_once: 1
next_server: 192.168.27.10
server: 192.168.27.10

配置dhcp

这是关键,DHCP会根据客户机器请求进行区分,Bios和UEFI,不同的方式来响应。

编辑dhcp模板 /etc/cobbler/dhcp.template

subnet 192.168.27.0 netmask 255.255.255.0 {
     option routers             192.168.27.2;
     option domain-name-servers 192.168.27.10;
     option subnet-mask         255.255.255.0;
     range dynamic-bootp        192.168.27.100 192.168.27.200;
     default-lease-time         21600;
     max-lease-time             43200;
     next-server                $next_server;

     class "pxeclients" {
          match if substring (option vendor-class-identifier, 0, 9) = "PXEClient";
          if option pxe-system-type = 00:02 {
                  filename "ia64/elilo.efi";
          } else if option pxe-system-type = 00:06 {
                  filename "grub/grub-x86.efi";
          } else if option pxe-system-type = 00:07 {
                  filename "grub/grub-x86_64.efi";
          } else if option pxe-system-type = 00:09 {
                  filename "grub/grub-x86_64.efi";
          } else {
                  filename "pxelinux.0";
          }
     }
}

编辑efi的模板

# cat /etc/cobbler/pxe/efidefault.template 
default=0
timeout=10
title local
        quit
$grub_menu_items

重启和启动相关服务

systemctl restart cobblerd
cobbler get-loaders
cobbler sync
cobbler check

你会看到下面信息

# cobbler check
The following are potential configuration items that you may want to fix:

1 : debmirror package is not installed, it will be required to
 manage debian deployments and repositories

Restart cobblerd and then run 'cobbler sync' to apply changes.

debmirror,可以忽略就行。

启动DHCP服务

systemctl enable dhcpd.service
systemctl restart dhcpd.service

重启xinetd服务

systemctl restart xinetd

导入镜像

mkdir /mnt/iso
mount -o loop /root/CentOS-7-x86_64-Minimal-1611.iso /mnt/iso/
cobbler import --arch=x86_64 --path=/mnt/iso --name=CentOS7

更新操作系统签名

cobbler signature update

这时候,可以启动一个bios,一个UEFI的虚拟机来测试。

Snap41

抓包命令

tcpdump -i ens33 port 69

建议测试的时候,先启动一个bios虚拟机,确认pxe可以正常安装,再去搞UEFI的虚拟机。

如果你启动UEFI的虚拟机

Snap42

看到这个界面,其实表示还是有问题。你需要抓包来定位一下问题。

如果你看到

Snap44

现在CentOS进行安装,就会出现

Snap43

那就恭喜,你已经搞定。时间有点长,慢慢等待就可以。

 

参考文档

https://www.olindata.com/blog/2015/07/cobbler-setup-centos7

http://www.linuxtechi.com/install-and-configure-cobbler-on-centos-7/

https://access.redhat.com/discussions/1168563

https://redmine.pfsense.org/issues/5046

http://www.ipamworldwide.com/ipam/dhcp-declare-allowdeny.html 

allow known-clients;

deny known-clients;

https://www.centos.org/docs/5/html/Deployment_Guide-en-US/s1-dhcp-configuring-server.html

  2 Responses to “Cobbler支持UEFI”

  1. 陈哥咨询个问题 建立虚拟机时dhcp获取的私网ip,能否在建虚机过程中或建立后,通过脚本代入得方式把获取的ip直接写入虚拟机的配置文件,也就是虚拟机网卡配置成静态ip地址?

    • 可以的。这个其实cobbler就支持这个功能。cobbler system add + stastic就可以。这个你慢慢研究。对于centos是完全没问题。

 Leave a Reply

(required)

(required)