# Kickstart file by
[email protected]
reboot
#text
install
interactive
url --url
http://mirror.leaseweb.com/centos/5.5/os/i386
lang en_US.UTF-8
keyboard us
network --bootproto=query
firewall --enabled --port=22:tcp
authconfig --enableshadow --enablemd5
selinux --disabled
services --disabled bluetooth,cups
timezone --utc Europe/Amsterdam
bootloader --location=mbr --driveorder=sda
zerombr
clearpart --all --initlabel
#autopart
# The following is the partition information you requested
# Note that any partitions you deleted are not expressed
# here so unless you clear all partitions first, this is
# not guaranteed to work
#clearpart --linux --drives=sda
#part /boot --fstype ext3 --size=100 --ondisk=sda
#part pv.2 --size=0 --grow --ondisk=sda
#volgroup VolGroup00 --pesize=32768 pv.2
#logvol / --fstype ext3 --name=LogVol00 --vgname=VolGroup00 --size=500000
#logvol swap --fstype swap --name=LogVol01 --vgname=VolGroup00 --size=1000 --grow --maxsize=5024
firstboot --disable
%packages
@development-libs
@editors
@system-tools
@text-internet
@core
@base
@development-tools
audit
device-mapper-multipath
imake
%post
mkdir /install
# Modify /etc/resolv.conf - add DNS servers
cat > /etc/resolv.conf << EOF1
search <YOURDOMAINNAME>
nameserver <YOURNAMESERVER>
nameserver <YOURNAMESERVER>
EOF1
#add profiles
cat >> /etc/profile << EOF2
export LS_COLORS=
EOF2
cat > /install/postinstall.sh << EOF3
#!/bin/sh
/bin/cat /etc/shadow | /bin/grep -i root | /bin/cut -d ":" -f 2 > /install/tmppass1
adminpass=\`/bin/cat /install/tmppass1\`
/bin/rm -f /install/tmppass1
/usr/sbin/useradd -p \`echo \$adminpass\` -c "admin" admin
/bin/sed -e 's/#PermitRootLogin yes/PermitRootLogin no/' /etc/ssh/sshd_config > /etc/ssh/sshd_config.new
/bin/mv -f /etc/ssh/sshd_config.new /etc/ssh/sshd_config
/bin/sed -e 's/#MaxAuthTries 6/MaxAuthTries 3/' /etc/ssh/sshd_config >> /etc/ssh/sshd_config.new
/bin/mv -f /etc/ssh/sshd_config.new /etc/ssh/sshd_config
/bin/sed -e 's/#PermitTunnel no/#PermitTunnel no\nAllowUsers sysadmin/' /etc/ssh/sshd_config >> /etc/ssh/sshd_config.new
/bin/mv -f /etc/ssh/sshd_config.new /etc/ssh/sshd_config
/etc/init.d/sshd restart
/bin/sed -e 's/server 0.centos.pool.ntp.org/#server 0.centos.pool.ntp.org\nserver 0.nl.pool.ntp.org/' /etc/ntp.conf >> /etc/ntp.conf.new
/bin/mv -f /etc/ntp.conf.new /etc/ntp.conf
/bin/sed -e 's/server 1.centos.pool.ntp.org/#server 1.centos.pool.ntp.org\nserver 1.nl.pool.ntp.org/' /etc/ntp.conf >> /etc/ntp.conf.new
/bin/mv -f /etc/ntp.conf.new /etc/ntp.conf
/bin/sed -e 's/server 2.centos.pool.ntp.org/#server 2.centos.pool.ntp.org/' /etc/ntp.conf >> /etc/ntp.conf.new
/bin/mv -f /etc/ntp.conf.new /etc/ntp.conf
/usr/sbin/ntpdate 62.212.76.57
/usr/sbin/ntpdate 83.149.80.111
/sbin/chkconfig ntpd on
/sbin/service ntpd start
/usr/bin/yum install iptraf sysstat mc -y
/usr/bin/yum update -y
/bin/echo '#!/bin/sh' > /etc/rc.local
/bin/echo 'touch /var/lock/subsys/local' >> /etc/rc.local
# change hostname to eth0 macdress
NEWHOSTNAME=\`/sbin/ifconfig eth0 | /bin/grep -i eth0 | /bin/sed 's/HWaddr /,/g' | /bin/cut -d "," -f 2 | /bin/sed 's/://g'\`
/bin/sed -e 's/HOSTNAME/d' /etc/sysconfig/network >> /etc/sysconfig/network.NEW
/bin/mv -f /etc/sysconfig/network.new /etc/sysconfig/network
echo HOSTNAME=\$NEWHOSTNAME\` >> /etc/sysconfig/network
#destroy the config script after 1 go uncomment after testing
#/bin/echo '#!/bin/sh' > /install/postinstall.sh
EOF3
cat >> /etc/rc.local << EOF4
/bin/chmod +x /install/postinstall.sh
cd /install
/bin/sh /install/postinstall.sh
EOF4