提取ESX/ESXI4.0腳本安裝文件ks.cfg、ks-first.cfg和ks-first-safe.cfg

ks.cfg、ks-first.cfg和ks-first-safe.cfg 3個文件爲ESX/ESXI腳本安裝文件

官方《ESXi Installable 和 vCenter Server 安裝指南》文檔中(中文手冊) 33-64頁提到的內容但是官方的文檔沒有給出默認這3個文件的內容以及如何找到3個文件。

ks-first-safe.cfg  在第一個檢測到的磁盤上安裝 ESX並將 VMFS 數據存儲保留在該磁盤上。
ks-first.cfg         在第一個檢測到的磁盤上安裝 ESX。
ks.cfg                在第一個檢測到的磁盤上安裝 ESXi。
使用 ks-first-safe.cfg 或 ks-first.cfg 安裝 ESX 時默認根密碼爲 mypassword。

ks.cfg、ks-first.cfg和ks-first-safe.cfg文件是不可見的被壓縮在 ESX/ESXI安裝鏡像中的 initrd.img 文件中initrd.img 文件位於ESX安裝鏡像中的isolinux目錄中。
提取步驟
1.提取ESX安裝鏡像中的isolinux目錄中initrd.img文件。
2.將initrd.img文件拷貝到一臺linux系統的機器中。
3.一次執行下面的命令
   mv initrd.img initrd.img.gz     
   gunzip initrd.img.gz
   cpio -i < initrd.img
   
默認ks-first.cfg和ks-first-safe.cfg文件位置爲usr/lib/vmware/weasel/examples/
    cd usr/lib/vmware/weasel/examples/ 
官方文檔中說 ks.cfg 腳本默認位於 /etc/vmware/weasel/ks.cfg。
但是小提取的時候是在usr/lib/vmware/weasel/ks.cfg
要運行默認腳本請在引導菜單上按 Tab然後鍵入 ks=file:path to file。

官方文檔中的默認腳本包含以下命令
#root Password
rootpw --iscrypted $1$MpéR&euml;&Egrave;í&Igrave;$n9sgFQJweS1PeSBpqRRu..
# Authconfig
authconfig --enableshadow --enablemd5
# BootLoader (Use grub by default.)
bootloader --location=mbr
# Timezone
timezone America/Los_Angeles --utc
#Install
install cdrom
#Network install type
network --device=MAC_address --bootproto=dhcp
#Keyboard
keyboard us
#Reboot after install?
reboot
# Clear partitions
clearpart --firstdisk
# Partitioning
part /boot --fstype=ext3 --size= --onfirstdisk
part storage1 --fstype=vmfs3 --size=10000 --grow --onfirstdisk
part None --fstype=vmkcore --size=100 --onfirstdisk
# Create the vmdk on the cos vmfs partition.
virtualdisk cos --size=5000 --onvmfs=storage1
# Partition the virtual disk.
part / --fstype=ext3 --size=0 --grow --onvirtualdisk=cos
part swap --fstype=swap --size=256 --onvirtualdisk=cos
#VMware Specific Commands
accepteula
serialnum --esx=XXXXX-XXXXX-XXXXX-XXXXX-XXXXX
# Accept the VMware End User License Agreement
vmaccepteula
# Set the root password for the DCUI and Tech Support Mode
rootpw mypassword
# Choose the first discovered disk to install onto
autopart --firstdisk --overwritevmfs
# The installation media is in the CD-ROM drive
install cdrom
# Set the network to DHCP on the first network adapater
network --bootproto=dhcp --device=vmnic0
# A sample post-install script
%post --unsupported --interpreter=python --ignorefailure=true
import time
stampFile = file('/finished.stamp', mode='w'
stampFile.write( time.asctime() )
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章