Hi
I'm hoping someone can help me.
i have a problem with the post section of a kickstart script. I just can't get the post section to run.
i get an error saying
"no such file or directory cd /tmp
no such file or directory /tmp/esxcfg.sh
mv: cannot stat 'etc/rc.d/rc.local.bak': no such file or directory
/etcrc3.d/s99local: line11: EOF: command not found"
if i remove the section of the script this is refereing to as i've seen in other kickstart scripts i don't get any errors but still the post section does not run!
the file is downloaded form the following website and modified for my environment
http://www.rtfm-ed.co.uk/downloads/hp.cfg
i'm running this in a test environment which is ESX within workstation 6
if anyone can help i would really appreciate it!
here's my script, by the way i'm using editpad lite as a text editor
Installation Method
cdrom
root Password
rootpw --iscrypted $1$XCsHfLzw$Ej9sXmmdMY1XO/V2pW8Py/
Authconfig
auth --enableshadow --enablemd5
BootLoader ( The user has to use grub by default )
bootloader --location=mbr
Timezone
timezone Europe/London
X windowing System
skipx
Install or Upgrade
install
Text Mode
text
Network install type
network --bootproto static --ip=ADS_IP_ADDRESS --netmask=ADS_SUBNET_MASK --hostname=ADS_COMPUTER_NAME --gateway 192.168.0.1 --nameserver=ADS_DNS_SERVER --addvmportgroup=0 --vlanid=0
Language
lang en_US
Langauge Support
langsupport --default en_US
Keyboard
keyboard uk
Mouse
mouse none
Reboot after install ?
reboot
Firewall settings
firewall --disabled
Clear Partitions
clearpart --all --initlabel --drives=sda
Partitioning
Boot
part /boot --fstype ext3 --size 102 --ondisk sda
Root - SHOULD BE 5000
part / --fstype ext3 --size 2997 --ondisk sda
Swap
part swap --size 544 --ondisk sda
#Part Logs SHOLD BE 4096
part /var/log --fstype ext3 --size 2096 --ondisk sda
#Part tmp files - SHOULD BE 2048
part /tmp --fstype ext3 --size 1048 --ondisk sda
#Local VMFS partition - SHOULD BE 6000
part None --fstype vmfs3 --size 1000 --grow --ondisk sda
#VMKcore Partition
part None --fstype vmkcore --size 100 --ondisk sda
VMware Specific Commands
vmaccepteula
#Licensing Info
vmlicense --mode=server --server=27010@192.168.0.20 --edition=esxFull
%packages
@base
%post
Your postinstall script goes here!
cat > /tmp/esxcfg.sh <<EOF1
#!/bin/sh
Configure ESX Server
Create vSwitch1 with a port group of Internal
esxcfg-vswitch -a vSwitch1
esxcfg-vswitch -A Internal vSwitch1
Create a vSwitch2 with a port group of Production using vmnic1
esxcfg-vswitch -a vSwitch2
esxcfg-vswitch -A Production vSwitch2
esxcfg-vswitch -L vmnic1 vSwitch2
esxcfg-vswitch -L vmnic2 vSwitch2
Create a vSwitch3 with a port group of VMotion using vmnic3
esxcfg-vswitch -a vSwitch3
esxcfg-vswitch -A VMotion vSwitch3
esxcfg-vswitch -L vmnic3 vSwitch3
esxcfg-vmknic -a VMotion -i 10.0.0.3 -n 255.255.255.0
On its own vmknic cannot enable VMotion...
BUT this does - By using vimsh together with the portgroup internal ID
A restart of the management service and a sleep is required...
service mgmt-vmware restart
sleep 20
vimsh -n -e "/hostsvc/vmotion/vnic_set portgroup4"
Create add with a port group for iSCSI/iSCSI-CIS using vSwitch3
esxcfg-vswitch -a vSwitch3
esxcfg-vswitch -A iSCSI vSwitch3
esxcfg-vmknic -a iSCSI -i 172.168.3.113 -n 255.255.255.0
esxcfg-vswitch -A iSCSI-COS vSwitch3
esxcfg-vswif -a vswif1 -p iSCSI-COS -i 172.168.3.103 -n 255.255.255.0
Set-up iSCSI Software Emulator
esxcfg-swiscsi -e
vmkiscsi-tool -D -a 172.168.3.210 vmhba40
esxcfg-swiscsi -s
esxcfg-rescan vmhba40
VLAN Example
esxcfg-vswitch -a vSwitch2
esxcfg-vswitch -A accounts vSwitch2
esxcfg-vswitch -A rnd vSwitch2
esxcfg-vswitch -A sales vSwitch2
esxcfg-vswitch -L vmnic4 vSwitch2
esxcfg-vswitch -L vmnic5 vSwitch2
esxcfg-vswitch -v 10 -p accounts vSwitch2
esxcfg-vswitch -v 20 -p rnd vSwitch2
esxcfg-vswitch -v 30 -p sales vSwitch2
Connect to a NAS...
esxcfg-nas -a iso -o nfs1.vi3book.com -s /iso
Add 2nd/3rd DNS settings
echo nameserver 192.168.3.131 >> /etc/resolv.conf
echo nameserver 192.168.3.132 >> /etc/resolv.conf
Create a local user for SSH Access - Default password is password
useradd -p '$1$Rg69B9QA$JUtqStBrjNFbyzyP9zTsf0' -c "Mike Laverick" lavericm
DANGEROUS: Allow ROOT access using SSH
sed -e 's/PermitRootLogin no/PermitRootLogin yes/' /etc/ssh/sshd_config > /etc/ssh/sshd_config.new
mv -f /etc/ssh/sshd_config.new /etc/ssh/sshd_config
service sshd restart
Enable the SSH client (Out/From an ESX hosts)
esxcfg-firewall -e sshClient
EOF1
Make esxcfg.sh eXcutable
chmod +x /tmp/esxcfg.sh
Backup original rc.local file
cp /etc/rc.d/rc.local /etc/rc.d/rc.local.bak
Make esxcfg.sh run from rc.local and make rc.local reset itself
cat >> /etc/rc.d/rc.local <<EOF
cd /tmp
/tmp/esxcfg.sh
mv -f /etc/rc.d/rc.local.bak /etc/rc.d/rc.local
EOF