Kickstart Changes from RHEL6 to RHEL7
I’ve just started installing RHEL7 on some systems at work. I usually use a kickstart script to set everything up, but the syntax of the command has changed with RHEL7. Here’s the way to get the kickstart file from our satellite server using both RHEL6 and RHEL7.
RHEL6
ks=http://rhn.example.com/ks/cfg/org/57/label/bluebird-kickstart ip=192.168.1.104 netmask=255.255.255.0 gateway=192.168.1.1 dns=192.168.2.2
RHEL7
inst.ks=http://rhn.example.com/ks/cfg/org/57/label/bluebird-kickstart ip=192.168.1.104::192.168.1.1:255.255.255.0:bluebird:enp1s0:none nameserver=192.168.2.2
The one tricky part with RHEL7 is that I don’t know the name of the ethernet device before I start installing. I’ve done three different computers now and the name has been enp1s0, eno1 and enp3s0. So my solution is to just try to install the os first, without using the kickstart file. Then I can find out what it thinks the device name is. After that, I restart the install using the correct device name.
Later addition
When I first boot from the disk, press tab to see the details of the boot. I get this:
vmlinuz initrd=initrd.img inst.stage2=hd:LABEL=RHEL-70\x20Workstation.x86_64 rd.live.check quiet
For my kickstart above to work, I change this to:
vmlinuz initrd=initrd.img inst.ks=http://rhn.example.com/ks/cfg/org/57/label/bluebird-kickstart ip=192.168.1.104::192.168.1.1:255.255.255.0:bluebird:enp1s0:none nameserver=192.168.2.2
And for just to add, for this computer the network name was enp6s0.
End of addition
I also rewrote my script that checks if the system needs to be reboot. It’s pretty simple, but I now do need to take into account what version of the operating system is running. And I’m not sure why the original script I wrote was in perl. I think I must have been learning that at the time. The new one is just a bash script, which makes things much easier.
#!/bin/bash # kernelcheck - script to check if a new kernel has been loaded and is running # Get currently running kernel currentkernel=`uname -a|awk '{ print $3 }'` # Look at grub to find out what the latest kernel is. This is slightly different depending on the os version. version=`cat /etc/redhat-release | awk '{ print $7 }' | cut -c1` if [[ $version == '7' ]] then nextkernel=`grep vmlinuz /etc/grub2.cfg | head -1 | awk '{ print $2 }' | cut -c10-` else nextkernel=`sed '/#/d' /etc/grub.conf |grep vmlinuz | head -1 | awk '{ print $2 }' | cut -c10-` fi if [[ $currentkernel != $nextkernel ]] then HOST=$HOSTNAME SUBJECT="Reboot required on $HOSTNAME" EMAIL="[email protected]" EMAILMESSAGE="/tmp/$HOSTNAME.txt" echo "Current kernel: $currentkernel"> $EMAILMESSAGE echo "Next kernel: $nextkernel">> $EMAILMESSAGE /bin/mail -s "$SUBJECT" "$EMAIL" < $EMAILMESSAGE fi