PXE 引導安裝 ESXi 6.5


流程圖

借用官網文檔的流程圖,步驟如下:

1、客戶端主機從網卡引導啟動,啟動后發廣播請求,向DHCP服務器申請臨時通信IP,最終,DHCP服務器給客戶端主機分配了 192.168.31.250

同時,DHCP服務器通過參數next-server指定了TFTP服務器IP 192.168.31.212,通過參數filename指定了網絡引導映像文件 pxelinux.0

2、客戶端主機首先從TFTP服務器下載網絡引導映像文件 pxelinux.0,然后從TFTP服務器上讀取啟動菜單文件 pxelinux.cfg/default

default 文件中指定了內核文件,啟動配置文件,自動應答配置文件

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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM