centos环境配置 本文最后更新于:2 年前 centos环境配置centos7基础环境12yum install -y vim ntp rsyncyum install -y telnet bind-utils sysstat net-tools limit 修改线程数限制1234567891011grep -q 'docker' /etc/security/limits.conf if [ $? -ne 0 ];thentee -a /etc/security/limits.conf << EOFroot - nofile 40960nginx - nofile 40960apache - nofile 40960www - nofile 40960service - nofile 40960docker - nofile 40960EOFfi DNS12345cat > /etc/resolv.conf << EOFoptions timeout:1 attempts:1nameserver 10.10.25.4nameserver 114.114.114.114EOF 时间同步12345yum install ntp -yntpdate time-server.boss.comsed -i 's/^server 0.centos.pool.ntp.org iburst/server time-server.boss.com/' /etc/ntp.confsystemctl start ntpdsystemctl enable ntpd 加上本机 hosts 解析123host_name=`hostname`host_ip=$(ip addr |grep inet | egrep -v 'inet6|docker|br-|127.0.0.1|lo:' | awk '/^[0-9]+: / {}; /inet.*global/ {print gensub(/(.*)\/(.*)/, "\\1", "g", $2)}' | head -n 1)grep $host_name /etc/hosts || echo '' >> /etc/hosts && echo "${host_ip} ${host_name}" >> /etc/hosts TCP优化1234567grep -q 'tcp_fin_timeout' /etc/sysctl.confif [ $? -ne 0 ];thentee -a /etc/sysctl.conf <<-EOFnet.ipv4.tcp_fin_timeout = 30EOFsysctl -pfi centos docker redis memcached centos 版权所有,转载请注明出处! CentOS 7系统搭建DNS服务(正向解析、反向解析、主从同步) 上一篇 firewall-cmd配置 下一篇