Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide


  1. 1. 1. Setting up a PXE kickstart serverSubmitted by itchyadmin on Tue, 09/08/2009 - 10:28VersionCentOS 5.3Configure the tftp serverFirst make sure that tftp-server rpm is installed, if not then install it# rpm -qa | grep tftp-server# yum install tftp-serverLoaded plugins: fastestmirrorLoading mirror speeds from cached hostfile * base: * updates: * addons: * extras: mirror.answerstolove.comSetting up Install ProcessParsing package install argumentsResolving Dependencies--> Running transaction check---> Package tftp-server.x86_64 0:0.42-3.1.el5.centos set to be updated--> Finished Dependency ResolutionDependencies Resolved============================================================================================================================================================= Package ArchVersion RepositorySize=============================================================================================================================================================Installing: tftp-server x86_64 0.42-3.1.el5.centos base 29kTransaction Summary=============================================================================================================================================================Install 1 Package(s)Update 0 Package(s)Remove 0 Package(s)Total download size: 29 k
  2. 2. Is this ok [y/N]: yDownloading Packages:tftp-server-0.42-3.1.el5.centos.x86_64.rpm| 29 kB 00:00Running rpm_check_debugRunning Transaction TestFinished Transaction TestTransaction Test SucceededRunning Transaction Installing : tftp-server [1/1]Installed: tftp-server.x86_64 0:0.42-3.1.el5.centosComplete!Download and unpack the latest Syslinux bundleThe files that come with CentOS / Redhat may be quite out of date, so best to get the latestversion available. In this example we use version 3.82.Get the files from : unpack them, in this example we unpack them to /tmp/syslinux/syslinux-3.82.# cd /tmp/syslinux# gunzip -c syslinux-3.82.tar.gz | tar xf -Setup the tftboot directory structureThe below assumes that the CD image of disk1 of the isntall disks is mounted at/kickstart/inst/CentOS5,3/disk1# cd /tftpboot/# mkdir linux-install# mkdir linux-install/pxelinux.cfg# mkdir linux-install/CentOS_5.3_x86_64# cp /tmp/syslinux/syslinux-3.82/core/pxelinux.0 linux-install# cp /tmp/syslinux/syslinux-3.82/com32/menu/menu.c32 linux-install# cp /kickstart/inst/CentOS5.3/disk1/images/pxeboot/initrd.img linux-install/CentOS_5.3_x86_64# cp /kickstart/inst/CentOS5.3/disk1/images/pxeboot/vmlinuz linux-install/CentOS_5.3_x86_64Create / copy in a menu file into pxelinux.cfgThis is basically like grub.conf. A sample default file is below. The default file will be used ifno other files are found which are more specific to the host. This will bring up a menu allowingdifferent install options. In this case it just has 2 options, either to boot locally (also the defaultto stop us overwriting any existing systems by accident!) and an option to install CentOS.
  3. 3. # cd /tftpboot/linux-install/pxelinux.cfg/# vi defaultDEFAULT menu.c32PROMPT 0ONTIMEOUT localTIMEOUT 100MENU TITLE ItchyThinking PXE MenuLABEL local MENU LABEL Boot from local disk LOCALBOOT 0LABEL CentOS 5.3 x86_64 MENU LABEL Install CentOS 5.3 x86_64 KERNEL CentOS_5.3_x86_64/vmlinuz APPEND ks=nfs: ramdisk_size=100000 ip=dhcp ksdevice=eth0The ksdevice=eth0 kernel option stops kickstart from prompting for which network device toinstall from, thus keeping the install completely hands-free.Enable tftpModify /etc/xinetd.d/tftp and make sure disable is set to nodisable = nothen start the service# service xinetd restartStopping xinetd: [ OK ]Starting xinetd: [ OK ]# chkconfig --list tftptftp onMake sure dhcp is installed# rpm -qa | grep dhcpdhcpv6-client-1.0.10-16.el5# yum install dhcp.x86_64Loaded plugins: fastestmirrorLoading mirror speeds from cached hostfile...Configure the dhcp serverAdd the following to your /etc/dhcpd.conf. In this example is the IP of the PXEserver (which is also the dhcp server in this case). Also, we are specifying the IP for each hostthat we build.
  4. 4. ## DHCP Server Configuration file.# see /usr/share/doc/dhcp*/dhcpd.conf.sample#ddns-update-style interim;ignore client-updates;subnet netmask { allow booting; allow bootp; option routers; option subnet-mask; option domain-name ""; option domain-name-servers; default-lease-time 21600; max-lease-time 43200; next-server; filename "/linux-install/pxelinux.0"; host vmlinux3 { hardware ethernet 00:0c:29:32:aa:aa; fixed-address; }}Start the dhcp server# chkconfig --list dhcpddhcpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off# service dhcpd statusdhcpd is stopped# chkconfig dhcpd on# chkconfig --list dhcpddhcpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off# service dhcpd startStarting dhcpd: [OK]Create a Kickstart AreaCreate a kickstart area, probably a large separate filesystem, where all the RedHat/CentOS ISOimages will reside. Hence it needs to be quite large. This filesystem will also hold the kickstartfiles.Lets assume we are going to put the files under a filesystem called /kickstart which is alreadymounted, but empty.# cd /kickstart# mkdir ks# mkdir isos
  5. 5. # mkdir isos/CentOS_5.3# mkdir isos/CentOS_5.3/x86_64Now copy in the iso files for the distributions of RedHat / CentOS you want to install.# cp /tmp/CentOS-5.3-x86_64-bin-1of7.iso /kickstart/isos/CentOS_5.3/x86_64# cp /tmp/CentOS-5.3-x86_64-bin-2of7.iso /kickstart/isos/CentOS_5.3/x86_64# cp /tmp/CentOS-5.3-x86_64-bin-3of7.iso /kickstart/isos/CentOS_5.3/x86_64# cp /tmp/CentOS-5.3-x86_64-bin-4of7.iso /kickstart/isos/CentOS_5.3/x86_64# cp /tmp/CentOS-5.3-x86_64-bin-5of7.iso /kickstart/isos/CentOS_5.3/x86_64# cp /tmp/CentOS-5.3-x86_64-bin-6of7.iso /kickstart/isos/CentOS_5.3/x86_64# cp /tmp/CentOS-5.3-x86_64-bin-7of7.iso /kickstart/isos/CentOS_5.3/x86_64Share the /kickstart are using nfsIn this case we set up a simple (if insecure) nfs share# vi /etc/exports/kickstart *(ro,sync)Now start (or restart) the nfs server# service nfs restartShutting down NFS mountd: [ OK ]Shutting down NFS daemon: [ OK ]Shutting down NFS quotas: [ OK ]Shutting down NFS services: [ OK ]Starting NFS services: [ OK ]Starting NFS quotas: [ OK ]Starting NFS daemon: [ OK ]Starting NFS mountd: [ OK ]Setup ClientsYou are now ready to setup and install the clients. Follow the instructions hereHere is an example kickstart file4. Adding a Kickstart ClientSubmitted by itchyadmin on Wed, 10/07/2009 - 13:56Once kickstart is setup do the following to add a new clientUpdate dhcp config and restartAssuming that the server will be assigned a particular IP address, add this to the DHCP config
  6. 6. # vi /etc/dhcpd.conf host vmlinux2 { hardware ethernet 00:0c:29:aa:66:9f; fixed-address; }Restart the dhcp server# service dhcpd restartShutting down dhcpd: [ OK ]Starting dhcpd: [ OK ]Create a kickstart file for the serverIn this example we will just copy an existing kickstart file and copy the host specific entries# cd /kickstart/ks# cp vi necessary entries. In this case we modify the following linesnetwork --device eth0 --bootproto static --ip --netmask255.255.255.0 --gateway --nameserver --hostnamevmlinux2Boot the client over the networkSimply boot the client over the network. How you do this will depend on the hardware. Allbeing well the server will now build after selecting the appropriate entry from the serversconsole.Example /etc/dhcpd.conf fileSubmitted by itchyadmin on Tue, 09/08/2009 - 21:39VersionCentOS 5.3Example of /etc/dhcpd.conf## DHCP Server Configuration file.# see /usr/share/doc/dhcp*/dhcpd.conf.sample#
  7. 7. ddns-update-style interim;ignore client-updates;subnet netmask { allow booting; allow bootp; option routers; option subnet-mask; option domain-name ""; option domain-name-servers; default-lease-time 21600; max-lease-time 43200; next-server; filename "/linux-install/pxelinux.0"; host vmlinux3 { hardware ethernet 00:0c:29:32:aa:aa; fixed-address; }}Example Kickstart FileSubmitted by itchyadmin on Tue, 09/08/2009 - 21:32VersionCentOS 5.3Here is a sample kickstart fileinstalltextnfs --server= --dir=/kickstart/isos/CentOS_5.3/x86_64lang en_GB.UTF-8keyboard uknetwork --device eth0 --bootproto static --ip --netmask255.255.255.0 --gateway --nameserver --hostnamevmlinux3rootpw --iscrypted $1$JRTd3bsM$ZGGiiFlUfGio3aJpJNMJu0firewall --disabledauthconfig --enableshadow --enablemd5selinux --disabledtimezone --utc Europe/Londonbootloader --location=mbr --driveorder=sda --append="rhgb quiet"clearpart --all --drives=sda --initlabelpart /boot --fstype ext3 --size=100 --ondisk=sdapart pv.3 --size=0 --grow --ondisk=sdavolgroup VolGroup00 --pesize=32768 pv.3
  8. 8. logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=512 --grow --maxsize=1024logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=1024 --grow%packages@office@editors@text-internet@legacy-network-server@dns-server@gnome-desktop@dialup@core@base@ftp-server@network-server@games@base-x@graphics@web-server@smb-server@printing@mail-server@server-cfg@sound-and-video@admin-tools@news-server@graphical-internetkexec-toolsdevice-mapper-multipathvnc-serverxorg-x11-server-Xnestlibsane-hpaio