博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
centos7最小安装初始化脚本
阅读量:2228 次
发布时间:2019-05-09

本文共 2973 字,大约阅读时间需要 9 分钟。

#!/bin/bash#zhangsen#lovexlzs@qq.comif [[ "$(whoami)" != "root" ]]; then      echo "please run this script as root ." >&2    exit 1fi  echo -e "\033[31m 这个是centos7系统初始化脚本,请慎重运行!Please continue to enter or ctrl+C to cancel \033[0m"sleep 5#configure yum sourceyum_config(){    yum install wget epel-release -y    cd /etc/yum.repos.d/ && mkdir bak && mv -f *.repo bak/    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    yum -y install iotop iftop net-tools lrzsz gcc gcc-c++ make cmake libxml2-devel openssl-devel curl curl-devel unzip sudo ntp libaio-devel wget vim ncurses-devel autoconf automake zlib-devel  python-devel bash-completion}#firewalldiptables_config(){    systemctl stop firewalld.service    systemctl disable firewalld.service    yum install iptables-services -y    systemctl enable iptables    systemctl start iptables    iptables -F    service iptables save}#system configsystem_config(){    sed -i "s/SELINUX=enforcing/SELINUX=disabled/g" /etc/selinux/config    timedatectl set-local-rtc 1 && timedatectl set-timezone Asia/Shanghai    yum -y install chrony && systemctl start chronyd.service && systemctl enable chronyd.service }ulimit_config(){    echo "ulimit -SHn 102400" >> /etc/rc.local    cat >> /etc/security/limits.conf << EOF    *           soft   nofile       102400    *           hard   nofile       102400    *           soft   nproc        102400    *           hard   nproc        102400 EOF }#set sysctlsysctl_config(){    cp /etc/sysctl.conf /etc/sysctl.conf.bak    cat > /etc/sysctl.conf << EOF    net.ipv4.ip_forward = 0    net.ipv4.conf.default.rp_filter = 1    net.ipv4.conf.default.accept_source_route = 0    kernel.sysrq = 0    kernel.core_uses_pid = 1    net.ipv4.tcp_syncookies = 1    kernel.msgmnb = 65536    kernel.msgmax = 65536    kernel.shmmax = 68719476736    kernel.shmall = 4294967296    net.ipv4.tcp_max_tw_buckets = 6000    net.ipv4.tcp_sack = 1    net.ipv4.tcp_window_scaling = 1    net.ipv4.tcp_rmem = 4096 87380 4194304    net.ipv4.tcp_wmem = 4096 16384 4194304    net.core.wmem_default = 8388608    net.core.rmem_default = 8388608    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.ipv4.tcp_timestamps = 0    net.ipv4.tcp_synack_retries = 1    net.ipv4.tcp_syn_retries = 1    net.ipv4.tcp_tw_recycle = 1    net.ipv4.tcp_tw_reuse = 1    net.ipv4.tcp_mem = 94500000 915000000 927000000    net.ipv4.tcp_fin_timeout = 1    net.ipv4.tcp_keepalive_time = 30    net.ipv4.ip_local_port_range = 1024 65000EOF    /sbin/sysctl -p    echo "sysctl set OK!!"}main(){    yum_config    iptables_config    system_config    ulimit_config    sysctl_config}main

 

转载于:https://www.cnblogs.com/37yan/p/6879510.html

你可能感兴趣的文章
seq2seq 入门
查看>>
什么是 Dropout
查看>>
用 LSTM 做时间序列预测的一个小例子
查看>>
用 LSTM 来做一个分类小问题
查看>>
详解 LSTM
查看>>
按时间轴简述九大卷积神经网络
查看>>
详解循环神经网络(Recurrent Neural Network)
查看>>
为什么要用交叉验证
查看>>
用学习曲线 learning curve 来判别过拟合问题
查看>>
用验证曲线 validation curve 选择超参数
查看>>
用 Grid Search 对 SVM 进行调参
查看>>
用 Pipeline 将训练集参数重复应用到测试集
查看>>
PCA 的数学原理和可视化效果
查看>>
机器学习中常用评估指标汇总
查看>>
什么是 ROC AUC
查看>>
Bagging 简述
查看>>
详解 Stacking 的 python 实现
查看>>
简述极大似然估计
查看>>
用线性判别分析 LDA 降维
查看>>
用 Doc2Vec 得到文档/段落/句子的向量表达
查看>>