i use CentOS 7.5 and kickstart to do an automated installation of CentOS. In the PostInstall Section of the kickstart file i run the following script to update the kernel and install VirtualBox:
Code: Select all
echo "Install current kernel"
rpm --import <some url>
rpm -Uvh <some url>
yum --enablerepo=elrepo-kernel install -y kernel-ml
grub2-set-default 0 # Set new kernel as default
echo "remove old kernel-headers"
yum remove -y kernel-headers
echo "remove old kernel"
yum remove -y kernel
echo "install new kernel-headers"
yum --enablerepo=elrepo-kernel install -y kernel-ml-headers
echo "install new kernel-devel"
yum --enablerepo=elrepo-kernel install -y kernel-ml-devel
###################################################################
# REBOOT IS NEEDED HERE TO INSTALL VBOXGUEST FOR THE NEW KERNEL
###################################################################
GCPRODUCTNAME=$(dmidecode -s system-product-name)
if [ $GCPRODUCTNAME == "VirtualBox" ]
then
echo "Install Virtualbox guest utilities prerequisites"
yum install -y gcc make perl bzip2 # Will be uninstalled by removing the old kernel-headers
echo "Install Virtualbox guest utilities"
/tmp/PostInstall/Desktop/VBoxGuest/$VB_GUESTVERSION/VBoxLinuxAdditions.run
echo "Add admin user to vboxsf group to allow access to shared folders"
usermod -a -G vboxsf admin # This allows access to SharedFiles share
fi
Regards Dave