Injustice - Developers Among Us (SciFiDevCon 2024)
Kickstart
1. 1. Setting up a PXE kickstart server
Submitted by itchyadmin on Tue, 09/08/2009 - 10:28
Version
CentOS 5.3
Configure the tftp server
First make sure that tftp-server rpm is installed, if not then install it
# rpm -qa | grep tftp-server
# yum install tftp-server
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.answerstolove.com
* updates: mirror.answerstolove.com
* addons: mirror.answerstolove.com
* extras: mirror.answerstolove.com
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package tftp-server.x86_64 0:0.42-3.1.el5.centos set to be updated
--> Finished Dependency Resolution
Dependencies Resolved
=============================================================================
=============================================================================
===
Package Arch
Version Repository
Size
=============================================================================
=============================================================================
===
Installing:
tftp-server x86_64 0.42-
3.1.el5.centos base 29
k
Transaction Summary
=============================================================================
=============================================================================
===
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 29 k
2. Is this ok [y/N]: y
Downloading Packages:
tftp-server-0.42-3.1.el5.centos.x86_64.rpm
| 29 kB 00:00
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing : tftp-server [1/1]
Installed: tftp-server.x86_64 0:0.42-3.1.el5.centos
Complete!
Download and unpack the latest Syslinux bundle
The files that come with CentOS / Redhat may be quite out of date, so best to get the latest
version available. In this example we use version 3.82.
Get the files from : http://syslinux.zytor.com/wiki/index.php/The_Syslinux_Project
Now 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 structure
The 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_64
Create / copy in a menu file into pxelinux.cfg
This is basically like grub.conf. A sample default file is below. The default file will be used if
no other files are found which are more specific to the host. This will bring up a menu allowing
different install options. In this case it just has 2 options, either to boot locally (also the default
to stop us overwriting any existing systems by accident!) and an option to install CentOS.
3. # cd /tftpboot/linux-install/pxelinux.cfg/
# vi default
DEFAULT menu.c32
PROMPT 0
ONTIMEOUT local
TIMEOUT 100
MENU TITLE ItchyThinking PXE Menu
LABEL local
MENU LABEL Boot from local disk
LOCALBOOT 0
LABEL CentOS 5.3 x86_64
MENU LABEL Install CentOS 5.3 x86_64
KERNEL CentOS_5.3_x86_64/vmlinuz
APPEND ks=nfs:192.168.1.201:/kickstart/ks/
initrd=CentOS_5.3_x86_64/initrd.img ramdisk_size=100000 ip=dhcp ksdevice=eth0
The ksdevice=eth0 kernel option stops kickstart from prompting for which network device to
install from, thus keeping the install completely hands-free.
Enable tftp
Modify /etc/xinetd.d/tftp and make sure disable is set to 'no'
disable = no
then start the service
# service xinetd restart
Stopping xinetd: [ OK ]
Starting xinetd: [ OK ]
# chkconfig --list tftp
tftp on
Make sure dhcp is installed
# rpm -qa | grep dhcp
dhcpv6-client-1.0.10-16.el5
# yum install dhcp.x86_64
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
...
Configure the dhcp server
Add the following to your /etc/dhcpd.conf. In this example 192.168.1.201 is the IP of the PXE
server (which is also the dhcp server in this case). Also, we are specifying the IP for each host
that we build.
4. #
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
ddns-update-style interim;
ignore client-updates;
subnet 192.168.1.0 netmask 255.255.255.0 {
allow booting;
allow bootp;
option routers 192.168.1.254;
option subnet-mask 255.255.255.0;
option domain-name "itchythinking.com";
option domain-name-servers 192.168.1.254;
default-lease-time 21600;
max-lease-time 43200;
next-server 192.168.1.201;
filename "/linux-install/pxelinux.0";
host vmlinux3 {
hardware ethernet 00:0c:29:32:aa:aa;
fixed-address 192.168.1.203;
}
}
Start the dhcp server
# chkconfig --list dhcpd
dhcpd 0:off 1:off 2:off 3:off 4:off 5:off 6:off
# service dhcpd status
dhcpd is stopped
# chkconfig dhcpd on
# chkconfig --list dhcpd
dhcpd 0:off 1:off 2:on 3:on 4:on 5:on 6:off
# service dhcpd start
Starting dhcpd: [OK]
Create a Kickstart Area
Create a kickstart area, probably a large separate filesystem, where all the RedHat/CentOS ISO
images will reside. Hence it needs to be quite large. This filesystem will also hold the kickstart
files.
Lets assume we are going to put the files under a filesystem called /kickstart which is already
mounted, but empty.
# cd /kickstart
# mkdir ks
# mkdir isos
5. # mkdir isos/CentOS_5.3
# mkdir isos/CentOS_5.3/x86_64
Now 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_64
Share the /kickstart are using nfs
In 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 restart
Shutting 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 Clients
You are now ready to setup and install the clients. Follow the instructions here
Here is an example kickstart file
4. Adding a Kickstart Client
Submitted by itchyadmin on Wed, 10/07/2009 - 13:56
Once kickstart is setup do the following to add a new client
Update dhcp config and restart
Assuming that the server will be assigned a particular IP address, add this to the DHCP config
6. # vi /etc/dhcpd.conf
host vmlinux2 {
hardware ethernet 00:0c:29:aa:66:9f;
fixed-address 192.168.1.202;
}
Restart the dhcp server
# service dhcpd restart
Shutting down dhcpd: [ OK ]
Starting dhcpd: [ OK ]
Create a kickstart file for the server
In this example we will just copy an existing kickstart file and copy the host specific entries
# cd /kickstart/ks
# cp 192.168.1.203-kickstart 192.168.1.202-kickstart
# vi 192.168.1.202-kickstart
Modify necessary entries. In this case we modify the following lines
network --device eth0 --bootproto static --ip 192.168.1.202 --netmask
255.255.255.0 --gateway 192.168.1.254 --nameserver 192.168.1.254 --hostname
vmlinux2
Boot the client over the network
Simply boot the client over the network. How you do this will depend on the hardware. All
being well the server will now build after selecting the appropriate entry from the servers
console.
Example /etc/dhcpd.conf file
Submitted by itchyadmin on Tue, 09/08/2009 - 21:39
Version
CentOS 5.3
Example of /etc/dhcpd.conf
#
# DHCP Server Configuration file.
# see /usr/share/doc/dhcp*/dhcpd.conf.sample
#