PXE 引导安装 ESXi 6.5

流程图

PXE 引导安装 ESXi 6.5_第1张图片

借用官网文档的流程图,步骤如下:

1、客户端主机从网卡引导启动,启动后发广播请求,向DHCP服务器申请临时通信IP,最终,DHCP服务器给客户端主机分配了 192.168.31.250
1668635-20190708165430161-320877650.jpg

同时,DHCP服务器通过参数next-server指定了TFTP服务器IP 192.168.31.212,通过参数filename指定了网络引导映像文件 pxelinux.0
PXE 引导安装 ESXi 6.5_第2张图片

2、客户端主机首先从TFTP服务器下载网络引导映像文件 pxelinux.0,然后从TFTP服务器上读取启动菜单文件 pxelinux.cfg/default
1668635-20190708165835720-161675526.jpg

default 文件中指定了内核文件,启动配置文件,自动应答配置文件
PXE 引导安装 ESXi 6.5_第3张图片

3、客户端主机依次从TFTP服务器下载内核和其他ESXi 组件,引导启动内核、安装程序

4、安装程序读取自动应答配置文件ks.cfg,实现自动化安装

准备工作

PXE Server 操作系统

CentOS Linux release 7.6.1810 (Core)

3.86 版本的 SYSLINUX 软件包
下载地址

ESXi 安装程序 ISO 映像

ESXi-6.5-U1-7967591.iso

安装配置

安装基础软件包

[root@slave-248212 ~]# yum install -y dhcp tftp-server httpd

配置 dhcp

[root@slave-248212 ~]# vi /etc/dhcp/dhcpd.conf

# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#
# option definitions common to all supported networks...
#option domain-name "example.org";
#option domain-name-servers ns1.example.org, ns2.example.org;
default-lease-time 600;
max-lease-time 7200;
# Use this to enble / disable dynamic dns updates globally.
#ddns-update-style none;
# If this DHCP server is the official DHCP server for the local
# network, the authoritative directive should be uncommented.
#authoritative;
# Use this to send dhcp log messages to a different log file (you also
# have to hack syslog.conf to complete the redirection).
log-facility local7;
# This is a very basic subnet declaration.

subnet 192.168.31.0 netmask 255.255.255.0 {
  range 192.168.31.250 192.168.31.253;
  next-server 192.168.31.212; # 指定TFTP服务器地址
  filename "pxelinux.0"; # 指定网络引导映像文件
}

配置 tftp

启用 tftp 服务

[root@slave-248212 ~]# vi /etc/xinetd.d/tftp

# default: off
# description: The tftp server serves files using the trivial file transfer \
#       protocol.  The tftp protocol is often used to boot diskless \
#       workstations, download configuration files to network-aware printers, \
#       and to start the installation process for some operating systems.
service tftp
{
        socket_type             = dgram
        protocol                = udp
        wait                    = yes
        user                    = root
        server                  = /usr/sbin/in.tftpd
        server_args             = -s /var/lib/tftpboot # TFTP服务器顶级目录
        disable                 = no    # 从yes修改为no
        per_source              = 11
        cps                     = 100 2
        flags                   = IPv4
}

解压缩 syslinux-3.86.zip,复制 pxelinux.0 到 /var/lib/tftpboot

解压缩 ESXi-6.5-U1-7967591.iso, 复制所有文件到 /var/lib/tftpboot/esxi6.5

[root@slave-248212 ~]#  ls -lh /var/lib/tftpboot
total 32K
-rw-r--r-- 1 root root  405 Jul  6 12:01 boot.msg     # 启动引导界面
drwxr-xr-x 4 root root 4.0K Jul  6 12:06 esxi6.5      # ESXi ISO 解压缩目录
-rw-r--r-- 1 root root  17K Jul  6 13:29 pxelinux.0   # syslinux-3.86.zip 解压缩文件
drwxr-xr-x 2 root root   21 Jul  6 13:34 pxelinux.cfg # 新建目录,创建配置文件default

创建启动菜单文件 boot.msg 和 default

[root@slave-248212 ~]# vi  /var/lib/tftpboot/boot.msg

___________ _____________  ___.__    ________    .________
\_   _____//   _____/\   \/  /|__|  /  _____/    |   ____/
 |    __)_ \_____  \  \     / |  | /   __  \     |____  \
 |        \/        \ /     \ |  | \  |__\  \    /       \
/_______  /_______  //___/\  \|__|  \_____  / /\/______  /
        \/        \/       \_/            \/  \/       \/

0. Boot From LocalDisk
1. Install VMWare ESXi6.5
[root@slave-248212 ~]# vi /var/lib/tftpboot/pxelinux.cfg/default
default 0
prompt 1
timeout 600
display boot.msg
##### Boot From Localdisk #####
label 0
  localboot 0xffff
##### Install VMWare esxi6.0 #####
label 1
  kernel esxi6.5/mboot.c32
  append -c esxi6.5/boot.cfg ks=http://192.168.31.212/esxi6.5/ks.cfg

配置 ks.cfg

[root@slave-248212 ~]# vi /var/www/html/esxi6.5/ks.cfg

accepteula
install --firstdisk --overwritevmfs
rootpw P@ssw0rd123
reboot

network --bootproto=static --ip=192.168.31.250 --netmask=255.255.255.0 --gateway=192.168.31.1 --hostname=192-168-31-250 --nameserver=114.114.114.114 --addvmportgroup=1

%firstboot --interpreter=busybox
vim-cmd hostsvc/enable_ssh
vim-cmd hostsvc/start_ssh
vim-cmd hostsvc/enable_esx_shell
vim-cmd hostsvc/start_esx_shell

启动服务

[root@slave-248212 ~]# systemctl start tftp && systemctl start dhcp && systemctl start httpd

转载于:https://www.cnblogs.com/liangsheng3303/p/11147926.html

你可能感兴趣的:(PXE 引导安装 ESXi 6.5)