Linux VPS 高效运维脚本合集


Linux VPS 高效运维脚本合集

本文档旨在整理一系列高效、实用的 Linux VPS 管理和测试脚本,涵盖从系统安装到性能优化、网络检测等各个方面,帮助您轻松管理和维护服务器。

1. :rocket: 系统重装 (DD Install)

当您需要一个纯净的操作系统环境时,以下脚本可以将您的服务器一键重装为指定的 Linux 或 Windows 系统。

全能型重装脚本 (Leitbogioro)

功能强大的重装脚本,支持多种 Linux 发行版及 Windows 系统。

  • 重装为 Debian 12 (示例):

    wget --no-check-certificate -qO InstallNET.sh 'https://raw.githubusercontent.com/leitbogioro/Tools/master/Linux_reinstall/InstallNET.sh' && chmod a+x InstallNET.sh && bash InstallNET.sh -debian 12 -pwd '你的密码'
    
  • 重装为 Windows 10 (示例):

    bash <(curl -sSL https://raw.githubusercontent.com/leitbogioro/Tools/master/Linux_reinstall/InstallNET.sh) -windows 10 -lang "cn"
    

    Windows 系统说明

    • 默认账户: Administrator
    • 默认密码: Teddysun.com
    • 系统激活: 系统安装后,按 Win+R 打开运行框,输入 powershell 并回车,然后在命令行窗口中执行以下命令:
      irm https://get.activated.win | iex
      

经典重装脚本 (MoeClub)

广受好评的经典脚本,以稳定可靠著称。

bash <(wget --no-check-certificate -qO- 'https://raw.githubusercontent.com/MoeClub/Note/master/InstallNET.sh') -d 11 -v 64 -p '你的密码' -port '你的SSH端口'

备用重装脚本 (fcurrk)

一个简洁高效的备用选项,交互式操作。

wget --no-check-certificate -O NewReinstall.sh https://raw.githubusercontent.com/fcurrk/reinstall/master/NewReinstall.sh && chmod a+x NewReinstall.sh && bash NewReinstall.sh

2. :bar_chart: 服务器综合信息测试

使用以下脚本可以一键检测服务器的硬件配置、网络性能和系统信息。

  • Bench.sh:
    wget -qO- bench.sh | bash
    
  • LemonBench (快速模式):
    wget -qO- https://raw.githubusercontent.com/LemonBench/LemonBench/main/LemonBench.sh | bash -s -- --fast
    
  • 融合怪测试脚本:
    bash <(wget -qO- --no-check-certificate https://gitlab.com/spiritysdx/za/-/raw/main/ecs.sh)
    
  • NodeBench:
    bash <(curl -sL https://raw.githubusercontent.com/LloydAsp/NodeBench/main/NodeBench.sh)
    

3. :stopwatch: 专项性能基准测试 (YABS)

YABS (Yet Another Bench Script) 专注于 CPU (Geekbench) 和磁盘 I/O 性能的详细测试。

  • 完整测试 (网络 + 磁盘 + CPU):
    curl -sL yabs.sh | bash
    
  • 测试 Geekbench 5 (跳过网络测试):
    curl -sL yabs.sh | bash -s -- -i5
    
  • 测试 Geekbench 5 (跳过网络和磁盘):
    curl -sL yabs.sh | bash -s -- -if5
    
  • 仅测试 Geekbench 5 (不测试 Geekbench 6):
    curl -sL yabs.sh | bash -s -- -5
    

4. :clapper_board: 流媒体解锁与 IP 质量分析

检测服务器 IP 对主流流媒体服务的解锁情况以及 IP 的原生性与质量。

  • 流媒体解锁测试 (常用版):
    bash <(curl -L -s check.unlock.media)
    
  • 流媒体解锁测试 (高精度版):
    bash <(curl -L -s https://github.com/1-stream/RegionRestrictionCheck/raw/main/check.sh)
    
  • IP 原生性检测:
    bash <(curl -sL Media.Check.Place)
    
  • IP 质量综合分析:
    bash <(curl -sL IP.Check.Place)
    
  • 一键配置 DNS 解锁:
    wget https://raw.githubusercontent.com/Jimmyzxk/DNS-Alice-Unlock/refs/heads/main/dns-unlock.sh && bash dns-unlock.sh
    

5. :globe_with_meridians: 服务器网络测速

测试服务器到全球各地节点的上传和下载速度。

  • Speedtest:
    bash <(curl -sL bash.icu/speedtest)
    
  • Taier:
    bash <(curl -sL res.yserver.ink/taier.sh)
    
  • Hyperspeed:
    bash <(curl -Lso- https://bench.im/hyperspeed)
    
  • 全球多节点测速 (NWS):
    • 默认测速:
      wget -qO- nws.sh | bash
      
    • 指定区域测试 (如: sh 上海):
      wget -qO- nws.sh | bash -s -- -r sh
      
    • Ping 和路由测试 (如: sh 上海):
      wget -qO- nws.sh | bash -s -- -rt sh
      

6. :world_map: 回程路由线路测试

检测服务器到中国大陆方向的出口和入口路由路径,判断网络线路质量。

  • 简易回程路径 (推荐新手):
    curl https://raw.githubusercontent.com/ludashi2020/backtrace/main/install.sh -sSf | sh
    
  • 详细回程路由分析 (推荐):
    wget -N --no-check-certificate https://raw.githubusercontent.com/Chennhaoo/Shell_Bash/master/AutoTrace.sh && chmod +x AutoTrace.sh && bash AutoTrace.sh
    
  • 三网回程测试:
    wget https://ghproxy.com/https://raw.githubusercontent.com/vpsxb/testrace/main/testrace.sh -O testrace.sh && bash testrace.sh
    

7. :hammer_and_wrench: 系统功能与网络优化

安装实用工具并对 TCP 网络进行优化,提升服务器性能和安全性。

网络优化

  • 手动开启 BBR (适用于新内核):

    1. 执行以下命令写入配置:
      echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
      echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
      
    2. 应用配置使其生效:
      sysctl -p
      

    验证 BBR 是否成功:

    • 运行 sysctl net.ipv4.tcp_available_congestion_control,看输出结果是否包含 bbr
    • 或运行 lsmod | grep bbr,看是否有 tcp_bbr 模块。
  • 多合一 BBR/锐速安装脚本 (ylx2016):

    wget -O tcpx.sh "https://github.com/ylx2016/Linux-NetSpeed/raw/master/tcpx.sh" && chmod +x tcpx.sh && ./tcpx.sh
    
  • TCP 调优脚本 (NekoNeko):

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

系统功能

  • 添加 SWAP (虚拟内存):
    wget https://www.moerats.com/usr/shell/swap.sh && bash swap.sh
    
  • 安装 Fail2ban (防止暴力破解):
    wget --no-check-certificate https://raw.githubusercontent.com/FunctionClub/Fail2ban/master/fail2ban.sh && bash fail2ban.sh 2>&1 | tee fail2ban.log
    
  • WARP 管理脚本 (网络解锁):
    wget -N https://gitlab.com/fscarmen/warp/-/raw/main/menu.sh && bash menu.sh
    
  • 25 端口开放性测试:
    telnet smtp.aol.com 25
    

8. :package: 常用软件与环境一键安装

快速部署开发和运维中常用的软件及面板。

  • Docker & Docker-compose:

    bash <(curl -sL 'https://get.docker.com')
    
  • 宝塔面板 (国内版 - 请注意潜在风险):

    wget -O install.sh http://v7.hostcli.com/install/install-ubuntu_6.0.sh && sudo bash install.sh
    
  • 哪吒监控探针:

    curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh
    
  • 极光面板 (Aurora):

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

    访问官方文档进行 快速安装

  • Aria2 一键安装:

    wget -N git.io/aria2.sh && chmod +x aria2.sh && ./aria2.sh
    
  • PVE 虚拟化环境:

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

9. :toolbox: 综合工具箱脚本

集成了多种常用运维和测试功能的菜单式脚本,方便统一管理。

  • 科技 Lion 工具箱:
    apt update -y && apt install -y curl && bash <(curl -sL kejilion.sh)
    
  • SKY-BOX 工具箱:
    wget -O box.sh https://raw.githubusercontent.com/BlueSkyXN/SKY-BOX/main/box.sh && chmod +x box.sh && clear && ./box.sh
    

10. :link: 其他资源


22 个赞

保存了

NS论坛也可以搬么

确实够全,点赞收藏了

这个牛了,收藏备用

收藏一下

可以的,收藏

1 个赞

收藏,好东西

1 个赞

我来了

收藏备用

虽然有了,还是顶下

你是技术跟水两不耽误,哈哈哈

我只想水积分

换坑位吗,哈哈哈

一直都是想水积分 拉人咱干不来这活

1 个赞

过了这段在换,这两天认证的多,灰哥,都忙晕了吧,:grinning_face_with_smiling_eyes:

拉人我也不行

收藏备用

我说这么眼熟,插个眼吧