VPS 常用脚本及配置
常用软件包
txt
wget curl nano vim sudo unzip mtr-tiny iputils-ping bind9-host dnsutils net-tools lsb-release ca-certificates bash-completion fail2ban dialog netbase iproute2 whois ssh dbus systemd systemd-sysv ifupdown locales apt-utils gnupg2 apt-transport-https rsyslog logrotate less rsync haveged systemd-timesyncd
美化 SSH
sh
echo "alias ls='ls --color=auto'" >>/root/.bashrc
echo "alias ll='ls --color=auto -lAF'" >>/root/.bashrc
echo "PS1='\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;36m\]\h \[\033[01;33m\]\w \[\033[01;35m\]\$ \[\033[00m\]'" >>/root/.bashrc
source /root/.bashrc
Docker
sh
curl -sSL https://get.docker.com/ | sh
YABS
sh
# 完整测试(系统信息 + 硬盘测试 + iPerf3 + GeekBench5 + GeekBench6)
curl -sL yabs.sh | bash -s -- -r -5 -6
#系统信息
curl -sL yabs.sh | bash -s -- -i -d -g
# GeekBench 5
curl -sL yabs.sh | bash -s -- -i -d -5
# GeekBench 6"
curl -sL yabs.sh | bash -s -- -i -d
路由追踪
NextTrace
安装
sh
# /usr/local/bin/nexttrace
curl nxtrace.org/nt |bash
使用
sh
# 基本使用
nexttrace ip/domain
# 快速测试
nexttrace --fast-trace
# 自定义测试
nexttrace --file /path/to/your/iplist.txt
BackTrace
安装
sh
# 三网回程直接显示
# /usr/bin/backtrace
curl https://raw.githubusercontent.com/zhanghanyun/backtrace/main/install.sh -sSf | sh
使用
sh
backtrace
解锁测试
流媒体解锁
sh
bash <(curl -L -s check.unlock.media)
OpenAI 解锁
sh
bash <(curl -Ls https://github.com/ludashi2020/OpenAI-Checker/raw/main/openai.sh)
MTProto
安装
sh
bash <(wget -qO- https://git.io/mtg.sh)
卸载
sh
systemctl disable mtg
systemctl stop mtg
rm -f /usr/local/bin/mtg /etc/systemd/system/mtg.service /etc/mtg.toml
Chrony 时间同步
安装
sh
apt-get install chrony
使用
ini
# /etc/chrony/chrony.conf
# 添加 NTP 服务器
server ntp.aliyun.com minpoll 4 maxpoll 10 iburst
server us.pool.ntp.org minpoll 4 maxpoll 10 iburst
启动
sh
systemctl start chronyd
systemctl enable chronyd
验证
sh
chronyc tracking
chronyc -n sources -v
参考资料
BBR
sh
# Linux 内核版本大于 4.9
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
更新内核
sh
bash <(curl -Lso- https://git.io/kernel.sh)
预览: