To do the minimalistic install I use kickstart, in fact I use a perl cgi script I wrote many years ago, before Cobbler, to dynamically generate the kickstart files based on templates and options passed to the cgi.
Here is a sample of the resulting kickstart intended for a VM host.
IMPORTANT: This kickstart WILL partition and format the harddisks.
IMPORTANT: This has only been tested with CentOS/RHEL 5. The partitioning will probably not work with CentOS/RHEL 6.
You will need to modify this to your liking.
- repo.example.com: needs to be replaced w/ real centos repos
- custom repo: this is my own internal repo, you can remove this
- hostname: change to your liking
- root password: insert an encrypted password
- authconfig: modify ldap or replace w/ "authconfig --enableshadow --enablemd5"
- puppet: define your puppetmaster or remove
- time: define your time server or remove
# Kickstart file for vbox1.example.com
#
# $Id: default.ks.tpl 6307 2011-02-08 06:06:30Z $
install
reboot
text
firstboot --disabled
url --url http://repo.example.com/linux/centos/5/os/i386/
repo --name=updates --baseurl=http://repo.example.com/linux/centos/5/updates/i386/
repo --name=extras --baseurl=http://repo.example.com/linux/centos/5/extras/i386/
repo --name=custom --baseurl=http://repo.example.com/linux/centos/custom/5/i386/
repo --name=epel --baseurl=http://repo.example.com/linux/centos/epel/5/i386/
repo --name=epel-testing --baseurl=http://repo.example.com/linux/centos/epel-testing/5/i386/
lang en_US.UTF-8
keyboard us
network --device eth0 --bootproto=dhcp --hostname vbox1.example.com
rootpw --iscrypted $1$lKmKQMA8$1OiJsc8PGoxQsKQ/GM/Hp0
firewall --disabled
authconfig --enableshadow --enablemd5 --enableldap --enableldapauth --ldapserver=ldap.example.com --ldapbasedn="o=People" --enablecache
selinux --disabled
timezone Australia/Melbourne
%include /tmp/part-include
%packages --ignoremissing --nobase
coreutils
yum
rpm
dhclient
wget
e2fsprogs
lvm2
grub
sysstat
redhat-lsb
sendmail
openssh-server
openssh-clients
comps-extras
cracklib-dicts
gnome-mime-data
rmt
tzdata
nss_ldap
ntp
net-snmp
vim-enhanced
xinetd
iptraf
ruby
xorg-x11-xauth
sysstat
puppet
facter
ruby-shadow
augeas
ruby-augeas
# --- needed to see vmware/virtualbox with facter/puppet
dmidecode
# --- needed to "shutdown" with power button or VBoxManage
acpid
-NetworkManager
-system-config-printer
-pcsc-lite
# removed from "base"
-autofs
-anacron
-bluez-utils
-ccid
-ifd-egate
-coolkey
-brltty
-hfsutils
-ibutils
-ipsec-tools
-mcelog
-mtr
-pcmciautils
-rp-pppoe
-smartmontools
-ypbind
# removed from "core"
-Deployment_Guide-en-US
%pre
#!/bin/sh
set $(list-harddrives)
# $1 = 1st disk name
# $2 = 1st disk size
# $3 = 2nd disk name
# $4 = 2nd disk size
# so on
let numhd=$#/2
drive1=$1
drive2=$3
# calculate swap
mem=$(grep MemTotal /proc/meminfo | awk '{print $2}')
swap=$(( $mem / 1000 * 2 ))
# max swap should be 3GB
if [ $swap -gt 3000 ]
then
swap=3000
fi
#Write out partition scheme based on whether there are 1 or 2 hard drives
if [ $numhd == "2" ] ; then
#2 drives
echo "# partitioning scheme generated in %pre for 2 drives" > /tmp/part-include
echo "bootloader --location=mbr --driveorder=$drive1,$drive2" >> /tmp/part-include
echo "clearpart --all --initlabel" >> /tmp/part-include
echo "part raid.11 --size=100 --ondisk=$drive1" >> /tmp/part-include
echo "part raid.21 --size=100 --ondisk=$drive2" >> /tmp/part-include
echo "part raid.13 --size=100 --ondisk=$drive1 --grow" >> /tmp/part-include
echo "part raid.23 --size=100 --ondisk=$drive2 --grow" >> /tmp/part-include
echo "raid /boot --fstype ext3 --level=RAID1 --device=md0 raid.11 raid.21" >> /tmp/part-include
echo "raid pv.01 --level=RAID1 --device=md2 raid.13 raid.23" >> /tmp/part-include
echo "volgroup vg0 pv.01" >> /tmp/part-include
echo "logvol swap --fstype swap --name=swap --vgname=vg0 --size=$swap" >> /tmp/part-include
echo "logvol / --fstype ext3 --name=root --vgname=vg0 --size=300 --grow" >> /tmp/part-include
else
#1 drive
echo "# partitioning scheme generated in %pre for 1 drives" > /tmp/part-include
echo "bootloader --location=mbr --driveorder=$drive1" >> /tmp/part-include
echo "clearpart --all --initlabel" >> /tmp/part-include
echo "part /boot --fstype ext3 --size=100 --ondisk=$drive1" >> /tmp/part-include
echo "part swap --fstype swap --size=$swap --ondisk=$drive1" >> /tmp/part-include
echo "part / --fstype ext3 --size=300 --ondisk=$drive1 --grow" >> /tmp/part-include
fi
[ -f /tmp/part-include ] || touch /tmp/part-include
%post
hostname vbox1.example.com
echo "
PUPPET_SERVER=puppet.example.com
PUPPET_LOG=/var/log/puppet/puppet.log
PUPPET_EXTRA_OPTS=\"--autoflush --pluginsync\"
" >> /etc/sysconfig/puppet
# --- setup cron to make sure puppet keeps running!
echo "*/10 * * * * root [ -f /etc/sysconfig/puppet ] && . /etc/sysconfig/puppet; if [ \"\$WATCH_PUPPETD\" != \"no\" -a -f /etc/init.d/puppet ]; then /sbin/pidof -x puppetd >/dev/null || /sbin/service puppet restart; fi" > /etc/cron.d/puppetd
echo "time.example.com" > /etc/ntp/step-tickers
/usr/sbin/ntpdate -s -b time.example.com
/sbin/chkconfig ntpd on
/sbin/chkconfig puppet on
/sbin/chkconfig network on
# --- disable the default repo's
for xx in /etc/yum.repos.d/*
do
echo "disabling repo file: `basename $xx`"
mv -f ${xx} ${xx}.disabled
done
No comments:
Post a Comment