日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

linux 修改默认脚本,linux环境初始脚本

發布時間:2023/12/4 linux 29 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux 修改默认脚本,linux环境初始脚本 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

#//把下面內容,做成init.sh文件,放到liunx任意目錄下,用

bash ./init.sh

#//執行,或用

chmod -R 777 init.sh

#//賦權后,再用

./init.sh

#//執行

#!/bin/bash

#

# 初始centOS系統環境

# 1. 在線安裝一些編譯環境

# 2. 關閉防火墻

# 3. 修改內核參數

#

#

yuminst(){

#update yum

yum -y update

#install epel EPEL 是yum的一個軟件源,里面包含了許多基本源里沒有的軟件

wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm

wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

sudo rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

#install

yum install -y setuptool ntsysv iptables pcre-devel openssl-devel bzip2-devel xinetd lrzsz lsof system-config-securitylevel-tui system-config-network-tui apr-util xorg-x11-drv-penmount perl-DBD-MySQL bind-utils --nogpgcheck

yum install -y zip unzip --nogpgcheck

yum install -y libselinux-python python-devel

yum install -y net-snmp #net-snmp-perl net-snmp-utils net-snmp-devel

yum install -y mlocate --nogpgcheck

updatedb

yum install -y ncurses ncurses-devel bison

yum install -y glibc glibc-common glibc-devel gd gd-devel libtool libpcap libpcap-devel gdbm gdbm-devel zlib zlib-devel libxslt audit-libs-devel --nogpgcheck

yum install -y openssh openssh-server openssh-clients --nogpgcheck

yum install -y make cmake vim* gcc gcc-c++ --nogpgcheck

yum install -y nfs-utils nfs-utils-lib nfs4-acl-tools cifs-utils xfsprogs --nogpgcheck

yum install -y crontabs vixie-cron --nogpgcheck

yum install -y ntp --nogpgcheck

yum install -y telnet

}

ser(){

/etc/init.d/crond start

chkconfig crond on

/etc/init.d/iptables stop

chkconfig iptables off

/etc/init.d/sshd start

chkconfig sshd on

setenforce 0

sed -ri 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config

}

kernal(){

#內核參數修改

modprobe nf_conntrack

echo "modprobe nf_conntrack" >> /etc/rc.local

modprobe bridge

echo "modprobe bridge" >> /etc/rc.local

echo '

net.ipv4.tcp_fin_timeout = 60

net.ipv4.tcp_tw_reuse = 1

net.ipv4.tcp_tw_recycle = 1

net.ipv4.tcp_syncookies = 1

net.ipv4.tcp_max_syn_backlog = 16384

net.ipv4.tcp_max_tw_buckets = 36000

net.ipv4.route.gc_timeout = 100

net.ipv4.tcp_syn_retries = 2

net.ipv4.tcp_synack_retries = 1

net.core.somaxconn = 32768

net.core.netdev_max_backlog = 32768

net.ipv4.tcp_max_orphans = 327680

net.nf_conntrack_max = 102400

net.netfilter.nf_conntrack_max = 102400

net.netfilter.nf_conntrack_tcp_timeout_established = 180

net.netfilter.nf_conntrack_tcp_timeout_time_wait = 120

net.netfilter.nf_conntrack_tcp_timeout_close_wait = 60

net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 120' >> /etc/sysctl.conf

sysctl -p

echo ''

}

filelimit(){

#修改打開文件限制

echo 'ulimit -n 65535' >> /etc/profile

source /etc/profile

echo '* soft nproc 65535

* hard nproc 65535

* soft nofile 65535

* hard nofile 65535' >> /etc/security/limits.conf

echo '* soft nproc 65535' >> /etc/security/limits.d/90-nproc.conf

echo -e "================= 修改打開文件限制完成 ================="

}

echo "1: yum安裝基礎環境"

echo "2: 修改內核參數及文件限制"

echo "3: all"

read -p "請選擇:" num

if [ -z $num ];then

echo $num

elif [ $num -eq 1 ];then

yuminst

ser

elif [ $num -eq 2 ];then

kernal

filelimit

elif [ $num -eq 3 ];then

yuminst

ser

kernal

filelimit

else

echo "請輸入正確選項"

exit

fi

總結

以上是生活随笔為你收集整理的linux 修改默认脚本,linux环境初始脚本的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。