服务器初始化

yum update



yum -y install gcc gcc-c++ make autoconf libtool-ltdl-devel gd-devel freetype freetype-devel libxml2-devel libjpeg-devel libpng-devel openssl-devel openssl curl-devel bison patch unzip libmcrypt-devel libmhash-devel ncurses-devel sudo bzip2 setuptool libaio-devel zlib zlib-devel glibc glibc-devel glib2 glib2-devel e2fsprogs e2fsprogs-devel openssh-clients ntp vnstat htop mlocate lsof lrzsz sysstat vim-enhanced strace telnet rsync tcpdump tcpflow fonts-chinese cmake libmcrypt* libtool* libtool-ltdl-devel* cmake bison pcre pcre-devel libevent libevent-devel


普通服务器配置

echo 65535 >/proc/sys/fs/file-max

echo "ulimit -SHn 65535" >> /etc/rc.local

cat >> /etc/security/limits.conf << EOF

*           soft   nofile       65535

*           hard   nofile       65535

EOF

前端web服务器的配置

echo 655350 >/proc/sys/fs/file-max

echo "ulimit -SHn 655350" >> /etc/rc.local

cat >> /etc/security/limits.conf << EOF

*           soft   nofile       655350

*           hard   nofile       655350

EOF



#set purview

chmod 600 /etc/passwd

chmod 600 /etc/shadow

chmod 600 /etc/group

chmod 600 /etc/gshadow



cat >> /etc/sysctl.conf << EOF

net.ipv4.tcp_fin_timeout = 1

net.ipv4.tcp_keepalive_time = 1200

net.ipv4.tcp_mem = 94500000 915000000 927000000

net.ipv4.tcp_tw_reuse = 1

net.ipv4.tcp_timestamps = 0

net.ipv4.tcp_synack_retries = 1

net.ipv4.tcp_syn_retries = 1

net.ipv4.tcp_tw_recycle = 1

net.core.rmem_max = 16777216

net.core.wmem_max = 16777216

net.core.netdev_max_backlog = 262144

net.core.somaxconn = 262144

net.ipv4.tcp_max_orphans = 3276800

net.ipv4.tcp_max_syn_backlog = 262144

net.core.wmem_default = 8388608

net.core.rmem_default = 8388608

EOF

/sbin/sysctl -p


你可能感兴趣的:(服务器初始化)