VPS脚本收集和分享

到手测试

融合怪

1
2

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

NodeLoc聚合测评脚本

https://github.com/everett7623/nodeloc_vps_test

1
2
# CentOS
yum install wget&&wget -O Nlbench.sh https://raw.githubusercontent.com/everett7623/nodeloc_vps_test/main/Nlbench.sh && chmod +x Nlbench.sh && ./Nlbench.sh
1
2
# Debian/Ubuntu/Deepin
wget -O Nlbench.sh https://raw.githubusercontent.com/everett7623/nodeloc_vps_test/main/Nlbench.sh && chmod +x Nlbench.sh && ./Nlbench.sh

ip解锁

1
bash <(curl -Ls IP.Check.Place)

路由追踪

1
curl nxtrace.org/nt |bash

查看vps回程路由

1
nexttrace 你的宽带ip

iperf测速,测试单线程,如果重传严重需调整tcp缓冲区

1
2
3
4
5
apt update
apt install iperf3

# 电脑下载iperf3,命名iperf3.exe,打开文件夹,在地址栏输入cmd。-P是线程数,-R是测试小鸡到自己的速度,去掉则反之,-t是时间
iperf3.exe -c 小鸡的ip -P 1 -t 60 -R

检查是否超售

1
lsmod | grep virtio_balloon

VPS服务

脚本合集

1
2
# 大杂烩,好用推荐
curl -fsSL https://raw.githubusercontent.com/eooce/ssh_tool/main/ssh_tool.sh -o ssh_tool.sh && chmod +x ssh_tool.sh && ./ssh_tool.sh
1
2
3
4
# 科技lion脚本,据说收集信息,介意可以用下面的
bash <(curl -sL kejilion.sh)
# 修改版(未知出处,欢迎指出)
bash <(curl -sS https://raw.githubusercontent.com/kejilion/sh/main/kejilion.sh | sed ‘/UserLicenseAgreement()\s*{/a return’ | sed ‘/send_stats()\s*{/a return’)

dd系统

1
2
3
4
5
6
# dd系统为debian,ssh端口不变,密码为LeitboGi0ro
# https://github.com/leitbogioro/Tools
apt update -y
apt install wget -y
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
1
2
3
4
# 煎饼佬的,密码123@@@
# https://github.com/bin456789/reinstall
curl -O https://raw.githubusercontent.com/bin456789/reinstall/main/reinstall.sh || wget -O reinstall.sh $_
bash reinstall.sh dd --img https://example.com/xxx.xz
1
2
3
4
第三方
https://minlearn.org/inst
https://github.com/bohanyang/debi
https://github.com/LloydAsp/OsMutation

系统优化

虚拟内存

1
2
3
4
5
6
7
8
# 增加虚拟内存为2G,适合小内存vps,教程https://blog.laoda.de/archives/vps-swap与下面命令同理
# 根据自己vps内存修改,2G以下建议实际内存2倍,2-4G建议1.5倍
sudo swapon --show # 查看当前系统的交换空间配置,可以重启再运行这个命令看是否生效
sudo fallocate -l 2G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab # 固化

修改ssh端口

1
2
3
4
5
# 修改ssh端口,建议不要关闭ssh窗口防止连不上
sudo nano /etc/ssh/sshd_config
修改取消注释,把22改成你想要的端口
Port <你想要的端口>
sudo systemctl restart sshd

允许密钥登录

1
2
3
4
5
6
7
8
9
10
11
12
# 修改为仅允许密钥登录,建议不要关闭ssh窗口防止连不上
nano ~/.ssh/authorized_keys #加入xshell等工具生成的公钥
chmod 600 ~/.ssh/authorized_keys
chmod 700 ~/.ssh
sudo nano /etc/ssh/sshd_config

修改
PasswordAuthentication no # 不允许密码登录
PubkeyAuthentication yes# 允许密钥登录

最后执行
sudo systemctl restart sshd

ufw防火墙

1
2
3
4
5
6
7
8
9
#安装ufw防火墙
sudo apt install ufw -y
sudo ufw default allow outgoing # 默认允许所有数据出站
sudo ufw default deny incoming # 默认禁止所有数据入站
sudo ufw allow 22 # 修改成你ssh的端口
sudo ufw enable # 启动ufw
sudo ufw stauts # 查看ufw的规则
具体建议查看佬友的帖子
https://linux.do/t/topic/267502?u=ggsmida

Fail2ban

1
2
3
4
5
6
7
8
9
10
11
12
# 手动安装 Fail2ban
sudo apt install fail2ban

# 一键安装部署 Fail2ban,自动配置防 SSH 爆破。可自定义 ip 封禁时间,最高重试次数,ssh端口。

# 安装
wget https://raw.githubusercontent.com/FunctionClub/Fail2ban/master/fail2ban.sh
bash fail2ban.sh

# 卸载
wget https://raw.githubusercontent.com/FunctionClub/Fail2ban/master/uninstall.sh
bash uninstall.sh

修改主机名

1
2
# 修改主机名解决无法解析主机名的问题,修改127.0.1.1后面的为正确主机名
nano /etc/hosts

增加dns

1
2
3
4
5
6
7
# 增加dns
chattr -i /etc/resolv.conf && wget -N --no-check-certificate https://raw.githubusercontent.com/chengziqaq/dnsunblocknetflix/master/dns-change.sh && chmod +x dns-change.sh && ./dns-change.sh 要增加的dns

# 或者动修改nameserver
chattr -i /etc/resolv.conf# 解锁
sudo nano /etc/resolv.conf
chattr +i /etc/resolv.conf# 上锁

tcp调优

1
2
3
4
5
6
# tcp调优,通常对优化线路有用,降低重传增加稳定性
# BlackSheep佬的脚本
# 详细情况请看ns的BlackSheep大佬的帖子
# https://www.nodeseek.com/post-197087-1
apt install iperf3
wget -q https://raw.githubusercontent.com/BlackSheep-cry/TCP-Optimization-Tool/main/tool.sh -O tool.sh && chmod +x tool.sh && ./tool.sh

科学上网

223boy sing-box

1
2
3
# 223boy sing-box
# https://233boy.com/sing-box/sing-box-script/
bash <(wget -qO- -o- https://github.com/233boy/sing-box/raw/main/install.sh)

sing-box+订阅

1
2
3
# sing-box+订阅
# https://github.com/fscarmen/sing-box
bash <(wget -qO- https://raw.githubusercontent.com/fscarmen/sing-box/main/sing-box.sh)

mack-a 8合1 sing-box

1
2
3
# mack-a 8合1 sing-box
# https://github.com/mack-a/v2ray-agent
wget -P /root -N --no-check-certificate "https://raw.githubusercontent.com/mack-a/v2ray-agent/master/install.sh" && chmod 700 /root/install.sh && /root/install.sh

ygkkk sing-box

1
2
3
# ygkkk sing-box
# https://github.com/yonggekkk/sing-box-yg
bash <(curl -Ls https://raw.githubusercontent.com/yonggekkk/sing-box-yg/main/sb.sh)

3x-ui

1
2
3
# 安装3x-ui
# https://github.com/MHSanaei/3x-ui
bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh)

warp解锁

1
2
3
4
5
6
# 安装warp解锁
# https://github.com/fscarmen/warp-sh
# 首次运行
wget -N https://gitlab.com/fscarmen/warp/-/raw/main/menu.sh && bash menu.sh [option] [lisence/url/token]
# 再次运行
warp [option] [lisence]

端口转发

1
2
3
4
5
# 端口转发,也可以自行根据官方wiki手搓
# realm一键脚本
wget -N https://raw.githubusercontent.com/qqrrooty/EZrealm/main/realm.sh && chmod +x realm.sh && ./realm.sh
# gost一键脚本
wget --no-check-certificate -O gost.sh https://raw.githubusercontent.com/qqrrooty/EZgost/main/gost.sh && chmod +x gost.sh && ./gost.sh

CFWarp

1
2
# https://gitlab.com/rwkgyg/CFwarp
bash <(wget -qO- https://gitlab.com/rwkgyg/CFwarp/raw/main/CFwarp.sh 2> /dev/null)

或者

1
bash <(curl -Ls https://gitlab.com/rwkgyg/CFwarp/raw/main/CFwarp.sh)

多平台优选WARP对端IP + 无限生成WARP-Wireguard配置 脚本

1
curl -sSL https://gitlab.com/rwkgyg/CFwarp/raw/main/point/endip.sh -o endip.sh && chmod +x endip.sh && ./endip.sh

建站

1panel

1
curl -sSL https://resource.fit2cloud.com/1panel/package/quick_start.sh -o quick_start.sh && sudo bash quick_start.sh

aapanel

1
URL=https://www.aapanel.com/script/install_7.0_en.sh && if [ -f /usr/bin/curl ];then curl -ksSO "$URL" ;else wget --no-check-certificate -O install_7.0_en.sh "$URL";fi;bash install_7.0_en.sh aapanel

宝塔

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

Docker

安装

1
2
3
# 安装Docker
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh

更新

详情见
https://www.ioiox.com/archives/84.html
Arguments - Watchtower

1
2
3
4
5
6
# 手动更新全部容器,并删除旧镜像
docker run --rm \
-v /var/run/docker.sock:/var/run/docker.sock \
containrrr/watchtower \
--cleanup \
--run-once

感谢

内容采集自[email protected]


VPS脚本收集和分享
http://example.com/2025/01/19/VPS脚本收集和分享/
作者
Justin
发布于
2025年1月19日
许可协议