#!/bin/bash
#configuring install-vserver
#kickstart configuration and adding entry into the pxelinux.0/default for virtual
echo”
#platform=x86, AMD64, or Intel EM64T
#version=DEVEL
# Firewall configuration
firewall –disabled
# Install OS instead of upgrade
install
# Use network installation
url –url=”http://192.168.122.1/RHEL”
repo –name=”Red Hat Enterprise Linux” –baseurl=http://192.168.122.1/RHEL –cost=100

# Root password
rootpw –iscrypted $1$kUpEHfw2$tJfHCPSVuVvMn7NwcwzJG/
# System authorization information
auth –useshadow –passalgo=sha512
# Use text mode install
text
firstboot –disable
# System keyboard
keyboard us
# System language
lang en_US
# SELinux configuration
selinux –disabled
# Installation logging level
logging –level=info
# Reboot after installation
reboot
# System timezone
timezone Asia/Kolkata
# Network information
network –bootproto=dhcp –device=eth0 –onboot=on
# System bootloader configuration
bootloader –append=”crashkernel=auto rhgb quiet” –location=mbr –driveorder=”vda”
# Clear the Master Boot Record
zerombr
# Partition clearing information
clearpart –all –initlabel
# Disk partitioning information
part /boot –fstype=”ext4″ –size=200
part pv.01 –grow –size=1
volgroup myclient –pesize=4096 pv.01
logvol / –fstype=”ext4″ –vgname=myclient –size=10240 –name=redhat

%post –interpreter=/bin/bash
sed -ie ‘s/id:3:initdefault:/id:5:initdefault:/g’ /etc/inittab
%end
repo –name=”Red Hat Enterprise Linux” –baseurl=http://192.168.122.1/RHEL –cost=100
%packages
@base
@basic-desktop
@client-mgmt-tools
@core
@debugging
@desktop-debugging
@desktop-platform
@directory-client
@fonts
@general-desktop
@graphical-admin-tools
@input-methods
@internet-browser
@java-platform
@kde-desktop
@legacy-x
@network-file-system-client
@perl-runtime
@print-client
@remote-desktop-clients
@server-platform
@server-policy
@x11
abrt-gui
alacarte
audit-viewer
bitmap-fixed-fonts
bitmap-lucida-typewriter-fonts
bltk
certmonger
cjkuni-fonts-ghostscript
dvgrab
firstaidkit-gui
gconf-editor
gedit-plugins
genisoimage
gnome-games
gnome-pilot
gnome-pilot-conduits
kdebase-workspace-akonadi
kdebase-workspace-python-applet
krb5-auth-dialog
krb5-workstation
libXmu
libXp
mtools
oddjob
openmotif
openmotif22
oprofile-gui
pam_krb5
pax
perl-DBD-SQLite
policycoreutils-gui
python-dmidecode
qt-mysql
qt-odbc
qt-postgresql
qt3-MySQL
qt3-ODBC
qt3-PostgreSQL
rdesktop
rhythmbox-upnp
sabayon
sabayon-apply
seahorse-plugins
setroubleshoot
sgpio
spice-client
spice-xpi
squashfs-tools
system-config-kickstart
system-config-lvm
systemtap-grapher
tigervnc
tigervnc-server
totem-upnp
tsclient
vim-X11
vinagre
wacomcpl
wodim
xguest
xorg-x11-fonts-75dpi
xorg-x11-fonts-ISO8859-1-75dpi
xorg-x11-fonts-ISO8859-14-100dpi
xorg-x11-fonts-ISO8859-14-75dpi
xorg-x11-fonts-ISO8859-15-75dpi
xorg-x11-fonts-ISO8859-2-100dpi
xorg-x11-fonts-ISO8859-2-75dpi
xorg-x11-fonts-ISO8859-9-100dpi
xorg-x11-fonts-ISO8859-9-75dpi
xorg-x11-fonts-cyrillic
xorg-x11-fonts-ethiopic
xorg-x11-twm
xorg-x11-xdm
xrestop
xterm

%end”> /var/www/html/ks.cfg

#restarting the dhcp server
service dhcpd restart

#virtual sh command to install virtual machine —all packages of virtual must be installed
yum install -y *virt*

virt-install -n client -r 1500 –disk path=/var/lib/libvirt/images/client,size=12 –graphics spice –pxe –os-type=linux

virt-install -n client1 -r 1000 –disk path=/var/lib/libvirt/images/client1,size=12 -l http://192.168.122.2/RHEL –os-type=linux -x “ks=http://192.168.122.2/client.cfg”