主頁 > 知識(shí)庫 > 分享個(gè)簡易版Linux服務(wù)器初始化Shell腳本

分享個(gè)簡易版Linux服務(wù)器初始化Shell腳本

熱門標(biāo)簽:地圖標(biāo)注員都是年輕人 江蘇云電銷機(jī)器人公司 百度地圖標(biāo)注錯(cuò)了有責(zé)任嗎 華鋒e路航港口地圖標(biāo)注 河南信譽(yù)好的不封卡電話外呼系統(tǒng) 如果做線上地圖標(biāo)注 打電話機(jī)器人接我是他的秘書 客服外呼系統(tǒng)怎么樣 揭陽智能電話機(jī)器人推薦
該Shell腳本主要用于新安裝Linux服務(wù)器系統(tǒng)的初始化工作,具體包括:

關(guān)閉IPv6模塊
關(guān)閉SELinux
讓vim顯示顏色
設(shè)置系統(tǒng)語言編碼
優(yōu)化系統(tǒng)服務(wù)
內(nèi)核參數(shù)優(yōu)化等。
可以根據(jù)自己的實(shí)際情況修改,可用于生產(chǎn)環(huán)境。原作者是NetSeek,本人做了部分修改。

復(fù)制代碼 代碼如下:

#!/bin/sh
# desc: lsm03624 modified by www.webnginx.com
#-------------------cut begin-------------------------------------------
#welcome
cat EOF
+--------------------------------------------------------------+
| === Welcome to Centos System init === |
+--------------http://www.linuxtone.org------------------------+
+----------------------Author:NetSeek--------------------------+
EOF
#disable ipv6
cat EOF
+--------------------------------------------------------------+
| === Welcome to Disable IPV6 === |
+--------------------------------------------------------------+
EOF
echo "alias net-pf-10 off" >> /etc/modprobe.conf
echo "alias ipv6 off" >> /etc/modprobe.conf
/sbin/chkconfig --level 35 ip6tables off
echo "ipv6 is disabled!"

#disable selinux
sed -i '/SELINUX/s/enforcing/disabled/' /etc/selinux/config
echo "selinux is disabled,you must reboot!"

#vim
sed -i "8 s/^/alias vi='vim'/" /root/.bashrc
echo 'syntax on' > /root/.vimrc

#zh_cn
sed -i -e 's/^LANG=.*/LANG="zh_CN.UTF-8"/' /etc/sysconfig/i18n
# configure file max to 52100
echo "* soft nofile 52100
* hard nofile 52100" >> /etc/security/limits.conf

#tunoff services
#--------------------------------------------------------------------------------
cat EOF
+--------------------------------------------------------------+
| === Welcome to Tunoff services === |
+--------------------------------------------------------------+
EOF
#---------------------------------------------------------------------------------
for i in `ls /etc/rc3.d/S*`
do
CURSRV=`echo $i|cut -c 15-`

echo $CURSRV
case $CURSRV in
cpuspeed | crond | irqbalance | microcode_ctl | mysqld | network | nginx | php-fpm | sendmail | sshd | syslog )
#這個(gè)啟動(dòng)的系統(tǒng)服務(wù)根據(jù)具體的應(yīng)用情況設(shè)置,其中network、sshd、syslog是三項(xiàng)必須要啟動(dòng)的系統(tǒng)服務(wù)!
echo "Base services, Skip!"

*)
echo "change $CURSRV to off"
chkconfig --level 235 $CURSRV off
service $CURSRV stop

esac
done

rm -rf /etc/sysctl.conf
echo "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 = 134217728
net.ipv4.ip_local_port_range = 1024 65536
net.core.rmem_max = 16777216
net.core.wmem_max = 16777216
net.ipv4.tcp_rmem = 4096 87380 16777216
net.ipv4.tcp_wmem = 4096 65536 16777216
net.ipv4.tcp_fin_timeout = 3
net.ipv4.tcp_tw_recycle = 1
net.core.netdev_max_backlog = 30000
net.ipv4.tcp_no_metrics_save = 1
net.core.somaxconn = 262144
net.ipv4.tcp_syncookies = 0
net.ipv4.tcp_max_orphans = 262144
net.ipv4.tcp_max_syn_backlog = 262144
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_syn_retries = 2
vm.swappiness = 6" >> /etc/sysctl.conf
echo "optimizited kernel configure was done!"
您可能感興趣的文章:
  • Linux CentOS服務(wù)器搭建與初始化配置教程
  • Linux 初始化MySQL 數(shù)據(jù)庫報(bào)錯(cuò)解決辦法
  • Linux 分區(qū)初始化為物理卷,把物理卷加入卷組的方法
  • linux系統(tǒng)的初始化配置淺析
  • Linux初始化系統(tǒng)盤后重新掛載數(shù)據(jù)盤方法

標(biāo)簽:許昌 巴彥淖爾 邵陽 金昌 馬鞍山 淘寶邀評(píng) 赤峰 婁底

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《分享個(gè)簡易版Linux服務(wù)器初始化Shell腳本》,本文關(guān)鍵詞  分享,個(gè),簡易,版,Linux,服務(wù)器,;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請(qǐng)?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 下面列出與本文章《分享個(gè)簡易版Linux服務(wù)器初始化Shell腳本》相關(guān)的同類信息!
  • 本頁收集關(guān)于分享個(gè)簡易版Linux服務(wù)器初始化Shell腳本的相關(guān)信息資訊供網(wǎng)民參考!
  • 推薦文章