#1初始化系统
yum -y update
yum -y install ntpdate
ntpdate asia.pool.ntp.org
yum -y install wget make cmake vim gcc gcc-c++ ncurses ncurses-devel autoconf libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel bzip2 bzip2-devel curl curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel openssl openssl-devel openldap openldap-devel nss_ldap openldap-clients openldap-servers pcre pcre-devel zlip zlip-devel libtool-ltdl-devel openssh-clients
#2下载资源
mkdir -p /srv/source
cd /srv/source/
wget https://sourceforge.net/projects/mcrypt/files/Libmcrypt/Production/libmcrypt-2.5.7.tar.gz
tar xf libmcrypt-2.5.7.tar.gz && cd libmcrypt-2.5.7
./configure && make -j16 && make install
ln -s /usr/local/lib/libmcrypt.so.4 /usr/lib64/
ldconfig
#3 内核参数调整
echo "net.ipv4.tcp_tw_reuse = 1" >> /etc/sysctl.conf
echo "net.ipv4.tcp_tw_recycle = 1" >> /etc/sysctl.conf
echo "net.ipv4.tcp_fin_timeout = 30" >> /etc/sysctl.conf
echo "net.ipv4.tcp_keepalive_time = 1200" >> /etc/sysctl.conf
echo "net.ipv4.ip_local_port_range = 1024 65000" >> /etc/sysctl.conf
echo "net.ipv4.tcp_max_tw_buckets = 5000" >> /etc/sysctl.conf
echo "net.core.somaxconn = 2048" >> /etc/sysctl.conf
#4 修改最大连接数
echo "* soft nofile 32768" >> /etc/security/limits.conf
echo "* hard nofile 65536" >> /etc/security/limits.conf
#5 关闭ipv6
touch /etc/modprobe.d/ipv6.conf
echo "install ipv6 /bin/true" > /etc/modprobe.d/ipv6.conf
echo "IPV6INIT=no" >> /etc/sysconfig/network
chkconfig ip6tables off
#6 创建别名
echo "alias le=‘netstat -lpant | grep LISTEN‘" >> /root/.bashrc
source /root/.bashrc
#7 关闭防火墙
chkconfig --del iptables
service iptables stop
#8 安装htop
yum -y install htop