常用Linux服务器脚本合集

本合集大部分来自网网络,经过整理新增和更新,在此表示感谢。

一、 性能优化

1.1 一键添加SWAP脚本

wget https://www.moerats.com/usr/shell/swap.sh && bash swap.sh

1.2 Fail2banSSH防御脚本

这是一个利用iptables和开源程序fail2ban来进行服务器简单防爆破的脚本。默认自带SSH防御规则。

安装

wget https://raw.githubusercontent.com/FunctionClub/Fail2ban/master/fail2ban.sh && bash fail2ban.sh 2>&1 | tee fail2ban.log
  1. 第一步选择是否修改SSH端口。
  2. 第二步输入最多尝试输入SSH连接密码的次数
  3. 第三步输入每个恶意IP的封禁时间(单位:小时)

卸载

wget https://raw.githubusercontent.com/FunctionClub/Fail2ban/master/uninstall.sh && bash uninstall.sh

注意事项
安装完成后请会重启SSH服务,请重新连接SSH会话 若出现SSH无法连接的情况,请检查是否修改过SSH端口,请填写写改后的正确端口进行连接

1.3 Linux网络优化TCP窗口调优

wget http://sh.nekoneko.cloud/tools.sh -O tools.sh && bash tools.sh

1.4 一键开启BBR

echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
sysctl -p
sysctl net.ipv4.tcp_available_congestion_control
lsmod | grep bbr

1.5 多功能BBR安装脚本

wget -N --no-check-certificate "https://gist.github.com/zeruns/a0ec603f20d1b86de6a774a8ba27588f/raw/4f9957ae23f5efb2bb7c57a198ae2cffebfb1c56/tcp.sh" && chmod +x tcp.sh && ./tcp.sh

1.6 BBRPLUS、锐速脚本

wget -O tcpx.sh "https://github.com/ylx2016/Linux-NetSpeed/raw/master/tcpx.sh" && chmod +x tcpx.sh && ./tcpx.sh

1.7 25端口开放测试

telnet smtp.aol.com 25

二、环境及软件安装

2.1 docker

curl -sSL https://get.daocloud.io/docker | sh

2.2 Python

curl -O https://raw.githubusercontent.com/lx969788249/lxspacepy/master/pyinstall.sh && chmod +x pyinstall.sh && ./pyinstall.sh

2.3 极光面板

bash <(curl -fsSL https://raw.githubusercontent.com/Aurora-Admin-Panel/deploy/main/install.sh)

2.4 宝塔

wget -O install.sh https://download.bt.cn/install/install_lts.sh && bash install.sh ed8484bec

2.5 哪吒监控

bash
curl -L https://raw.githubusercontent.com/nezhahq/scripts/refs/heads/main/install.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh

如果你的服务器位于中国大陆,可以使用镜像:

bash
curl -L https://gitee.com/naibahq/scripts/raw/main/install.sh -o nezha.sh && chmod +x nezha.sh && sudo CN=true ./nezha.sh

2.6 realm

bash <(curl -L https://raw.githubusercontent.com/zhouh047/realm-oneclick-install/main/realm.sh) -i

2.7 gost

wget --no-check-certificate -O gost.sh https://raw.githubusercontent.com/qqrrooty/EZgost/main/gost.sh && chmod +x gost.sh && ./gost.sh

2.8 WARP

wget -N https://gitlab.com/fscarmen/warp/-/raw/main/menu.sh && bash menu.sh

2.9 Aria2

wget -N git.io/aria2.sh && chmod +x aria2.sh && ./aria2.sh

2.10 PVE虚拟化

bash <(wget -qO- --no-check-certificate https://raw.githubusercontent.com/oneclickvirt/pve/main/scripts/build_backend.sh)

三、综合测试脚本

3.1 融合怪

curl -L https://gitlab.com/spiritysdx/za/-/raw/main/ecs.sh -o ecs.sh && chmod +x ecs.sh && bash ecs.sh

curl -L https://github.com/spiritLHLS/ecs/raw/main/ecs.sh -o ecs.sh && chmod +x ecs.sh && bash ecs.sh

3.2 LemonBench

wget -qO- https://raw.githubusercontent.com/LemonBench/LemonBench/main/LemonBench.sh | bash -s -- --fast

3.3 NodeBench

bash <(curl -sL https://raw.githubusercontent.com/LloydAsp/NodeBench/main/NodeBench.sh

3.4 YABS

curl -sL https://yabs.sh | bash

curl -sL https://yabs.sh | bash

运行 Geekbench 5 测试并禁用 Geekbench 6 测试和iperf (网络性能) 测试

curl -sL https://yabs.sh | bash -s -- -i -5

四、流媒体及IP质量测试

4.1 最常用版本

bash <(curl -L -s check.unlock.media)

4.2 原生检测脚本

bash <(curl -sL Media.Check.Place)

4.3 准确度最高

bash <(curl -L -s https://github.com/1-stream/RegionRestrictionCheck/raw/main/check.sh)

4.4 IP质量体检脚本

bash <(curl -sL IP.Check.Place)

五、 测速脚本

5.1 Speedtest

bash <(curl -sL bash.icu/speedtest)

5.2 Taier

bash <(curl -sL res.yserver.ink/taier.sh)

5.3 hyperspeed

bash <(curl -Lso- https://bench.im/hyperspeed)

5.4 全球测速

curl -sL network-speed.xyz | bash

六、 回程测试

6.1 直接显示回程(小白用这个)

curl https://raw.githubusercontent.com/ludashi2020/backtrace/main/install.sh -sSf | sh

6.2 回程详细测试(推荐)

wget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && bash AutoTrace.sh
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值