Configuring PXE Server and Installing system with Kickstart files
KickStart With Anaconda and its method
Creating a kickststart system file and its installation.
Getting ready
$ vagrant up
$ vagrant ssh
How to do it
Now first disable some process
Firewall
$ sudo systemctl disable firewalld
Iptables
$ sudo systemctl mask iptables
SELinux
$ sudo vi /etc/sysconfig/selinux
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these three values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
:wq
Reboot the system
Now install some package
$ sudo yum install dhcpd xinetd vsftpd tftp-server tftp
Now configure the service
$ systemctl enable dhcp vsftpd xinetd
$ systemctl enable tftp.socket
Now copy the centos package
$ sudo mount -t iso9660 CentOS-7-x86_64-DVD-1511.iso /mnt/new
$ sudo cp -av /mnt/new/* /var/ftp/pub
Now configure kickstart file
Encode for client root password
$ sudo openssl passwd -1 "000000"
$1$SJZmjGr1$4dpC3vD/j4HCed/I5s1O91
$ sudo vim /var/ftp/pub/ks.cfg
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall --disabled
# Install OS instead of upgrade
install
# Use NFS installation media
url --url="ftp://192.168.4.44/pub/"
# Root password [i used here 000000]
rootpw --iscrypted $1$SJZmjGr1$4dpC3vD/j4HCed/I5s1O91.
# 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=200
part pv.01 --size=1 --grow
volgroup rootvg01 pv.01
logvol / --fstype xfs --name=lv01 --vgname=rootvg01 --size=1 --grow
Now configure the tftp server file
$ sudo vim /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
}
Now Copy tftp-server network boot file in /var/lib/tftpboot
$ sudo cp /usr/share/syslinux/pxelinux.0 /var/lib/tftpboot
$ sudo cp /usr/share/syslinux/menu.c32 /var/lib/tftpboot
$ sudo cp /usr/share/syslinux/memdisk /var/lib/tftpboot
$ sudo cp /usr/share/syslinux/mboot.c32 /var/lib/tftpboot
$ sudo cp /usr/share/syslinux/chain.c32 /var/lib/tftpboot
Make directory name netboot
$ sudo mkdir /var/lib/tftpboot/netboot
Now copy some file in netboot
$ sudo cp /var/ftp/pub/images/pxeboot/vmlinuz /var/lib/tftpboot/netboot/
$ sudo cp /var/ftp/pub/images/pxeboot/initrd.img /var/lib/tftpboot/netboot/
Make another directory pxelinux.cfg
$ sudo mkdir /var/lib/tftpboot/pxelinux.cfg
Now create pxe menu file
$ sudo vim /tftpboot/pxelinux.cfg/default
default menu.c32
prompt 0
timeout 30
MENU TITLE cloudyuga.guru PXE Menu
LABEL centos7_x64
MENU LABEL CentOS 7 X64
KERNEL /netboot/vmlinuz
APPEND initrd=/netboot/initrd.img inst.repo=ftp://192.168.4.44/pub ks=ftp://192.168.4.44/pub/ks.cfg
That last Configure dhcp-server
$ sudo vi /etc/dhcp/dhcpd.conf
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp-server/dhcpd.conf.example
# see dhcpd.conf(5) man page
#
ddns-update-style interim;
ignore client-updates;
authoritative;
allow booting;
allow bootp;
allow unknown-clients;
subnet 192.168.4.0 netmask 255.255.255.0 {
option routers 192.168.4.254;
option subnet-mask 255.255.255.0;
option domain-search "cloudyuga.com";
option domain-name-servers 192.168.4.1;
option time-offset -18000; # Eastern Standard Time
range 192.168.4.10 192.168.4.100;
next-server 192.168.4.44; # DHCP server ip
filename "pxelinux.0";
}
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option broadcast-address 192.168.4.255;
option routers 192.168.4.254;
option domain-name-servers 192.168.4.1, 192.168.4.2;
option domain-search "cloudyuga.com";
Now finally restart all the required service
$ sudo systemctl restart dhcpd xined vsftpd
How it work
*