zoukankan      html  css  js  c++  java
  • centos7.2 基础优化脚本

    #防火墙
    systemctl status iptables
    systemctl status firewalld
    systemctl stop firewalld
    systemctl disable firewalld
    systemctl status firewalld
    #selinux 关闭
    sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config
    setenforce 0
    #打开文件数
    sed -i '/# End of file/i*		-	nofile		65535' /etc/security/limits.conf 
    cat /etc/security/limits.conf 
    ulimit -HSn 65535
    ulimit -n
    #内核参数调整
    echo 'net.ipv4.ip_forward = 1' > /etc/sysctl.conf
    echo 'net.ipv4.tcp_timestamps = 1' >> /etc/sysctl.conf
    echo 'net.ipv4.tcp_tw_recycle = 1' >> /etc/sysctl.conf
    echo 'net.ipv4.tcp_fin_timeout = 30' >> /etc/sysctl.conf
    sysctl -p
    #配置yum源为aliyun
    cd /etc/yum.repos.d
    mv CentOS-Base.repo CentOS-Base.repo.bak
    rpm -ivh http://source.zhaolibin.com/scripts/wget-1.14-10.el7_0.1.x86_64.rpm
    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
    yum clean all
    yum makecache
    #修改时区同步时间
    rm -rf /etc/localtime ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime yum install ntpdate -y echo "*/5 * * * * /usr/sbin/ntpdate -d 0.asia.pool.ntp.org" >> /var/spool/cron/root

      

     

    ntpdate 0.asia.pool.ntp.org
    docker 镜像加速
    --registry-mirror=https://odhacnra.mirror.aliyuncs.com
    

      

    1. yum install ntpdate -y
    2. echo "*/5 * * * * /usr/sbin/ntpdate 0.asia.pool.ntp.org">>/var/spool/cron/root
  • 相关阅读:
    ubuntn16.04指令
    [Array]283. Move Zeroes
    spring框架
    Redis服务器搭建/配置/及Jedis客户端的使用方法
    [Java Performance] 数据库性能最佳实践
    iOS 序列化和反序列化
    SSH 获取GET/POST参数
    MAC中安卓开发环境的下载
    MAC OS下使用OpenSSL生成私钥和公钥的方法
    如何使用TestFlight进行Beta测试
  • 原文地址:https://www.cnblogs.com/creazylinux/p/7365348.html
Copyright © 2011-2022 走看看