Script to Customize CentOS 7 Install in a VMware Environment

September 16, 2019 Jordansphere Linux

#!/bin/bash

echo "#######################################################################";
echo "This script will Update the OS, install useful tools and configure NTP";
echo "#######################################################################";

#Update OS
yum update -y

#install useful tools
yum install telnet -y
yum install bind-utils -y

# install vmware tools
yum install -y open-vm-tools
systemctl enable vmtoolsd.service
systemctl status vmtoolsd.service

# Disable selinux
/usr/bin/sed -i 's/^SELINUX=.*/SELINUX=disabled/g' /etc/selinux/config

# Set NTP and time
yum install -y ntp

#comment out all NTP servers
/usr/bin/sed -i 's/^server./#&/' /etc/ntp.conf

#Request and add NEW NTP servers
echo "Please enter 1st NTP server"
read ntp1
echo server $ntp1 iburst >> /etc/ntp.conf

while true; do
read -p "Would you like to add a secondary NTP server?" yn
case $yn in
 [Yy]* ) echo  "Please enter 2nd NTP server (y/n) "
read ntp2
echo server $ntp2 iburst >> /etc/ntp.conf
break;;

[Nn]* ) break;;
* ) echo "Please answer yes or no.";;
esac
done

#Start and enable NTPD
systemctl start ntpd
systemctl enable ntpd


# Install NRPE/Nagios Client
echo "Installing NRPE client"
yum -y install wget openssl-devel
cd /tmp
wget http://assets.nagios.com/downloads/nagiosxi/agents/linux-nrpe-agent.tar.gz
tar xzf linux-nrpe-agent.tar.gz
cd linux-nrpe-agent
./fullinstall
firewall-cmd --permanent --add-port=5666/tcp
firewall-cmd --reload
# End NRPE/Nagios Client

#Reboot server
reboot

 

 

 

Powered by WordPress. Designed by elogi.