美文网首页
linux系统初始化

linux系统初始化

作者: linux_python | 来源:发表于2020-03-25 21:43 被阅读0次

author dalong

date 2019/11/4

author dalong

date 2019/11/4

第一步选择网关和子网掩码

gateway="10.0.123.1"
echo "ntp自动对时."
{
yum list &>>/dev/null
yum -y install ntpdate &>>/dev/null
ntpdate ntp1.aliyun.com &>/dev/null
}&
sleep 1
echo "完成!!!"
echo "

sysctl settings are defined through files in

/usr/lib/sysctl.d/, /run/sysctl.d/, and /etc/sysctl.d/.

Vendors settings live in /usr/lib/sysctl.d/.

To override a whole file, create a new file with the same in

/etc/sysctl.d/ and put new settings there. To override

only specific settings, add a file with a lexically later

name in /etc/sysctl.d/ and put new settings there.

For more information, see sysctl.conf(5) and sysctl.d(5).

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 65000" >/etc/sysctl.conf
/sbin/sysctl -p &>/dev/null
if [ ? -eq 0 ];then echo "内核调参 完成" else echo "内核调参 失败" fi sleep 1 echo -e "在配置网卡... \n " network_name=`ip a | grep -v "^ " | grep -v "lo"| awk -F":" '{print2}' | tr -d ' '`
network_path="/etc/sysconfig/network-scripts/ifcfg-network_name" echo " TYPE=Ethernet BOOTPROTO=dhcp DEFROUTE=yes PEERDNS=yes PEERROUTES=yes NAME=network_name
DEVICE=$network_name
ONBOOT=yes

GATEWAY=b.num

GATEWAY=gateway NETMASK=255.255.255.0 DNS1=8.8.8.8 DNS2=114.114.114.114SIP
" >network_path echo "网卡配置完成 ^_^" echo -e "\n" yum -y install wget &> /dev/null if [? -eq 0 ];then
echo "wget安装成功 ."
else
echo "安装wget失败"
fi
echo "开始配置yum源环境"
wget http://mirrors.aliyun.com/repo/Centos-7.repo &>/dev/null
mv /etc/yum.repos.d/CentOS-Base.repo{,.bak}
mv ./Centos-7.repo /etc/yum.repos.d/CentOS-Base.repo
yum -y install epel-release &>/dev/null
sed -ri '/^[ \t]*#/d' /etc/yum.repos.d/epel.repo
echo "光速配完!"
echo "开始建立yum缓存...这需要很长时间耐心等待"
yum makecache &>/dev/null
sleep 3

相关文章

网友评论

      本文标题:linux系统初始化

      本文链接:https://www.haomeiwen.com/subject/guotzctx.html