VPS 常用脚本集合

适用于Debian、Ubuntu系统的一键脚本,包含系统优化、性能测试、安全配置等

基础工具安装

安装 curl

安装curl工具,用于下载网络资源:

apt update && apt install curl -y

安装 curl 和 wget

同时安装curl和wget下载工具:

apt update -y && apt install curl wget -y

安装 unzip 和 zip

安装压缩和解压缩工具:

apt update && apt install unzip

X-UI 面板安装

一键安装 X-UI

安装功能强大的X-UI面板,用于管理代理服务:

bash <(curl -Ls https://raw.githubusercontent.com/FranzKafkaYu/x-ui/master/install.sh)

网络优化

开启 BBR 加速

启用BBR TCP拥塞控制算法,提升网络性能:

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

网络检测

IP质量体检

检测IP地址的质量和信誉:

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

流媒体解锁检测

检测VPS是否支持流媒体服务解锁:

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

或使用备用脚本:

bash <(curl -L -s media.ispvps.com)

线路测试

线路回程测试

测试VPS到各个地区的网络路由:

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

备用回程测试脚本:

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

性能测试

融合怪测试脚本

综合性测试脚本,包含多种检测项目:

bash <(wget -qO- --no-check-certificate https://gitlab.com/spiritysdx/za/-/raw/main/ecs.sh)

YABS 性能测试

Yet Another Benchmark Script - 全面的性能测试:

wget -qO- yabs.sh | bash

不测网络的YABS(仅CPU和磁盘测试):

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

Bench 测试

简单的性能基准测试:

wget -qO- bench.sh | bash

系统优化

添加 SWAP 交换空间

为系统添加SWAP交换文件,提升内存不足时的性能:

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

硬件信息

独服详细查询

查询独立服务器的详细硬件信息:

curl -sL https://raw.githubusercontent.com/Yuri-NagaSaki/SICK/refs/heads/main/hardware_info.sh | bash -s -- -cn

通电时间查询

查询硬盘通电时间等硬件信息:

wget https://github.com/Aniverse/A/raw/i/a && bash a

安全配置

修改 SSH 端口

修改默认SSH端口,提升安全性(请将2222替换为您想要的端口):

sed -i 's/#Port\ 22/Port\ 2222/' /etc/ssh/sshd_config && systemctl reload ssh

禁止 PING

通过防火墙设置禁止PING响应:

iptables -A INPUT -p icmp --icmp-type 8 -s 0/0 -j DROP

MySQL 优化

MySQL 5.7 内存优化配置

适用于低内存VPS的MySQL优化配置:

performance_schema_max_table_instances=400  
table_definition_cache=400    
performance_schema=off  
innodb_buffer_pool_chunk_size=64M    
innodb_buffer_pool_size=64M

多功能脚本

科技 Lion 脚本

功能丰富的多功能管理脚本:

curl -sS -O https://raw.githubusercontent.com/kejilion/sh/main/kejilion.sh && chmod +x kejilion.sh && ./kejilion.sh