Ref: https://blog.laoda.de/archives/useful-script/

测试相关

机器测试

基本测试

请出秋水的 bench.sh 脚本,这个脚本可以查看 Linux 系统信息,还可以测试网络带宽及硬盘读写速率。

1
wget -qO- bench.sh | bash

GeekBench

来源:https://github.com/masonr/yet-another-bench-script

  • GB6 跑分脚本,附带宽测试:

    1
    curl -sL yabs.sh | bash
  • GB6 剔除带宽测试,因为都是国外节点测试,国内跑没多大意义:

    1
    curl -sL yabs.sh | bash -s -- -i
  • GB5 跑分脚本,附带宽测试:

    1
    curl -sL yabs.sh | bash -5
  • GB5 剔除带宽测试:

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

单线程测试

1
bash <(curl -Lso- https://bench.im/hyperspeed)

最全测速脚本

1
curl -fsL https://ilemonra.in/LemonBenchIntl | bash -s fast

superbench

1
wget -qO- git.io/superbench.sh | bash

Bench.sh

1
wget -qO- bench.sh | bash

速度测试

显示延迟、抖动

1
bash <(wget -qO- https://bench.im/hyperspeed)

直接显示回程线路

1
2
3
4
5
6
7
8
9
10
curl https://raw.githubusercontent.com/zhucaidan/mtr_trace/main/mtr_trace.sh|bash
BASH
wget -q route.f2k.pub -O route && bash route
PLAINTEXT
# 第一个
wget https://raw.githubusercontent.com/nanqinlang-script/testrace/master/testrace.sh
bash testrace.sh

# 第二个
wget -qO- git.io/besttrace | bash

四网测速

1
2
3
wget -O jcnf.sh https://raw.githubusercontent.com/Netflixxp/jcnfbesttrace/main/jcnf.sh

bash jcnf.sh

三网测速

1
bash <(curl -Lso- https://git.io/superspeed_uxh)

带快速四网测试版本:

1
bash <(curl -Lso- https://dl.233.mba/d/sh/speedtest.sh)
1
bash <(curl -Lso- https://git.io/J1SEh)

流媒体检测

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

测试 25 端口是否开放

1
telnet smtp.aol.com 25

测试 IPv4 优先还是 IPv6 优先

1
curl ip.p3terx.com

BBR

CentOS 7 BBR

1
wget -N --no-check-certificate "https://raw.githubusercontent.com/chiakge/Linux-NetSpeed/master/tcp.sh" && chmod +x tcp.sh && ./tcp.sh

一键开启 BBR

注意:需要 Linux Kernel 内核升级到 4.9 及以上版本可以实现 BBR 加速

1
uname -srm

输出结果:

1
2
3
4
5
6
PLAINTEXT
Linux 3.10.0-957.12.2.el7.x86_64 x86_64
3 - 内核版本.
10 - 主修订版本.
0-957 - 次要修订版本.
12 - 补丁版本.

一般来说,Ubuntu18.04 以上就可以 (默认的内核 4.15)

1
2
3
4
5
6
7
8
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

升级 packages

CentOS

1
sudo yum update -y

Debian / Ubuntu

1
2
sudo apt update && sudo apt upgrade
sudo apt install wget curl sudo vim git -y

防火墙

CentOS 关闭防火墙

  • 甲骨文

    1
    2
    3
    4
    5
    6
    systemctl stop oracle-cloud-agent
    systemctl disable oracle-cloud-agent
    systemctl stop oracle-cloud-agent-updater
    systemctl disable oracle-cloud-agent-updater
    systemctl stop firewalld.service
    systemctl disable firewalld.service
  • 其他

    1
    2
    3
    systemctl start supervisord
    systemctl disable firewalld
    systemctl stop firewalld

Ubuntu 关闭防火墙

1
2
3
4
5
iptables -P INPUT ACCEPT
iptables -P FORWARD ACCEPT
iptables -P OUTPUT ACCEPT
iptables -F
apt-get purge netfilter-persistent && reboot

甲骨文修改 root 登录

方法 1

1
2
3
4
5
6
7
8
9
10
11
sudo -i # 切换到root

passwd # 设置密码

sudo sed -i ‘s/^#\?PermitRootLogin.*/PermitRootLogin yes/g’ /etc/ssh/sshd_config;

sudo sed -i ‘s/^#\?PasswordAuthentication.*/PasswordAuthentication yes/g’ /etc/ssh/sshd_config;

sudo service sshd restart

reboot # 重启服务器

方法 2

1
2
3
4
5
6
7
8
9
10
11
sudo -i # 用root身份

passwd # 设置root密码

vi /etc/ssh/sshd_config # 修改配置文件

PermitRootLogin yes

PasswordAuthentication yes

reboot # 重启服务器

Docker 相关

安装 Docker

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# 安装 Dokcer
wget -qO- get.docker.com | bash

# 查看 Dokcer 版本
docker -v

# 设置开机自动启动
systemctl enable docker

# 开启容器的 IPv6 功能,以及限制日志文件大小,防止 Docker 日志塞满硬盘
cat > /etc/docker/daemon.json <<EOF
{
"log-driver": "json-file",
"log-opts": {
"max-size": "20m",
"max-file": "3"
},
"ipv6": true,
"fixed-cidr-v6": "fd00:dead:beef:c0::/80",
"experimental":true,
"ip6tables":true
}
EOF

# 重启 Docker 服务
systemctl restart docker

安装 Docker Compose

1
2
3
4
5
6
7
8
# 自行去 compose 的 GitHub 找最新版本号:https://github.com/docker/compose
curl -L "https://github.com/docker/compose/releases/download/v2.24.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

# 给执行权限
chmod +x /usr/local/bin/docker-compose

# 查看 docker-compose 版本
docker-compose -v

呆梨相关

x-ui

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

脚本来源:https://github.com/FranzKafkaYu/x-ui

mack-a

1
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