使用vmware測(cè)試PXE批量安裝服務(wù)器的詳細(xì)過(guò)程
一、準(zhǔn)備階段
1、準(zhǔn)備環(huán)境
Vmware workstation
Centos7一臺(tái)做pxe-server
地址:192.168.138.5
子網(wǎng)掩碼:255.255.255.0
網(wǎng)關(guān):192.168.138.2
關(guān)閉selinux和防火墻
2、安裝方式
Kickstart安裝。 Kickstart是一種無(wú)人值守的安裝方式。它的工作原理是在安裝過(guò)程中記錄典型的需要人工干預(yù)填寫(xiě)的各種參數(shù),并生成一個(gè)名為ks.cfg的文件。安裝程序首先會(huì)去查找Kickstart生成的文件,如果找到合適的參數(shù),就采用這些參數(shù);安裝程序會(huì)根據(jù)ks.cfg中的設(shè)置重啟系統(tǒng),并結(jié)束安裝。
3、網(wǎng)卡配置
網(wǎng)卡選擇hostonly模式,取消hostonly模式的dhcp功能。
二、安裝階段
因?yàn)楹竺嬉玫絪ystem-config-kickstart工具生成ks文件,它必須依賴(lài)于X Windows,所以我們要提前安裝好桌面環(huán)境。
yum-y groupinstall ‘X Window System'
yum-y groupinstall ‘GNOME Desktop Environment'
1、安裝httpd
需要http的環(huán)境存放系統(tǒng)鏡像文件和ks文件,所以先安裝http
yum install httpd
Systemctl start httpd
訪(fǎng)問(wèn)http://192.168.138.5
配置yum
mount /dev/cdrom /mnt
cd /mnt
2、安裝tftp-server
yum-y install tftp-server
修改/etc/xinetd.d/tftp,將disable的值由yes變?yōu)閚o
service tftp { socket_type = dgram protocol = udp wait = yes user = root server = /usr/sbin/in.tftpd server_args = -s /var/lib/tftpboot disable = no per_source = 11 cps = 100 2 flags = IPv4 }
重啟xinetd進(jìn)程,若沒(méi)有xinetd則需要yum安裝
systemctl restart xinetd.service
新建tftpboot文件夾
mkdir -p /var/lib/tftpboot
3、復(fù)制pxe文件
安裝syslinux,并復(fù)制pxelinux.0文件到/var/lib/tftpboot中
cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot
新建/var/www/html/cdrom,并掛載
Mount /dev/cdrom /var/www/html/cdrom
yum源配置
將光盤(pán)上的initrd.img和vmlinuxz復(fù)制到/var/lib/tftpboot中
cp /var/www/html/cdrom/images/pxeboot/initrd.img /var/lib/tftpboot
cp /var/www/html/cdrom/images/pxeboot/vmlinuz /var/lib/tftpboot
cp /var/www/html/cdrom/isolinux/boot.msg /var/lib/tftpboot
在tftpboot中新建一個(gè)pxelinux.cfg目錄
mkdir pxelinux.cfg
將cdrom目錄中的isolinux.cfg復(fù)制到pxelinux.cfg目錄中,同時(shí)更改文件名稱(chēng)為default
cp /var/www/html/cdrom/isolinux/isolinux.cfg /var/lib/tftpboot/pxelinux.cfg/default
編輯default文件
配置如下
default vesamenu.c32
timeout 6000
display boot.msg
#Clear the screen when exiting the menu, instead of leaving the menu displayed.
#For vesamenu, this means the graphical background is still displayed without
#the menu itself for as long as the screen remains in graphics mode.
menu clear
menu background splash.png
menu title CentOS 7
menu vshift 8
menu rows 18
menu margin 8
#menu hidden
menu helpmsgrow 15
menu tabmsgrow 13
#Border Area
menu color border * #00000000 #00000000 none#Selected item
menu color sel 0 #ffffffff #00000000 none#Title bar
menu color title 0 #ff7ba3d0 #00000000 none#Press [Tab] message
menu color tabmsg 0 #ff3a6496 #00000000 none#Unselected menu item
menu color unsel 0 #84b8ffff #00000000 none#Selected hotkey
menu color hotsel 0 #84b8ffff #00000000 non#Unselected hotkey
menu color hotkey 0 #ffffffff #00000000 none
#Help text
menu color help 0 #ffffffff #00000000 none#A scrollbar of some type? Not sure.
menu color scrollbar 0 #ffffffff #ff355594 none#Timeout msg
menu color timeout 0 #ffffffff #00000000 none
menu color timeout_msg 0 #ffffffff #00000000 none#Command prompt text
menu color cmdmark 0 #84b8ffff #00000000 none
menu color cmdline 0 #ffffffff #00000000 none#Do not display the actual menu unless the user presses a key. All that is displayed is a timeout message.
menu tabmsg Press Tab for full configuration options on menu items.
menu separator # insert an empty line
menu separator # insert an empty linelabel linux
menu label ^Install CentOS 7
kernel vmlinuz
#append initrd=initrd.img inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 quiet
append initrd=initrd.img repo=http://192.168.138.5/cdrom ks=http://192.168.138.5/ks.cfglabel check
menu label Test this ^media & install CentOS 7
menu default
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 rd.live.check quietmenu separator # insert an empty line
#utilities submenu
menu begin ^Troubleshooting
menu title Troubleshootinglabel vesa
menu indent count 5
menu label Install CentOS 7 in ^basic graphics mode
text help
Try this option out if you're having trouble installing
CentOS 7.
endtext
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 xdriver=vesa nomodeset quietdefault cdrom
prompt 0label rescue
menu indent count 5
menu label ^Rescue a CentOS system
text help
If the system will not boot, this lets you access files
and edit config files to try to get it booting again.
endtext
kernel vmlinuz
append initrd=initrd.img inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 rescue quietlabel memtest
menu label Run a ^memory test
text help
If your system is having issues, a problem with your
system's memory may be the cause. Use this utility to
see if the memory is working correctly.
endtext
kernel memtestlabel cdrom
kernel vmlinuz
append initrd=initrd.img ks=http://192.168.138.5/ks.cfg devfs=nomountmenu separator # insert an empty line
label local
menu label Boot from ^local drive
localboot 0xffffmenu separator # insert an empty line
menu separator # insert an empty linelabel returntomain
menu label Return to ^main menu
menu exitmenu end
重啟httpd服務(wù)
cp /var/www/html/cdrom/isolinux/vesamenu.c32 /var/lib/tftpboot/
4、安裝dhcp服務(wù)
yum –y install dhcp
cp /usr/share/doc/dhcp-4.2.5/dhcpd.conf.example /etc/dhcp/dhcpd.conf
修改dhcpd.conf
next-server 192.168.138.5; ------------------本機(jī)地址,作為ks服務(wù)器的地址
filename “pxelinux.0”;
subnet 192.168.138.0 netmask 255.255.255.0 {
range 192.168.138.10 192.168.138.50; -----------分配的地址池
option routers 192.168.138.5;
option subnet-mask 255.255.255.0;
option domain-name-servers 192.168.138.5;
default-lease-time 86400;
max-lease-time 86400;
}
配置好后啟動(dòng)dhcp
service dhcpd start
三、安裝kickstart自動(dòng)安裝工具
Yum直接安裝
yum -y install system-config-kickstart
在桌面環(huán)境下啟動(dòng)Kickstart
system-config-kickstart
分區(qū)自己看情況分配,usr目錄盡量分配4G以上
安裝包選擇桌面版可安裝圖形版,自行選擇。如果該步驟報(bào)錯(cuò),看yum配置
下面兩項(xiàng)默認(rèn)即可
配置好后file–>save
保存到該目錄下,查看ks.cfg文件
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
#Install OS instead of upgrade
install
#Keyboard layouts
keyboard ‘us'
#Root password
rootpw --iscrypted 11PObWbosO$B09PFFThWxWujr.TANYuJ.
#Use network installation
url --url=“ http://192.168.138.5/cdrom”
#System language
lang en_US
#System authorization information
auth --useshadow --passalgo=sha512
#Use graphical install
graphical
firstboot --disable
#SELinux configuration
selinux --disabled#Firewall configuration
firewall --disabled
#Network information
network --bootproto=dhcp --device=ens33
#Reboot after installation
reboot
#System timezone
timezone Asia/Shanghai
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr
#Partition clearing information
clearpart --all --initlabel
#Disk partitioning information
part / --fstype=“xfs” --size=10240
part /boot --fstype=“xfs” --size=2048
part /home --fstype=“xfs” --size=1024
part /var --fstype=“xfs” --size=2048
part /tmp --fstype=“xfs” --size=2048
part /usr --fstype=“xfs” --size=4096
part /opt --fstype=“xfs” --size=4096
part swap --fstype=“swap” --size=4096%packages
@desktop-debugging
@fonts
@gnome-desktop
@kde-desktop
@legacy-x
@x11
xterm%end
四、在客戶(hù)主機(jī)上測(cè)試
新建一個(gè)虛擬機(jī),進(jìn)pxe選擇從網(wǎng)絡(luò)加載dhcp,然后就直接自動(dòng)安裝即可
在 /var/lib/dhcpd/dhcpd.leases里可以看見(jiàn)新增機(jī)器分配的ip地址等信息
五、相關(guān)服務(wù)
systemctl start httpd
systemctl enable httpd
systemctl start dhcpd
systemctl enable dhcpd
systemctl start xinetd
自己親測(cè)可行,有問(wèn)題歡迎咨詢(xún)探討!
到此這篇關(guān)于使用vmware測(cè)試PXE批量安裝服務(wù)器的詳細(xì)過(guò)程的文章就介紹到這了,更多相關(guān)vmware測(cè)試PXE內(nèi)容請(qǐng)搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!
相關(guān)文章
解決win10家庭版VMware不能安裝64位操作系統(tǒng)問(wèn)題
這篇文章主要介紹了如何解決win10家庭版VMware不能安裝64位操作系統(tǒng)問(wèn)題,本文圖文并茂給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下2019-11-11解決VMware中安裝Centos7后無(wú)法ping通外網(wǎng)的問(wèn)題
這篇文章主要介紹了VMware中安裝Centos7后無(wú)法ping通外網(wǎng)的問(wèn)題,經(jīng)過(guò)小編的再三折騰終于找出解決方案,感興趣的朋友跟隨小編一起看看吧2019-10-10VMware虛擬機(jī)網(wǎng)絡(luò)設(shè)置的實(shí)現(xiàn)步驟(NAT、橋接、僅主機(jī))
在入門(mén)使用VMware搭建Linux的環(huán)境時(shí),對(duì)于網(wǎng)絡(luò)的設(shè)置時(shí)不可避免的,本文就來(lái)介紹一下VMware虛擬機(jī)網(wǎng)絡(luò)設(shè)置的實(shí)現(xiàn)步驟,主要有三種連接方式,感興趣的可以了解一下2023-08-08在VMware Workstation中搭建VMware vSphere(圖文教程)
這篇文章主要介紹了在VMware Workstation中搭建VMware vSphere(圖文教程),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧2020-02-02虛擬化之VMware Workstation 10.0.x安裝教程(圖文)
這篇文章主要介紹了虛擬化之VMware Workstation 10.0.x安裝教程(圖文),需要的朋友可以參考下2016-10-10VMware實(shí)現(xiàn)PXE+kickstart無(wú)人值守安裝Centos7系統(tǒng)的詳細(xì)過(guò)程
PEX是基于 Client/Server的工作模式PXE在網(wǎng)卡的ROM 中,當(dāng)計(jì)算機(jī)引導(dǎo)時(shí),BIOS把PXE Client調(diào)入內(nèi)存執(zhí)行,PXE Client 將放置在遠(yuǎn)端的文件通過(guò)網(wǎng)絡(luò)下載到本地運(yùn)行。這篇文章主要介紹了VMware實(shí)現(xiàn)PXE+kickstart無(wú)人值守安裝Centos7系統(tǒng),需要的朋友可以參考下2021-11-11Windows環(huán)境利用虛擬機(jī)Vmware安裝Mac OS10.11(圖文)
這篇文章主要介紹了Windows環(huán)境利用虛擬機(jī)Vmware安裝Mac OS10.11(圖文),小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2017-02-02VMware Workstation虛擬機(jī)固定IP配置小結(jié)(主機(jī)互通、外網(wǎng)可訪(fǎng)問(wèn))
默認(rèn)網(wǎng)絡(luò)的配置是NAT模式(N),每次重新啟動(dòng)都會(huì)對(duì)虛擬機(jī)自動(dòng)分配IP地址,使用SSH遠(yuǎn)程連接時(shí)每次都需要修改IP,本文主要介紹了VMware Workstation虛擬機(jī)固定IP配置小結(jié)(主機(jī)互通、外網(wǎng)可訪(fǎng)問(wèn)),感興趣的可以了解一下2024-07-07VMware EXSI為虛擬機(jī)centos安裝VMware Tools
這篇文章主要為大家詳細(xì)介紹了VMware EXSI為虛擬機(jī)centos安裝VMware Tools的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2016-11-11