PXE批量裝機

一、dhcp

yum install dhcp -y

vim /etc/dhcp/dhcpd.conf

option domain-name "bw.edu";
option domain-name-servers 192.168.100.10;
default-lease-time 3600;
max-lease-time 7200;
log-facility local7;

subnet 192.168.100.0 netmask 255.255.255.0 {
range 192.168.100.110 192.168.100.120;
option routers 192.168.100.1;
option broadcast-address 192.168.100.255;
next-server 192.168.100.10;
filename "pxelinux.0";
}

systemctl start dhcpd
systemctl enable dhcpd

二、tftp

yum install xinetd tftp-server -y

vim /etc/xinetd.d/tftp

disable = no

systemctl start xinetd
systemctl enable xinetd

三、http

yum install httpd -y

cd /var/www/html/

mkdir c75

vim /etc/fstab

/dev/cdrom /var/www/html/c75 iso9660 defaults 0 0

mount -a

systemctl start httpd
systemctl enable httpd

四、pxe

yum install syslinux -y

cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot/

cp /var/www/html/c75/isolinux/* /var/lib/tftpboot/

cd /var/lib/tftpboot

mkdir pxelinux.cfg

vim default

default auto
prompt 0
label auto
kernel vmlinuz
append initrd=initrd.img repo=http://192.168.100.10/c75 net.ifnames=0 biosdevname=0

systemctl restart xinetd

五、kickstar

vim /var/www/html/ks.cfg

#platform=x86, AMD64, Intel EM64T
#version=DEVEL
#Install OS instead of upgrade
install
#Keyboard layouts
keyboard 'us'
#Root password
rootpw --iscrypted $1$BLvzFvW5$o9hcmRp6Q1b8.OCLTKeZo/
#System timezone
timezone Asia/Shanghai
#Use network installation
url --url="http://192.168.100.10/c75"
#System language
lang en_US.UTF-8
#Firewall configuration
firewall --disabled
#System authorization information
auth --passalgo=sha512
#Use graphical install
text
firstboot --disable
#SELinux configuration
selinux --disabled

#Reboot after installation
reboot
#System bootloader configuration
bootloader --location=mbr
#Clear the Master Boot Record
zerombr
#Partition clearing information
clearpart --all --initlabel
#Disk partitioning information
part /boot --fstype="xfs" --size=256
part swap --fstype="swap" --size=512
part / --fstype="xfs" --ondisk=sda --size=1 --grow

%packagesbr/>@base
@compat-libraries
br/>@core
@development
-postfix
%end

vim /var/lib/tftpboot/pxelinux.cfg/default

default auto
prompt 0
label auto
kernel vmlinuz
append initrd=initrd.img ks=http://192.168.100.10/ks.cfg repo=http://192.168.100.10/c75 net.ifnames=0 biosdevname=0

systemctl restart xinetd

systemctl restart httpd

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章