The following script will install the mainline kernel from ElRepo. The mainline kernel will be the most recent stable kernel rather than the more conservative kernel used in CentOS.

The following script was pulled from one of my setup scripts.

function install_new_kernel() {

	if ! yum repolist | grep elrepo > /dev/null ; then
		echo "This will now install the ELRepo repository from"
		if ! prompt "Do you wish to install ELRepo on the system?" Y ; then

		rpm --import
		rpm -Uvh
		yum clean all

	# Need to enable the repo.
	sed -i '/\[elrepo-kernel\]/,/^\[/ s/enabled=0/enabled=1/' /etc/yum.repos.d/elrepo.repo

	# Should do a full update first.
	yum update

	# Install the mainline kernel
	yum install kernel-ml kernel-ml-devel kernel-ml-headers \
		|| die "Could not install kernel."

	Option=`awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg | /bin/grep -n 3.17 | head -n 1 | cut -f1 -d:`

	echo "Current kernels installed:"
	awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg
	echo "-- End of List --"
	echo "Kernel made to boot will be: " $(awk -F\' '$1=="menuentry " {print $2}' /etc/grub2.cfg | sed -n "$Option{p;q}")
	if prompt "Is this okay?" Y ; then
		grub2-set-default $[$Option - 1]
		grub2-mkconfig -o /boot/grub2/grub.cfg
		echo "Default now set to: " $(grub2-editenv list)
		warning "You should now reboot the server to apply the new kernel."
		echo "Please select the grub option and run:"
		echo " grub2-set-default X     - where X is the option"
		echo " grub2-mkconfig -o /boot/grub2/grub.cfg"