Server One-click Optimization script, highlighting
Content: Turn off SELinux, time sync settings, zabbix-agent installation, handle count tuning, common software installation, permanent static route additions
#/bin/bash
echo "# # # #start shutdown selinux########"
Sed-i ' s/selink=enforcing/selink=disabled/'/etc/selinux/config
Setenforce 0
value_selinux= ' Getenforce '
If [value_selinux= "Permissive"];then
Echo-e "\033[32m SELinux has successsfully shutdown! \033[0m "
Else
Echo-e "\033[31m SELinux has no shutdown \033[0m"
Fi
echo ""
echo "########## #start crontab set##########"
echo "0 0 * * */usr/sbin/ntpdate pool.ntp.org >/dev/null 2>&1" >>/var/spool/cron/root
Echo-e "\033[32m Crontab has been added successfully \033[0m"
echo ""
echo "######### #start install zabbix-agent#########"
RPM-IVH http://repo.zabbix.com/zabbix/2.2/rhel/6/x86_64/zabbix-release-2.2-1.el6.noarch.rpm
Yum install-y Zabbix zabbix-agent
Mkdir-p/var/log/zabbix/
Chown-r Zabbix.zabbix/var/log/zabbix
Sed-i ' s/serveractive=127.0.0.1/serveractive=10.0.0.30:10051/'/etc/zabbix/zabbix_agentd.conf
Sed-i ' S/hostname=zabbix server/hostname=mongodb1/'/etc/zabbix/zabbix_agentd.conf
Sed-i ' s/server=127.0.0.1/server=10.0.0.30/'/etc/zabbix/zabbix_agentd.conf
Service Zabbix-agent Start
Echo-e "\033[32m Install success! And zabbix-agnet have been up \033[0m "
echo ""
echo "########### #Add service to System boot#########"
echo "Ulimit-sh 65535" >>/etc/rc.local
echo "1. Change Ulimit to 65535 success "
echo "Route add-net 10.10.0.0/24 GW 10.0.0.30" >/etc/sysconfig/static-routes
ECHO-E "\033[32m Add VPN route successfully \033[0m"
echo ""
echo "######### #open file Handel to 65535#######"
echo "* Soft Nproc 65535" >>/etc/security/limits.conf
echo "* Hard Nproc 65535" >>/etc/security/limits.conf
echo "* Soft nofile 65535" >>/etc/security/limits.conf
echo "* Hard nofile 65535" >>/etc/security/limits.conf
Echo-e "\033[32m file Handel has been successfully changed \033[0m"
echo ""
echo "######### #iptables optimization#####"
echo "net.nf_conntrack_max=2097152" >>/etc/sysctl.conf
Sysctl-p
Echo-e "\033[32m iptables optimization Successful \033[0m"
echo "###### install software"
Yum Install Dos2unix telnet lrzsz-y
Linux Server one-click Optimization script