Overview

Here is a collection of kickstart (ks.cfg) scripts.

Scripts

Example Kick Start file with SElinux, Firewall & Customizations

# CentOS / RHEL Kickstart file
# Author: sysadminwiki.net
# Last Mod: October 21st, 2011
#
# Notes: the upgrade option is not covered in this configuration file.
#             a minimum of 30 GB hardware raid is assumed.
#	      this will erase existing partitions and create its own. all data will be lost. 
#	      ext4 filesystem will be used unless changed below. 
#             /local gets the remainder of the space
#             8G swap, adjust to your needs.
 

##How to use the kickstart blurb:
# Insert DVD and boot from it. Grub is configured to load the ks.cfg by default.
# If this does not work for any reason you can follow these steps
# to tell the boot manager to load the kickstart file. 
# 
# 1. Insert cd-rom
# 2. Boot server and at the grub menu press e.
# 3. Enter one of the following ks= options to the end of the kernel line
#
#For CDROM:
#ks=cdrom:/ks.cfg
#
#For USB assuming it is in /kickstart/:
#ks=hd:sda1/kickstart/ks.cfg
#
#Network:
#ksdevice=http://servername/directory/ks.cfg
 

install
#upgrade - wouldnt try this on a prod system without a backout plan. 
 
# Install in text mode.
text
 
###Source##
cdrom
#url --url http://webserverIP/RHEL4/
#url --url http://
#url --url ftp://<username>:<password>@<server>/<dir>
 

lang en_US.UTF-8
langsupport --default=en_US.UTF-8 en_US.UTF-8
keyboard us
 
##Desktop Section##
## Leave commented unless you really need a desktop GUI.
##If you need a desktop don't forget to include the gnome packages in the package section below. 
#xconfig --card "ATI Rage XL" --videoram 8192 --hsync 31.5-37.9 --vsync 50-70 --resolution 800x600 --depth 16 --startxonboot  --defaultdesktop gnome
 

###Network Device Section###
 
network --device eth0 --bootproto static --ip 192.168.2.4 --netmask 255.255.255.0 --gateway 192.168.2.1 --nameserver 192.168.2.1,192.168.2.2 --hostname centos.ks.srv 
 
#IF YOU WANT YOUR NIC TO DO DHCP HERE IS AN EXAMPLE:
#network --device eth2 --onboot yes --bootproto dhcp
#network --device eth3 --onboot no --bootproto dhcp
#network --device eth4 --onboot no --bootproto dhcp
 
###Root Password###
rootpw changeme


###Security Configuration###
firewall --enabled --port=22:tcp
authconfig --enableshadow --enablemd5
 
# Set Security Enhanced Linux to enforcing mode. You may want to change this
selinux --enforcing
# selinux --disabled
 
timezone --utc America/Halifax
 
###Partitioning###
bootloader --location=mbr --driveorder=sda,sdb
 

# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
# This is for a hardware raid with at least 30GB of space. Make sure you have configured your raid controller.
# /local will grab the remaining free space.
 
clearpart --linux
part / --fstype ext4 --size=1500
part /usr --fstype ext4 --size=10000 --ondisk=sda
part swap --size=8000 --ondisk=sda
part /var --fstype ext4 --size=8000 --ondisk=sda
part /local --fstype ext4 --size=1 --grow --ondisk=sda

# ALTERNATE DRIVE CONFIGS
# clearpart --all --drives=sda
# ignoredisk --only-use=sda
# part /boot --fstype=ext2 --asprimary --size=500
# part /OtherOS --fstype=ext4 --asprimary --size=10240
# part swap --asprimary --size=2048
# part pv.fedora1000 --grow --asprimary --size=500
# volgroup fedora --pesize=32768 pv.fedora1000
# logvol /centosVM --fstype=ext4 --name=centosVM --vgname=fedora --size=30720
# logvol /home --fstype=ext4 --name=home --vgname=fedora --size=81920
# logvol / --fstype=ext4 --name=root --vgname=fedora --size=25600
# logvol /windowsVM --fstype=ext4 --name=windowsVM --vgname=fedora --size=40960
# bootloader --location=mbr --driveorder=sda --append="nomodeset rhgb quiet"


 
### Packages Section ###
%packages
@editors
@text-internet
@core
@base
@server-cfg
device-mapper-multipath
net-snmp

###SEE THE BOTTOM FOR MORE PACKAGES / PACKAGE NAMES WHICH CAN BE ADDED TO THE ABOVE LIST
###IT IS RECOMMENDED TO START WITH THESE AND ADD WITH YUM AS NEEDED.
 
### Post Installation Section###
## Add any custom scripts / commands here
 
%post

# Custom user added
user --name=ronnie --groups=users --password=n3wus3r!
authconfig --enableshadow --passalgo=sha512 --enablefingerprint
firewall --service=ssh

# add sudo users to sudoers
echo "ronnie ALL=(ALL)       ALL" >> /etc/sudoers

# prevent future yum updates pulling down & install new kernels (and breaking VMware & video drivers).
echo "exclude=kernel*" >> /etc/yum.conf

# turn off packages that we don't want running
echo "Turning off some packages"
/sbin/chkconfig --level 0123456 apmd off
/sbin/chkconfig --level 0123456 sendmail off
/sbin/chkconfig --level 0123456 telnet off
/sbin/chkconfig --level 0123456 lpd off
/sbin/chkconfig --level 0123456 xfs off
/sbin/chkconfig --level 0123456 gpm off
 
# turning on packages that we need
echo "Turning on NTPD"
/sbin/chkconfig --level 345 ntpd on

# add comment to /etc/motd
echo "Custom Kickstart-installed CentOS 6.0 `/bin/date`" >> /etc/motd

# Setup /etc/resolv.conf
mv /etc/resolv.conf /etc/resolv.conf.orig
touch /etc/resolv.conf
echo "domain yourdomain.ca" >> /etc/resolv.conf
echo "nameserver 4.2.2.2" >> /etc/resolv.conf
echo "nameserver 4.1.1.1" >> /etc/resolv.conf 
echo "search yourdomain.ca" >> /etc/resolv.conf 

#Finally if your server is has internet access during the install. You might want to have kickstart run a system update. 
# update the system
# yum update -y 



Back to: kickstart

Discussion

Enter your comment. Wiki syntax is allowed:
If you can't read the letters on the image, download this .wav file to get them read to you.
 
services/kickstart/example_kickstart_configurations.txt · Last modified: 2012/06/08 06:47 by jmcneil
GNU Free Documentation License 1.3
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0