1、基礎網路建設與搭建dhcp服務
1)配置靜態ip位址並重起網絡卡
cat /etc/sysconfig/network-scripts/ifcfg-eth02)安裝配置dhcp服務device=eth0
type=ethernet
onboot=yes
nm_controlled=yes
bootproto=static
ipaddr=10.0.0.4
netmask=255.255.255.0
gateway=10.0.0.2
/etc/init.d/network restart
ifconfig eth0
yum -y install dhcp#配置自啟動vim /etc/dhcp/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
ddns-update-style none;
option domain-name-servers 202.106.0.20; #dns位址可配置2個用逗號分隔
ignore client-updates;
subnet 10.0.0.0 netmask 255.255.255.0
chkconfig tftp on
chkconfig --list tftp
chkconfig --list xinetd
#重啟動xinetd服務,tftp是由xinetd服務執行的
/etc/init.d/xinetd restart
netstat -lntup|grep 69 ;netstat -a|grep tftp
udp 0 0 0.0.0.0:69 0.0.0.0:* 1877/xinetd
udp 0 0 *:tftp
#tftp埠號為udp的69
mkdir /tftpboot
cd /tftpboot/
touch test.txt
lstest.txt
cd ..
tftp 10.0.0.4 -c get test.txt
test.txt
3、搭建http服務
#配置自啟動
#啟動http服務
#使用瀏覽器測試
4、組建pxe服務環境
1)安裝syslinux包
yum -y install syslinux
#如不安裝syslinux包就沒有pxelinux.0檔案
find / -type f -name "pxelinux.0"
/usr/share/syslinux/pxelinux.0
#將pxelinux.0拷貝到tftp服務目錄
cp /usr/share/syslinux/pxelinux.0 /tftpboot/
#在tftp服務目錄下建立pxelinux.cfg目錄
mkdir /tftpboot/pxelinux.cfg -p
2)掛載linux系統盤,拷貝linux核心,初始化映象檔案
mkdir -p /media/cdrom
mount -t iso9660 -o loop /dev/sr0 /media/cdrom
cd /media/cdrom/images/pxeboot
cp vmlinuz initrd.img /tftpboot/
cd /tftpboot/
lsinitrd.img pxelinux.0 pxelinux.cfg vmlinuz
#配置啟動選單檔案,將系統自帶的啟動檔案拷貝到tftp目錄下改名為
cp /media/cdrom/isolinux/isolinux.cfg /tftpboot/pxelinux.cfg/default
#修改啟動選單檔案
cat default5、建立kickstart檔案default auto #指定預設啟動項
prompt 0 #為0時不選擇自動按預設安裝,為1時可選擇選項安裝
label auto #配置選項auto
kernel vmlinuz #指定核心
kernel vmlinuz
kernel vmlinuz#重啟動tftp服務載入配置/etc/init.d/xinetd restart
1)安裝system-config-kickstart
yum -y install system-config-kickstart
#注意安裝桌面服務才能啟動kickstart,建立啟動檔案
/usr/bin/system-config-kickstart
cat ks.cfg#將應答指令碼拷貝到http目錄,並賦予許可權#platform=x86, amd64, or intel em64t
#version=devel
# firewall configuration關閉防火牆
firewall --disabled
# install os instead of upgrade 安裝系統install# use network installation 使用網路安裝,這裡配置http獲取安裝包
url --url=""key --skip
# root password 配置root密碼
rootpw --iscrypted $1$jisdxg2f$egt.vaheblz/ww9gnoto7.
# system authorization information 系統授權資訊
auth --useshadow --passalgo=md5
# use graphical install 圖形安裝
graphical
# system keyboard 配置鍵盤
keyboard us
# system language 配置系統語言
lang en_us
# selinux configuration 關閉selinux
selinux --disabled
# do not configure the x window system 不安裝圖形介面
skipx
# installation logging level 安裝系統日誌記錄級別
logging --level=info# reboot after installation 安裝完重新引導
reboot
# system timezone #配置時區
timezone asia/shanghai
# network information 配置網路為自動獲取
network --bootproto=dhcp --device=eth0 --onboot=on
# system bootloader configuration 系統引導程式配置
bootloader --location=mbr
# clear the master boot record 清除主引導記錄
zerombr
# partition clearing information 分割槽資訊
clearpart --all
# disk partitioning information 指定分割槽大小
part swap --fstype="swap" --size=2048part /boot --fstype="ext4" --size=200part / --fstype="ext4" --grow --size=1%packages
@base
@compat-libraries
@debugging
@development
%end
cp ks.cfg /var/www/html/
chown apache.apache /var/www/html/ks.cfg
6、啟動客戶機安裝
注意:客戶機要和伺服器在同乙個區域網內
如果使用vmware做實驗,需要關閉vmware自帶的dhcp功能
pxe批量部署
功能 批量全自動安裝作業系統 方法 dhcp 自動分配ip tftp 微系統 用來安裝系統 httpd 網路源 操作流程 檢查環境 getenforce 檢查selinux systemctl status firewalld 檢查防火牆 配置yum源 光碟源 rm rf etc yum.repos...
pxe自動化部署系統
pxe preboot excution environment 預啟動執行環境 pxe是結合httpd,dhcp,tftp服務實現系統自動化安裝,只需機器開機,網路通,機器就能自動安裝預定的系統 pxe環境的搭建大致分為三大步 一,軟體包的安裝 二,httpd,dhcp,tftp服務的配置 三,選...
pxe企業自動化部署
1 配置伺服器的基本環境 1 安裝vsftpd服務,共享ks指令碼,共享yum源 這裡的ks.cfg指令碼,我們採用在rhel7中圖形介面進行編輯,通過遠端主機傳輸到rhel8中 scp mnt ks.cfg root 192.168.1.4 var ftp ksfile 避免了手動編寫的過程。yu...