大量更新
This commit is contained in:
35
51-202501-江苏南通/服务器系统初始化 copy.sh
Normal file
35
51-202501-江苏南通/服务器系统初始化 copy.sh
Normal file
@@ -0,0 +1,35 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 更新软件包列表
|
||||
sudo apt update
|
||||
|
||||
# 安装 sysctl 工具(如果未安装)
|
||||
sudo apt install -y procps
|
||||
|
||||
# 调整系统参数
|
||||
cat <<EOF | sudo tee -a /etc/sysctl.d/wdd-kernel.conf
|
||||
# 增加最大文件描述符数
|
||||
fs.file-max = 100000
|
||||
|
||||
# 调整网络参数
|
||||
net.core.somaxconn = 1024
|
||||
net.ipv4.tcp_max_syn_backlog = 2048
|
||||
net.ipv4.tcp_fin_timeout = 15
|
||||
net.ipv4.tcp_keepalive_time = 300
|
||||
net.ipv4.tcp_tw_reuse = 1
|
||||
net.ipv4.tcp_max_tw_buckets = 200000
|
||||
EOF
|
||||
|
||||
# 应用 sysctl 配置
|
||||
sudo sysctl -p /etc/sysctl.d/wdd-kernel.conf
|
||||
|
||||
# 调整用户级别的最大打开文件数
|
||||
cat <<EOF | sudo tee -a /etc/security/limits.conf
|
||||
* soft nofile 100000
|
||||
* hard nofile 100000
|
||||
EOF
|
||||
|
||||
# 重新启动服务以应用更改(如有需要)
|
||||
# sudo systemctl restart <your-service>
|
||||
|
||||
echo "系统参数调整完成,请根据需要重启服务器。"
|
||||
Reference in New Issue
Block a user