# Installing Centos using DHCP, TFTP and Kickstart Files. We want to deploy physical nodes before cluster installation, in order to speed up the deployment, we'd like to automate most of the process, requiring us only to enter hostnames and IP address. we will need: * A DHCP Server * TFTP Server * HTTP Server * Centos ISO file * Optionally: local repo server, local dns server, local ntp server. here is s the boot menu, ! ```bash default menu.c32 prompt 0 timeout 70 ONTIMEOUT local menu title ########## PXE Boot Menu ########## label 1 menu label ^1) Install CentOS 6 x84 64 Edition kernel centos6_x86_64/images/pxeboot/vmlinuz append initrd=centos6_x86_64/images/pxeboot/initrd.img method=http://192.168.2.254/centos6_x86_64 devfs=nomount ks=http://192.168.2.254/ks.cfg ksdevice=bootif label 2 menu label ^2) Boot from local drive localboot ``` here's a template for a core kickstart file. it prompts for the IP adress, hostname, and GW. if you make changes, make sure you use. you can create such file be manually editing this template, or by using a GUI tool called [system-config-kickstart](https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/ch-redhat-config-kickstart.html). If you manually edit the file, use a tool called ```ksvalidator```, which is part of the package ```pykickstart``` to validate your file. [source on github](https://github.com/rhinstaller/pykickstart) ```bash #Generated by Kickstart Configurator + https://github.com/swisstxt/cloudstack-centos-kickstart-iso/blob/master/CentOS-6.6-x86_64-swisstxt.ks https://github.com/CentOS/Community-Kickstarts #platform=x86_64 http://www.areyouroot.com/2014/02/red-hat-kickstart-prompting-for-input.html %pre #change to tty6 to get input chvt 6 exec /dev/tty6 #Get hostname echo "What is my hostname?" read NAME #Get IP echo "What is my IP?" read ADDR #Get Gateway echo "What is the Gateway?" read GW #build /etc/sysconfig/network echo "NETWORKING=yes" > network echo "HOSTNAME=${NAME}" >> network echo "GATEWAY=${GW}" >> network #build /etc/sysconfig/network-scripts/ifcfg-eth0 echo "DEVICE=eth0" > ifcfg-eth0 echo "BOOTPROTO=none" >> ifcfg-eth0 echo "IPV6INIT=no" >> ifcfg-eth0 echo "MTU=1500" >> ifcfg-eth0 echo "NM_CONTROLLED=no" >> ifcfg-eth0 echo "ONBOOT=yes" >> ifcfg-eth0 echo "TYPE=Ethernet" >> ifcfg-eth0 echo "IPADDR=${ADDR}" >> ifcfg-eth0 echo "NETMASK=255.255.255.0" >> ifcfg-eth0 #change back to tty1 and continue script chvt 1 exec < /dev/tty1 > /dev/tty1 %end #System language lang en_US #System keyboard keyboard us #System timezone timezone --utc Europe/London #Root password rootpw --iscrypted $1$XKl0wY97$nGMXTZwNuQj8L7cL5Gx9g1 #Reboot after installation reboot #Use text mode install text #Install OS instead of upgrade install #Use Web installation url --url http://192.168.2.254/centos6_x86_64 #System bootloader configuration bootloader --location=mbr #Clear the Master Boot Record zerombr #Partition clearing information clearpart --all --initlabel #Disk partitioning information part swap --recommended part / --fstype ext4 --size 1 --grow #System authorization infomation auth --useshadow --enablemd5 #Network information #network --bootproto=static --ip=192.168.2.240 --netmask=255.255.255.0 --gateway=192.168.2.1 --nameserver=8.8.8.8 --device=eth0 #Firewall configuration firewall --disabled --ssh #Do not configure the X Window System skipx %packages @core @server-policy e4fsprogs irqbalance man-pages mlocate.x86_64 openssh-clients.x86_64 vim-enhanced.x86_64 curl.x86_64 wget.x86_64 nano.x86_64 %end %post --nochroot /usr/sbin/ntpdate -sub europe.pool.ntp.org chkconfig ntpd on # bring in hostname collected from %pre cp network /mnt/sysimage/etc/sysconfig/network . /mnt/sysimage/etc/sysconfig/network # force hostname change /mnt/sysimage/bin/hostname $HOSTNAME #copy prebuilt ifcfg-eth0 script to set IP cp ifcfg-eth0 /mnt/sysimage/etc/sysconfig/network-scripts/ifcfg-eth0 %end ``` ### helpful links * [Tips and tricks for anaconda and kickstart](http://wiki.centos.org/TipsAndTricks/KickStart) - Centos * [Kickstart Guide](https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/6/html/Installation_Guide/s1-kickstart2-startinginstall.html) - Red Hat * [Network Server Install](http://wiki.centos.org/HowTos/NetworkInstallServer) - Centos * [pxe kickstart guide for 6.3](http://sysadmin.compxtreme.ro/pxe-bootkickstart-centos-6-3-install/) - compxtreme * [pxe kickstart guide for 7](http://www.tecmint.com/install-pxe-network-boot-server-in-centos-7/) - tecmint * [set up local repo mirro](http://www.tecmint.com/setup-yum-repository-in-centos-7/) - tecmint * [Automated Installations of CentOS 7 using PXE]( http://www.tecmint.com/multiple-centos-installations-using-kickstart/) From tecmint * [Install local NTP server](http://www.thegeekstuff.com/2014/06/linux-ntp-server-client/) - thegeekstuff * [The Foreman](http://theforeman.org/) lifecycle management tool for physical and virtual servers. * [Cobbler](http://www.cobblerd.org) a Linux installation server