Prepare PXE Boot Environment for Linux (CentOS-7-1810)
Hello Friends ,
Below are details of my Setup :
- Server IP = 192.168.1.1
- Host name =auto.example.com
- OS = CentOS 7-1810
- SELinux =disabled
- Firewall =disabled
- Set Hostname of your Linux PXE Server as per below command:-
- Assign IP Address using below command:-
- Install required packages for PXE Setup using "yum"-
- Configure DHCP Server for PXE, Copy the following lines into the file ‘/etc/dhcp/dhcpd.conf’, replace the IP subnet and other details as per your environment.
# DHCP Server Configuration file.
ddns-update-style interim;
ignore client-updates;
authoritative;
allow booting;
allow bootp;
allow unknown-clients;
# internal subnet for my DHCP Server
subnet 192.168.1.1 netmask 255.255.255.0 {
range 192.168.1.1 192.168.1.50;
option domain-name-servers 192.168.1.1;
option domain-name "auto.example.com";
option routers 192.168.1.1;
option broadcast-address 192.168.1.255;
default-lease-time 600;
max-lease-time 7200;
# IP of PXE Server
next-server 192.168.1.1;
filename "pxelinux.0";
}
- Edit and Config tftp server -- /etc/xinetd.d/tftp
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
}
- Run the below commands to copy required network boot files in ‘/var/lib/tftpboot/’
# cp -v /usr/share/syslinux/menu.c32 /var/lib/tftpboot
# cp -v /usr/share/syslinux/memdisk /var/lib/tftpboot
# cp -v /usr/share/syslinux/mboot.c32 /var/lib/tftpboot
# cp -v /usr/share/syslinux/chain.c32 /var/lib/tftpboot
# mkdir /var/lib/tftpboot/pxelinux.cfg
# mkdir /var/lib/tftpboot/networkboot
- Mount CentOS 7-1810 ISO file and copy its contents to local ftp server
- Copy Kernel file (vmlimz) and initrd file from mounted iso file to ‘/var/lib/tftpboot/networkboot/’
#cp /mnt/images/pxeboot/initrd.img /var/lib/tftpboot/networkboot/
#umount /mnt/
- Create kickStart & PXE menu file.
$1$w9lGTM1l$45PV9nT27DEU9sVf2ucAz1
- Copy the following content into the new kickstart file. Please modify the kickstart file as per your needs.
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use FTP installation media
url --url="ftp://192.168.1.1/pub/"
# Root password
rootpw --iscrypted $1$w9lGTM1l$45PV9nT27DEU9sVf2ucAz1
# System authorization information
auth useshadow passalgo=sha512
# Use graphical install
graphical
firstboot disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux disabled
# Installation logging level
logging level=info
# System timezone
timezone Europe/Amsterdam
# System bootloader configuration
bootloader location=mbr
clearpart --all --initlabel
part swap --asprimary --fstype="swap" --size=1024
part /boot --fstype xfs --size=300
part pv.01 --size=1 --grow
volgroup root_vg01 pv.01
logvol / --fstype xfs --name=lv_01 --vgname=root_vg01 --size=1 --grow
%packages
@^minimal
@core
%end
%addon com_redhat_kdump --disable --reserve-mb='auto'
%end
- Create a PXE menu file (/var/lib/tftpboot/pxelinux.cfg/default), copy the following contents into the pxe menu file.
default menu.c32
prompt 0
timeout 30
MENU TITLE DIXIT PXE MENU
LABEL centos7-1810
MENU LABEL CentOS 7_X64
KERNEL /networkboot/vmlinuz
APPEND initrd=/networkboot/initrd.img inst.repo=ftp://192.168.1.1/pub ks=ftp://192.168.1.1/pub/centos7.cfg
- Start and enable xinetd, dhcp and vsftpd service.
# systemctl enable xinetd
# systemctl start dhcpd.service
# systemctl enable dhcpd.service
Created symlink from /etc/systemd/system/multi-user.target.wants/dhcpd.service to /usr/lib/systemd/system/dhcpd.service.
# systemctl start vsftpd
# systemctl enable vsftpd
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
- Give permission to centos7.cfg
- Boot the clients with pxe boot option.
No comments:
Post a Comment