centos6
#!/bin/bash
yum clean all
yum makecache || echo -e "\e[1;31m Please check that the yum source address is correct \e[0m"
# Before the installation check
for i in $(echo "man openssh-clients elinks lsof dstat sysstat vim");do
service_packages=$(rpm -qa |grep "^"$i"-[0-9]")
if [ $? == 0 ];then
echo -e "\e[1;32m $service_packages is installed!\e[0m"
else
echo -e "\e[1;31m $i is not installed!,In the installing,Please wait.\e[0m"
yum install $i -y > /dev/null 2>&1
fi
done
grep "nofile 65535" /etc/security/limits.conf || echo "* - nofile 65535" >>/etc/security/limits.conf
grep ignorespace /etc/profile.d/history.sh ||echo "export HISTCONTROL=ignorespace" >> /etc/profile.d/history.sh; source /etc/profile.d/history.sh
grep "export HISTTIMEFORMAT" /etc/profile.d/history.sh ||echo ‘export HISTTIMEFORMAT="%F-%T "‘ >>/etc/profile.d/history.sh