中文字幕av专区_日韩电影在线播放_精品国产精品久久一区免费式_av在线免费观看网站

溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

Centos6 anf Centos7 system_init

發布時間:2020-06-27 21:14:20 來源:網絡 閱讀:529 作者:younger008 欄目:軟件技術

#!/bin/bash
# 此腳本主要針對系統剛完成安裝,對系統完成參數調優

##### check id root #####
if [ $(id -u) != "0" ]; then
    echo "You must be root to run this script ..."
    exit 1
fi

##### set function #####
CentOS6 ()
{
    yum install -y wget
    /usr/bin/wget -qO /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
    /usr/bin/wget -qO /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-6.repo
    yum install -y tree screen make cmake vim ntpdate telnet nc lrzsz gcc gcc-c++
    /etc/init.d/iptables stop && chkconfig iptables off
}

CentOS7 ()
{
    yum install -y wget
    /usr/bin/wget -qO /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo  
    /usr/bin/wget -qO /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
    yum install -y tree screen make cmake vim ntpdate telnet nc lrzsz gcc gcc-c++
    systemctl stop firewalld.service && systemctl disable firewalld.service    
}

##### get system Edition #####
Edition=`grep -o '[[:digit:]]' /etc/redhat-release |head -1`
if [ $Edition == '6' ];then
    echo -e "\n\033[34mStart CentOS6 installation……\033[0m\n"
    CentOS6
elif [ $Edition == '7' ]; then
    echo -e "\n\033[34mStart CentOS7 installation……\033[0m\n"
    CentOS7    
else
    echo "This system is not CentOS 6, script execution failed ..."
    exit 2    
fi

####################華麗的分割線 6 與7 命令不同的寫在上面函數中  命令相同的寫在下面####################################

##### disable selinux && iptables #####
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
setenforce 0

##### set vim #####
sed -i "7a alias vi='vim'" /root/.bashrc
sed -i "8a alias grep='grep --color'" /root/.bashrc

##### set ssh #####
ssh_cf="/etc/ssh/sshd_config"
sed -i 's/#GSSAPIAuthentication no/GSSAPIAuthentication no/g' $ssh_cf
sed -i 's/GSSAPIAuthentication yes/#GSSAPIAuthentication yes/g' $ssh_cf
sed -i "s/#UseDNS yes/UseDNS no/" $ssh_cf

##### set ntpdate #####
echo '*/4 * * * * /usr/sbin/ntpdate time.windows.com >/dev/null 2>&1' >> /var/spool/cron/root
\cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
# \cp /usr/share/zoneinfo/America/New_York /etc/localtime  紐約(西5區)
# \cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime     中國(東8區)
# \cp /usr/share/zoneinfo/Asia/Bangkok /etc/localtime      泰國(東7區)
# \cp /usr/share/zoneinfo/Asia/Korea /etc/localtime        韓國(東9區)
# \cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime        日本(東9區)

##### set limits #####
echo -e "* soft nofile 65535\n* hard nofile 65535" >>/etc/security/limits.conf

##### set kernel #####
>/etc/sysctl.conf
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_keepalive_time = 1200
net.ipv4.ip_local_port_range = 1024 65535

net.ipv4.conf.all.rp_filter = 0
net.ipv4.conf.default.rp_filter = 0
net.ipv4.conf.eth0.rp_filter = 0
net.ipv4.conf.all.arp_announce = 2
net.ipv4.conf.default.arp_announce = 2
net.ipv4.conf.eth0.arp_announce = 2
#Add

net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_tw_reuse = 0
net.core.wmem_max = 327679
net.core.rmem_max = 327679
net.core.wmem_default = 327679
net.core.rmem_default = 327679
net.ipv4.tcp_fin_timeout = 30
net.ipv4.tcp_syn_retries = 3
net.ipv4.tcp_synack_retries = 3
net.ipv4.tcp_max_syn_backlog = 65536
net.core.netdev_max_backlog = 65536
net.core.somaxconn = 65536
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
EOF
/sbin/sysctl -p

echo -e "\n\033[32mSystem initialization completed, you must restart the system\033[0m\n"

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

岳阳市| 通道| 油尖旺区| 盐边县| 南岸区| 临汾市| 安化县| 茌平县| 淮北市| 元江| 诸城市| 鸡西市| 阿克陶县| 阳东县| 彰化县| 衡南县| 波密县| 鄂尔多斯市| 巴马| 丹阳市| 淅川县| 伊宁县| 呼伦贝尔市| 江孜县| 托里县| 远安县| 新龙县| 阜平县| 连平县| 玉林市| 宜兰县| 紫阳县| 驻马店市| 普陀区| 怀来县| 开鲁县| 广灵县| 红原县| 元谋县| 隆安县| 昌图县|