实用 Linux 服务器脚本合集

56次阅读
没有评论

本合集整理了一些常用的 Linux 服务器脚本,涵盖了系统重装、性能测试、网络诊断、功能增强以及常用软件的快速安装等方面,希望能帮助您更便捷地管理和优化您的服务器。

一、服务器重装 (DD)

在需要更换操作系统或进行彻底清理时,可以使用以下 DD 脚本:

  • Leitbogioro 的“最强”脚本:
    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 'password'
    
  • 萌咖大佬的脚本:
    bash <(wget --no-check-certificate -qO- 'https://raw.githubusercontent.com/MoeClub/Note/master/InstallNET.sh') -d 11 -v 64 -p 密码 -port 端口 -a -firmware
    
  • beta.gs 大佬的脚本:

     

    wget --no-check-certificate -O NewReinstall.sh https://raw.githubusercontent.com/fcurrk/reinstall/master/NewReinstall.sh && chmod a+x NewReinstall.sh && bash NewReinstall.sh
    
  • DD 到 Windows (使用 Leitbogioro 的脚本):
    bash <(curl -sSL https://raw.githubusercontent.com/leitbogioro/Tools/master/Linux_reinstall/InstallNET.sh) -windows 10  -lang "cn"
    
    • 默认 Windows 凭据:
      • 用户名: Administrator
      • 密码: Teddysun.com
    • Windows 激活: 在 PowerShell 中运行以下命令 (使用 Windows 键 + R 打开运行框,然后输入 powershell):

      PowerShell

      irm https://get.activated.win | iex
      

二、系统性能与压力测试

了解服务器的性能瓶颈是优化和选择合适配置的关键。以下脚本可以帮助您进行全面的性能测试:

  • 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)
    
  • yabs:

     

    curl -sL yabs.sh | bash
    
  • yabs (跳过网络,测试 GB5):

     

    curl -sL yabs.sh | bash -s -- -i5
    
  • yabs (跳过网络和磁盘,测试 GB5):

     

    curl -sL yabs.sh | bash -s -- -if5
    
  • yabs (只测试 GB5):

     

    curl -sL yabs.sh | bash -s -- -5
    

三、网络诊断与测速

评估服务器的网络连接质量和速度对于保障服务稳定至关重要:

  • Speedtest CLI:

     

    bash <(curl -sL bash.icu/speedtest)
    
  • Taier 测速:

     

    bash <(curl -sL res.yserver.ink/taier.sh)
    
  • hyperspeed:
    bash <(curl -Lso- https://bench.im/hyperspeed)
    
  • 全球测速:

     

    curl -sL network-speed.xyz | bash
    
  • 直接显示回程 (小白用这个):

     

    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
    

    Bash

    wget https://ghproxy.com/https://raw.githubusercontent.com/vpsxb/testrace/main/testrace.sh -O testrace.sh && bash testrace.sh
    
  • 测试 25 端口 (SMTP):

     

    telnet smtp.aol.com 25
    

四、流媒体解锁与 IP 质量检测

对于需要访问特定地区流媒体或关注 IP 质量的用户,以下脚本可以提供帮助:

  • 最常用的解锁测试:

     

    bash <(curl -L -s check.unlock.media)
    
  • 原生区域检测:

     

    bash <(curl -sL Media.Check.Place)
    
  • 准确度最高的解锁测试:

     

    bash <(curl -L -s https://github.com/1-stream/RegionRestrictionCheck/raw/main/check.sh)
    
  • 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
    

五、系统功能增强与优化

这些脚本可以帮助您扩展服务器的功能或进行一些优化设置:

  • 添加 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
    
  • 一键开启 BBR (适用于较新的 Debian、Ubuntu):

     

    echo "net.core.default_qdisc=fq" >> /etc/sysctl.confecho "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
    sysctl -p
    sysctl net.ipv4.tcp_available_congestion_controllsmod | grep bbr
    
  • 多功能 BBR 安装脚本:

     

    wget -N --no-check-certificate "https://gist.githubusercontent.com/zeruns/a0ec603f20d1b86de6a774a8ba27588f/raw/4f9957ae23f5efb2bb7c57a198ae2cffebfb1c56/tcp.sh" && chmod +x tcp.sh && ./tcp.sh
    
  • 锐速 /BBRPLUS/BBR2/BBR3 安装:

     

    wget -O tcpx.sh "https://github.com/ylx2016/Linux-NetSpeed/raw/master/tcpx.sh" && chmod +x tcpx.sh && ./tcpx.sh
    
  • TCP 窗口调优:

     

    wget http://sh.nekoneko.cloud/tools.sh -O tools.sh && bash tools.sh
    
  • 添加 WARP:

     

    wget -N https://gitlab.com/fscarmen/warp/-/raw/main/menu.sh && bash menu.sh [option] [lisence/url/token]
    

六、常用软件一键安装

快速部署常用软件可以提高服务器的利用效率:

  • Docker:

     

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

     

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

     

    apt install iperf3
    
  • realm:

     

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

     

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

     

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

     

    curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh  -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh
    
  • WARP (重新列出):

     

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

     

    wget -N git.io/aria2.sh && chmod +x aria2.sh && ./aria2.sh
    
  • 宝塔面板:

     

    wget -O install.sh http://v7.hostcli.com/install/install-ubuntu_6.0.sh && sudo bash install.sh
    
  • PVE 虚拟化:

     

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

     

    bash <(wget -qO- https://raw.githubusercontent.com/fscarmen/argox/main/argox.sh)
    

七、综合功能脚本

一些脚本集成了多种实用功能,可以一键执行多种任务:

  • 科技 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
    

八、其他实用工具

请注意: 在执行任何来自未知或不受信任来源的脚本之前,请务必仔细检查其内容,了解脚本的功能和潜在风险。建议在测试环境或充分了解脚本作用的情况下运行。

正文完
 0
评论(没有评论)
验证码