新系统安装-centos7.4

wget -O /etc/yum.repos.d/CentOS-Base.repo  http://mirrors.aliyun.com/repo/Centos-7.repo
•补充安装软件包
yum -y install wget vim lrzsz bash-completion telnet nmap tree dos2unix nc sl
•关闭selinux:/etc/selinux/config
•关闭防火墙:systemctl disable firewalld.service
•关机做快照
chmod +x /etc/rc.d/rc.local
#加大文件描述
echo '* - nofile 65535 ' >>/etc/security/limits.conf 
tail -1 /etc/security/limits.conf 
#内核优化
cat >>/etc/sysctl.conf<<EOF
net.ipv4.ip_nonlocal_bind = 1
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
#以下参数是对iptables防火墙的优化,防火墙不开会提示,可以忽略不理。
net.nf_conntrack_max = 25000000
net.netfilter.nf_conntrack_max = 25000000
net.netfilter.nf_conntrack_tcp_timeout_established = 180
net.netfilter.nf_conntrack_tcp_timeout_time_wait = 120
net.netfilter.nf_conntrack_tcp_timeout_close_wait = 60
net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 120
EOF
sysctl -p
#ssh连接速度慢优化          
sed -i.bak 's@#UseDNS yes@UseDNS no@g;s@^GSSAPIAuthentication yes@GSSAPIAuthentication no@g' /etc/ssh/sshd_config
#做模板机
#1.删除网卡(eth0 eth1)中,UUID(硬件标识信息)和HWADDR(网络mac地址)进行删除
sed -ri '/UUID|HWADDR/d' /etc/sysconfig/network-scripts/ifcfg-eth[01]
#2.一清空:清空网络规则配置文件
echo '>/etc/udev/rules.d/70-persistent-net.rules' >>/etc/rc.local 
 
 

猜你喜欢

转载自www.cnblogs.com/lj7xun/p/11136064.html