Linux/Unix

How to Make a Kickstart Installation ISO

LINUX KICKSTART INSTALATION


Linux KickStart is a mechanism created by Red Hat for automated installation of Linux. In this approach, a single file known as Kick Start File is created that contains the answers to all the questions that are normally be asked during a typical installation. Thus, KickStart provides a way for users to automate a Red Hat Enterprise Linux Installation.

KICKSTART INSTALLATION USING BOOTABLE CD:

KickStart installation can be performed using a bootable CD-ROM, a local hard drive or via NFS, FTP or HTTP depending upon the location of Kickstart file. The document covers the steps for the creation of the bootable CD that can be used further for the installation. In Bootable CD kickstart installation, the kickstart file is present on the CD. To use kickstart, you must:
1.                  Create a kickstart file
2.                  Create a boot media
3.                  Start the kickstart installation

CREATING THE KICKSTART FILE


KickStart file is a simple text file containing a list of items, each identified by a keyword. The Red Hat Enterprise Linux installation program also creates a sample kickstart file based on the options that you selected during installation. It is written to the file /root/anaconda-ks.cfg. You can edit it with any text editor or word processor and can save the file as ASCII text. There are two ways of creating the kickstart file:
1.                  Edit already existing kickstart file on the linux server present as /root/anaconda-ks.cfg as per your requirement
2.                  Using KickStart Configurator application, which is a graphical interface, provided with the Red Hat Linux installation package. It allows you to edit or modify a kickstart file.
This document does not capture the details about the KickStart Configurator application. For details on keywords used in Kick Start file and the Configurator tool, please refer Red Hat Installation Manual.

EXAMPLE OF A KICKSTART FILE: Given below is the example of a kickstart file that is specific for setting the environment for PDC installation.


#version=DEVEL
# System authorization information
auth --useshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Use graphical install
graphical
# Firewall configuration
firewall --disabled
firstboot --disable
ignoredisk --only-use=sda
# Keyboard layouts
keyboard --vckeymap=us --xlayouts='us'
# System language
lang en_US.UTF-8

# Network information
network  --bootproto=dhcp --device=eno16777736 --onboot=off --ipv6=auto
network  --hostname=localhost.localdomain

# Root password
rootpw --iscrypted $6$X6bdsQ10cZ8HVDxv$e63Wn3ezLz4JBxkXrJMvGnzRmOtF78PSyxoRZ18TdC1msYyBtmYXYms8RoXD8tNE.aVu0cvyyHdUqGOtrLBo/1
# SELinux configuration
selinux --permissive
# System services
services --enabled="chronyd"
# System timezone
timezone Europe/Paris
# System bootloader configuration
bootloader --location=mbr --boot-drive=sda
# Partition clearing information
zerombr
ignoredisk --only-use=sda
clearpart –all drives=sda
# Disk partitioning information
part pv.95 --fstype="lvmpv" --size=20379
part /boot --fstype="ext4" --size=100
volgroup vg00 --pesize=32768 pv.95
logvol swap  --fstype="swap" --size=2048 --name=lvswap --vgname=vg00
logvol /  --fstype="ext4" --size=8360 --name=lvroot --vgname=vg00
logvol /var  --fstype="ext4" --size=3120 --name=lvvar --vgname=vg00

%post --logfile /root/post_install.log
echo -e "================================================================="
echo -e "       Starting kickStart post install script "
%end

%packages
@core
@development
chrony
kexec-tools
net-tools
%end

%addon com_redhat_kdump --enable --reserve-mb='auto'

%end
STEPS FOR THE CREATION OF BOOTABLE CD FOR KICKSTART INSTALLATION

1.             Mount RHEL7.2 DVD and copy it some place like /RHEL7.2, then copy above ks.cfg file in /RHEL7.2 Directory.
2.             Change the display message that appears at the time of the Installation for Linux KickStart by editing boot.msg. Steps for editing boot.msg are as follows:
o           Go to the directory /RHEL7.2/isolinux
o      vi boot.msg
o      Comment the previous messages for installtion and   add the message “Press Enter for KickStart Installation”
3.             Specify the path of the kickstart file in the Installtion CD. This is done by editing the file isolinux.cfg. The steps for editing the file are as follows:
o           Go to the directory /RHEL7.2/isolinux
o       vi isolinux.cfg
o       Add the path of kickstart linux file i.e   
      cdrom/ks.cfg. Please refer the sample file given 
       below for the changes:
        default vesamenu.c32
timeout 60

display boot.msg

# Clear the screen when exiting the menu, instead of leaving the menu displayed.
# For vesamenu, this means the graphical background is still displayed without
# the menu itself for as long as the screen remains in graphics mode.
menu clear
menu background splash.png
menu title Red Hat Enterprise Linux 7.2
menu vshift 8
menu rows 18
menu margin 8
#menu hidden
menu helpmsgrow 15
menu tabmsgrow 13

# Border Area
menu color border * #00000000 #00000000 none

# Selected item
menu color sel 0 #ffffffff #00000000 none

# Title bar
menu color title 0 #ff7ba3d0 #00000000 none

# Press [Tab] message
menu color tabmsg 0 #ff3a6496 #00000000 none

# Unselected menu item
menu color unsel 0 #84b8ffff #00000000 none

# Selected hotkey
menu color hotsel 0 #84b8ffff #00000000 none

# Unselected hotkey
menu color hotkey 0 #ffffffff #00000000 none

# Help text
menu color help 0 #ffffffff #00000000 none

# A scrollbar of some type? Not sure.
menu color scrollbar 0 #ffffffff #ff355594 none

# Timeout msg
menu color timeout 0 #ffffffff #00000000 none
menu color timeout_msg 0 #ffffffff #00000000 none

# Command prompt text
menu color cmdmark 0 #84b8ffff #00000000 none
menu color cmdline 0 #ffffffff #00000000 none

# Do not display the actual menu unless the user presses a key. All that is displayed is a timeout message.

menu tabmsg Press Tab for full configuration options on menu items.

menu separator # insert an empty line
menu separator # insert an empty line

label linux
  menu label ^Install Red Hat Enterprise Linux 7.2
  kernel vmlinuz
  append ks=cdrom:/ks.cfg initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.2

label check
  menu label RHEL7.2 this ^media & install Red Hat Enterprise Linux 7.2
  menu default
  kernel vmlinuz
  append ks=cdrom:/ks.cfg initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.2 rd.live.check

menu separator # insert an empty line

# utilities submenu
menu begin ^Troubleshooting
  menu title Troubleshooting

label vesa
  menu indent count 5
  menu label Install Red Hat Enterprise Linux 7.2 in ^basic graphics mode
  text help
      Try this option out if you're having trouble installing
      Red Hat Enterprise Linux 7.2.
  endtext
  kernel vmlinuz
  append ks=cdrom:/ks.cfg initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.2 xdriver=vesa nomodeset
label rescue
  menu indent count 5
  menu label ^Rescue a Red Hat Enterprise Linux system
  text help
      If the system will not boot, this lets you access files
      and edit config files to try to get it booting again.
  endtext
  kernel vmlinuz
  append ks=cdrom:/ks.cfg initrd=initrd.img inst.stage2=hd:LABEL=RHEL-7.2 rescue

label memRHEL7.2
  menu label Run a ^memory RHEL7.2
  text help
      If your system is having issues, a problem with your
      system's memory may be the cause. Use this utility to
      see if the memory is working correctly.
  endtext
  kernel memRHEL7.2

menu separator # insert an empty line

label local
  menu label Boot from ^local drive
  localboot 0xffff

menu separator # insert an empty line
menu separator # insert an empty line

label returntomain
  menu label Return to ^main menu
  menu exit

menu end
                      
4.                  Prepare the Kickstart Linux file say ks.cfg will all the details of the installation desired by you and copy it to /RHEL7.2 folder
5.                  Make the iso image by the running the following commands:
Note: Make sure mkisofs is installed or use command “yum install mkisofs”

mkisofs -o /kickstartrhel7.iso –eltorito-alt-boot -b isolinux/isolinux.bin –c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table -R –cache-inodes -J -v -T –V “RHEL-7.2” ./
Here, /kickstartrhel7.iso is the path for the ISO image that will created after running the command. It can be any name with extension .iso.

6.                  Mount the ISO in server and boot for installation or burn CD from below step.
7.                  Insert the CD in the drive on Set Up server. Run the following command to burn the CD:
cdrecord -v -eject speed=16 dev=ATA:0,0,0 / kickstartrhel7.iso
where, /kickstartrhel7.iso is the path of the ISO image prepared from the previous step
 
After these steps the bootable CD is available for the Linux kickstart. Please refer to the ReadMe for Linux kickstart Installation.

No comments:

Post a Comment

Troubleshooting NFS

Common NFS Errors "No such host" - Name of the server is specified incorrectly "No such file or directory" - Either...