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

  6 Responses to “Cobbler支持UEFI”

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

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

  2. 陳哥:請問一下
    我在佈署 ubuntu-server 16.04.2 for uefi
    發現他卡在
    Trying to allocate 1723 pages for VMLINUZ
    [Linux-EFI ,setup=0x11-4 , size=0x6ba698]
    [Initrd,addr=0x3d970000,size=0x268f697]

    環境設定:參照陳哥設定cobbler與uefi上的文件
    我在 非uefi環境上 centos 7、ubuntu16.04.2都可以安裝成功
    而uefi環境上只有centos7可行,而ubuntu16.04.2卻卡在上面的訊息~一直沒法往下
    請問有需要調整dhcp相關或是其他設定,讓ubuntu可以在uefi順利跑下去嗎?

    還請解惑~~感謝

    kerwin

    • 没招。如果你真的要解决这个这个问题,你就只能去看看ubuntu的maas,他是否支持uefi安装。

  3. 咨询个问题,我是用cobbler 装的centos7.6系统, cobbler 装uefi启动的系统的时候,会有个分区问题,必须挂载到/boot/efi分区指定格式,请问这个您怎么解决的

  4. 陈哥,我就是装好之后bios可以,uefi启动如你图片,目前的版本是没有了get-loaders命令了,里面的文件我是手动拷贝进去的,是否是缺了啥

 Leave a Reply

(required)

(required)

This site uses Akismet to reduce spam. Learn how your comment data is processed.