Sunday 2 October 2011

Kickstart


Kick Start Installation
A Kick Start or PXE install server allows client computers to boot and install a Linux distribution over the network, without the need of burning Linux ISO images onto a CD/DVD, boot floppy images, etc. This is handy if your client computers don’t have CD or floppy drives, or if you want to set up multiple computers at the same time (e.g. in a large enterprise), or simply because you want to save the money for the CDs/DVDs.
The advantage of kick start is installing Linux OS on multiple computers simultaneously and faster than CD/DVD installation method. It also includes answering feature that provides un-attendant installation.
For Kick Start installation client computers most has include PXE Ethernet card.
Requirements:
1.                       DHCP Server
2.                       TFTP Server
3.                       NFS/FTP/HTTP Server (For store installing files)
4.                       YUM

Step1.    Install DHCP Server:
Install DHCP package and configure it for PXE enable DHCP.
# yum install dhcp
# vi /etc/dhcpd.conf
#
# DHCP Server Configuration file.
#   see /usr/share/doc/dhcp*/dhcpd.conf.sample
#
ddns-update-style interim;
ignore client-updates;
allow unknown-clients;
allow booting;
allow bootp;
subnet    192.168.1.0   netmask   255.255.255.0 {
option routers                    192.168.1.1;
option subnet-mask                255.255.255.0;
option domain-name-servers        192.168.1.1;
option broadcast-address               192.168.1.255;
next-server                       192.168.1.1;
filename “pxelinux.0″;
default-lease-time                3100;
max-lease-time                    604800;
range          192.168.1.10       192.168.1.254; }
:wq
Step2. Install TFTP Server:
The Trivial File Transfer Protocol (TFTP) is normally used only for booting diskless workstations. The tftp-server package provides the server for TFTP, which allows users to transfer files to and from a remote machine. TFTP provides very little security, and should not be enabled unless it is expressly needed. The TFTP server is run from “/etc/xinetd.d/tftp”, and is disabled by default on Red Hat Linux systems.
# yum install tftp-server
# vim /etc/xinetd.d/tftp          (Here set “disable = no” then save and exit)

Step3. Create Network Install Source:
We can use one of three methods NFS, FTP or HTTP to store installation files on the network and retrieve it when booting the client using PXE. Here I have choosing to ftp, to install ftp server.
# yum install vsftpd
            After installing vsftpd package it create a public accessible ftp site located in “/var/ftp” directory. Here we create a “redhat” directory and use it. But you can create another multiple separate directories to store multiple OS installation files.
# mkdir /var/ftp/redhat
# mount /dev/cdrom /mnt                 (Temporary mount DVD-ROM on /mnt directory)
# cp –ra /mnt/* /var/ftp/redhat/        (Copy all DVD contents to /var/ftp/redhat/ directory)

            Step4. Setup TFTP network boot files:
            Create “/tftpboot/redhat” directory and populate it with the files necessary to start the installation program via PXE.
# mkdir /tftpboot/redhat
# cp /usr/lib/syslinux/pxelinux.0 /tftpboot/
# cp /var/ftp/pub/images/pxeboot/initrd.img /tftpboot/redhat/
# cp /var/ftp/pub/images/pxeboot/vmlinuz /tftpboot/redhat/

            Step5. Create PXE Menu:
# cp /usr/lib/syslinux/menu.c32 /tftpboot/
# mkdir /tftpboot/pxelinux.cfg
# vim /tftpboot/pxelinux.cfg/default
default menu.c32
prompt 0
timeout 300

MENU TITLE PXE Installation Menu

LABEL RedHat Linux 5.1 x32
MENU LABEL RedHat Linux 5.1
            KERNEL redhat/vmlinuz
            APPEND initrd=redhat/initrd.img ramdisk_size=32768
method=ftp://192.168.1.1/redhat

            :wq
            After configure described as above the tftp server files structure looks like this.
# tree /tftpboot/
/tftpboot
| - - menu.c32
| - - pxeboot
|     | - - initrd.img
     ` - - vmlinuz
| - - pxelinux.0
` - - pxelinux.cfg
      ` - - default

2 directories, 5 files

            Step6. Disable firewall, selinux and restart all related services.
# chkconfig dhcpd on
# service dhcpd restart
# chkconfig tftp on
# chkconfig xinetd on
# service xinetd restart
# chkconfig vsftpd on
# service vsftpd restart
            The kick start server is now configured with attendant installation. Connect client PC in this local network, enable PXE booting and restart client PC. The disk less installation is going to start.

            Step7. Automating Installation using kickstart:
If we want un-attendant installation then we need to create a answering file called “ks.cfg” with “system-config-kickstart” and placed it in installation source ftp site.
# yum install system-config-kickstart
# system-config-kickstart
Follow the instructions and create kick start file “ks.cfg” and save in “/var/ftp/ks/” directory. This file is look like this.
# cat /var/ftp/ks/ks.cfg
            Edit ks.cfg file and write in the bottom “key - -skip” and “%packages”.
            Edit “/tftpboot/pxelinux.cfg/default” file and add ks parameter.
# vim /var/ftp/ks/ks.cfg
LABEL RedHat Linux 5.1 x32
MENU LABEL RedHat Linux 5.1
            KERNEL redhat/vmlinuz
            APPEND initrd=redhat/initrd.img ramdisk_size=32768 ks=ftp://192.168.1.1/ks/ks.cfg

:wq
# service dhcpd restart
# service vsftpd restart
# service xinetd restart
After that automating kick start server is configured.

No comments:

Post a Comment

Boot to UEFI Mode or legacy BIOS mode

Boot to UEFI Mode or legacy BIOS mode Choose UEFI or legacy BIOS modes while installing Windows. After Windows is installed, if you nee...