Linux Server one-click Optimization script

Source: Internet
Author: User
Tags iptables

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.