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

centos 7 服务初始化

时间:2019-11-13 16:37:45      阅读:93      评论:0      收藏:0      [点我收藏+]

标签:har   bsp   release   inux   com   lease   wal   sof   mem   

更新yum源及必要软件安装

yum groupinstall "Development tools" "Compatibility libraries" 
yum install -y ntpdate vim mlocate lsof wget lrzsz telnet traceroute tree rsync cmake autoconf automake pcre pcre-devel zlib zlib-devel epel-release

yum重新建立缓存

yum clean all
yum makecache

 

关闭防火墙、selinux
systemctl stop firewalld #临时关闭防火墙
systemctl disable firewalld #防火墙开机关闭

setenforce 0 #临时关闭SELinux
sed -i ‘s/SELINUX=enforcing/SELINUX=disabled/‘ /etc/selinux/config #开机关闭SELinux

设置最大打开文件描述符数

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

cat >> /etc/security/limits.conf << EOF
* soft nofile 655350
* hard nofile 655350
EOF

内核参数优化

#cat >> /etc/sysctl.conf << EOF
vm.overcommit_memory = 1
net.ipv4.ip_local_port_range = 1024 65536
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_tw_recycle = 1
net.ipv4.tcp_timestamps = 0
net.ipv4.tcp_synack_retries = 1
net.ipv4.tcp_syn_retries = 1
net.ipv4.tcp_abort_on_overflow = 0
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
net.ipv4.netfilter.ip_conntrack_max = 2097152
net.nf_conntrack_max = 655360
net.netfilter.nf_conntrack_tcp_timeout_established = 1200
EOF

 

#/sbin/sysctl -p

主机名修改

hostname 主机名 #先修改临时名,重启后会失效
hostnamectl set-hostname 主机名 #永久修改主机名,需要重启

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

centos 7 服务初始化

标签:har   bsp   release   inux   com   lease   wal   sof   mem   

原文地址:https://www.cnblogs.com/liujunjun/p/11849853.html

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