码迷,mamicode.com
首页 > 其他好文 > 详细

Centos7 系统初试化脚本

时间:2018-12-25 18:09:52      阅读:128      评论:0      收藏:0      [点我收藏+]

标签:net   描述   tree   emctl   use   rzsz   cront   cycle   conf   

Centos7 系统初试化脚本

#!/bin/bash
yum install  -y wget && wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo && yum -y install vim wget bash-completion lrzsz nmap tree nc net-tools htop iotop iftop psmisc ntpdate && systemctl stop firewalld.service && systemctl disable firewalld.service 
#setenforce  0  && sed ‘7s#enforcing#disabled#g‘ /etc/selinux/config -i 
#优化文件描述符
echo *               -       nofile          65535  >>/etc/security/limits.conf
ulimit -n 65535   
#内核优化
cat >>/etc/sysctl.conf<<EOF
net.ipv4.tcp_fin_timeout = 2
net.ipv4.tcp_tw_reuse = 1
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_syncookies = 1
net.ipv4.tcp_keepalive_time = 600
net.ipv4.ip_local_port_range = 4000    65000
net.ipv4.tcp_max_syn_backlog = 16384
net.ipv4.tcp_max_tw_buckets = 36000
net.ipv4.route.gc_timeout = 100
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_synack_retries = 1
net.core.somaxconn = 16384
net.core.netdev_max_backlog = 16384
net.ipv4.tcp_max_orphans = 16384
EOF
sysctl -p
sed -i.bak s@#UseDNS yes@UseDNS no@g;s@^GSSAPIAuthentication yes@GSSAPIAuthentication no@g  /etc/ssh/sshd_config
systemctl restart sshd 
echo * * * * *  root /usr/sbin/ntpdate ntp1.aliyun.com >>/etc/crontab

 

Centos7 系统初试化脚本

标签:net   描述   tree   emctl   use   rzsz   cront   cycle   conf   

原文地址:https://www.cnblogs.com/root0/p/10175251.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!