[长期更新]VPS脚本收集和分享

:memo: 到手测试

测试脚本
# 融合怪
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

# 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

# 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解锁
bash <(curl -Ls IP.Check.Place)
# 路由追踪
curl nxtrace.org/nt |bash
# 查看vps回程路由
nexttrace 你的宽带ip
# iperf测速,测试单线程,如果重传严重需调整tcp缓冲区
apt update
apt install iperf3

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

:scroll: VPS服务

脚本合集
# 大杂烩,好用推荐
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
# 科技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系统
# 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
# 煎饼佬的,密码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
第三方
https://minlearn.org/inst
https://github.com/bohanyang/debi
https://github.com/LloydAsp/OsMutation
系统优化
# 增加虚拟内存为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端口,建议不要关闭ssh窗口防止连不上
sudo nano /etc/ssh/sshd_config
修改取消注释,把22改成你想要的端口
Port <你想要的端口>
sudo systemctl restart sshd
# 修改为仅允许密钥登录,建议不要关闭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防火墙
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
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

# 修改主机名解决无法解析主机名的问题,修改127.0.1.1后面的为正确主机名
nano /etc/hosts
# 增加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调优,通常对优化线路有用,降低重传增加稳定性
# 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
# https://233boy.com/sing-box/sing-box-script/
bash <(wget -qO- -o- https://github.com/233boy/sing-box/raw/main/install.sh)
# 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
# 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
# https://github.com/yonggekkk/sing-box-yg
bash <(curl -Ls https://raw.githubusercontent.com/yonggekkk/sing-box-yg/main/sb.sh)
# 安装3x-ui
# https://github.com/MHSanaei/3x-ui
bash <(curl -Ls https://raw.githubusercontent.com/mhsanaei/3x-ui/master/install.sh)
# 安装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]
# 端口转发,也可以自行根据官方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
探针
# 安装哪吒探针
# v1,查看[官方文档](https://nezha.wiki)
curl -L https://raw.githubusercontent.com/nezhahq/scripts/refs/heads/main/install.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh
# v1的Cf tunnel版本,开箱即用,更推荐这个
https://github.com/yumusb/nezha-new

# 哪吒agent的容器版本,降权
https://github.com/yosebyte/cgent

# v0养老,详见
https://www.nodeseek.com/post-211942-1
https://www.nodeseek.com/post-208624-1
# 安装beszel探针
curl -sL "https://github.com/henrygd/beszel/releases/latest/download/beszel_$(uname -s)_$(uname -m | sed 's/x86_64/amd64/' | sed 's/armv7l/arm/' | sed 's/aarch64/arm64/').tar.gz" | tar -xz -O beszel | tee ./beszel >/dev/null && chmod +x beszel && ls beszel
./beszel serve
# 安装beszel探针Docker版
wget https://github.com/henrygd/beszel/raw/refs/heads/main/supplemental/docker/hub/docker-compose.yml
docker-compose up -d
Webssh
# Next terminal
https://docs.next-terminal.typesafe.cn/install/pro-install.html
# Easynode
https://github.com/chaos-zhu/easynode
PT相关
# 盒子刷流
bash <(wget -qO- https://raw.githubusercontent.com/jerry048/Dedicated-Seedbox/main/Install.sh) -u <帐号> -p <密码> -c 3072 -q 4.3.9 -l v1.2.19 -b -v

:globe_with_meridians: 建站

1Panel
curl -sSL https://resource.fit2cloud.com/1panel/package/quick_start.sh -o quick_start.sh && sudo bash quick_start.sh
aapanel
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
宝塔
wget -O install.sh https://download.bt.cn/install/install_lts.sh && bash install.sh ed8484bec

:whale: Docker

安装
# 安装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

# 手动更新全部容器,并删除旧镜像
docker run --rm \
    -v /var/run/docker.sock:/var/run/docker.sock \
    containrrr/watchtower \
    --cleanup \
    --run-once
Docker Cli
# lucky 反代+自动申请证书,非常好用适合小白
docker run -d --name lucky --restart=always --net=host gdy666/lucky
# Filebrowsr文件浏览器
docker run \
    -v /path/to/root:/srv \
    -v /path/to/filebrowser.db:/database/filebrowser.db \
    -v /path/to/settings.json:/config/settings.json \
    -e PUID=$(id -u) \
    -e PGID=$(id -g) \
    -p 8080:80 \
    filebrowser/filebrowser:s6
# 微信消息转发,用于moviepilot和nastool,教程如下
# https://invites.fun/d/14844
# https://github.com/DDS-Derek/wxchat-Docker
docker run -d \
    --name wxchat \
    --restart=always \
    -p 80:80 \
    ddsderek/wxchat:latest
Docker Compose
# chatgpt-next-web佬友修改版
services:
  chatgpt-next-web:
    container_name: chatgpt-next-web
    image: tianzhentech/chatgpt-next-web
    ports:
      - 127.0.0.1:23002:3000
    environment:
      - OPENAI_API_KEY=
      - GOOGLE_API_KEY=
      - CODE=linux.do
      - BASE_URL=
      - AZURE_API_KEY=
      - AZURE_URL=

# new-api和openwebui
version: "3.3"
services:
  open-webui:
    ports:
      - 127.0.0.1:23000:8080
    volumes:
      - /root/data/open-webui:/app/backend/data
    container_name: open-webui
    image: ghcr.io/open-webui/open-webui:main
    restart: always
  new-api:
    container_name: new-api
    restart: always
    ports:
      - 127.0.0.1:23001:3000
    environment:
      - TZ=Asia/Shanghai
      - GENERATE_DEFAULT_TOKEN=true
      - MEMORY_CACHE_ENABLED=true
    volumes:
      - /root/data/new-api:/data
    image: calciumion/new-api:latest
networks:
  ai: {}

# Dockge
mkdir -p /opt/stacks /opt/dockge
cd /opt/dockge
curl https://raw.githubusercontent.com/louislam/dockge/master/compose.yaml --output compose.yaml
docker compose up -d

573 个赞

感谢大佬分享

7 个赞

多谢佬友分享,mark

4 个赞

感谢你的分享

9 个赞

VPS脚本眼

4 个赞

谢谢,已收藏

21 个赞

感谢佬友分享,mark

11 个赞

又可以躺收藏夹了 :joy:

4 个赞

好多啊,感谢大佬分享 :grinning:

13 个赞

感谢整理 :face_with_monocle:

3 个赞

感谢大佬整理 :tieba_028:

14 个赞

不错不错 感谢分享

5 个赞

good job,要持续更新哦
建议长的脚本先折叠起来,在上面说明脚本的作用就行,需要的人自己会点开

12 个赞

感谢建议,已经修改。我自己有好的帖子看到会更新到这来的

4 个赞

mark一下

6 个赞

感谢分享!!!!

16 个赞

请问这个是干啥的

1 个赞

非常不错,还有一个大佬也做个这个项目你也可以参考他的 lion 做的也不错

7 个赞

这值得插入一个书签呀

4 个赞

大佬好厉害,mark一下

4 个赞