更换APT源Debian 12.0

所有命令复制粘贴一起执行

替换官方源

cat > /etc/apt/sources.list << EOF
deb https://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://deb.debian.org/debian/ bookworm main contrib non-free non-free-firmware

deb https://deb.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src https://deb.debian.org/debian/ bookworm-updates main contrib non-free non-free-firmware

deb https://deb.debian.org/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://deb.debian.org/debian/ bookworm-backports main contrib non-free non-free-firmware

deb https://deb.debian.org/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb-src https://deb.debian.org/debian-security/ bookworm-security main contrib non-free non-free-firmware
EOF

替换清华源

cat > /etc/apt/sources.list << EOF
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free non-free-firmware

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware

deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware

deb https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware
EOF

替换中科大源

cat > /etc/apt/sources.list << EOF
deb https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware

deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware

deb https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian/ bookworm-backports main contrib non-free non-free-firmware

deb https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb-src https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware
EOF

替换腾讯云源

cat > /etc/apt/sources.list << EOF
deb https://mirrors.cloud.tencent.com/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.cloud.tencent.com/debian/ bookworm main contrib non-free non-free-firmware

deb https://mirrors.cloud.tencent.com/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src https://mirrors.cloud.tencent.com/debian/ bookworm-updates main contrib non-free non-free-firmware

deb https://mirrors.cloud.tencent.com/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://mirrors.cloud.tencent.com/debian/ bookworm-backports main contrib non-free non-free-firmware

deb https://mirrors.cloud.tencent.com/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb-src https://mirrors.cloud.tencent.com/debian-security/ bookworm-security main contrib non-free non-free-firmware
EOF

使用腾讯云服务器时,可以选择腾讯云内网源,走内网不消耗公网流量。

替换阿里云源

cat > /etc/apt/sources.list << EOF
deb https://mirrors.aliyun.com/debian/ bookworm main contrib non-free non-free-firmware
deb-src https://mirrors.aliyun.com/debian/ bookworm main contrib non-free non-free-firmware

deb https://mirrors.aliyun.com/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main contrib non-free non-free-firmware

deb https://mirrors.aliyun.com/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main contrib non-free non-free-firmware

deb https://mirrors.aliyun.com/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main contrib non-free non-free-firmware
EOF

使用阿里云服务器时,可以选择腾讯云内网源,走内网不消耗公网流量。

替换为Linode源

Linode 不支持HTTPS
cat > /etc/apt/sources.list << EOF
deb http://mirrors.linode.com/debian/ bookworm main contrib non-free non-free-firmware
deb-src http://mirrors.linode.com/debian/ bookworm main contrib non-free non-free-firmware

deb http://mirrors.linode.com/debian/ bookworm-updates main contrib non-free non-free-firmware
deb-src http://mirrors.linode.com/debian/ bookworm-updates main contrib non-free non-free-firmware

deb http://mirrors.linode.com/debian/ bookworm-backports main contrib non-free non-free-firmware
deb-src http://mirrors.linode.com/debian/ bookworm-backports main contrib non-free non-free-firmware

deb http://mirrors.linode.com/debian-security/ bookworm-security main contrib non-free non-free-firmware
deb-src http://mirrors.linode.com/debian-security/ bookworm-security main contrib non-free non-free-firmware
EOF

更换完成源以后,执行命令更新apt索引

apt update
更新、安装必备软件
apt-get update && apt-get install -y wget vim
综合工具箱
wget -O box.sh https://raw.githubusercontent.com/BlueSkyXN/SKY-BOX/main/box.sh && chmod +x box.sh && clear && ./box.sh

该工具箱集合非常多的脚本。

测试相关机器测试

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

wget -qO- bench.sh | bash
单线程测试
bash <(curl -Lso- https://bench.im/hyperspeed)
最全测试脚本国内测试
bash <(curl -sL res.yserver.ink/taier.sh)
curl -fsL https://ilemonra.in/LemonBenchIntl | bash -s fast
显示抖动、延迟
bash <(wget -qO- https://bench.im/hyperspeed)
直接显示回程线路
wget -q route.f2k.pub -O route && bash route
开启BBRDebian 12开启BBR

BBR 主要是针对 TCP 流量进行优化,设计目的是提升整体网络性能,包括延迟和带宽质量。

  1. 首先把系统更新到最新版本

sudo apt update
sudo apt upgrade -y
  1. 安装Vim

sudo apt install vim -y
  1. 打开sysctl配置文件

sudo vim /etc/sysctl.conf
  1. 编辑内容添加两行内容

net.core.default_qdisc = fq 
net.ipv4.tcp_congestion_control = bbr
  1. 保存好文件以后,使配置生效

sudo sysctl -p
  1. 最后查询是否配置成功(返回包含BBR即可)

sysctl net.ipv4.tcp_congestion_control
1Pnel 面板安装
bash -c "$(curl -sSL https://resource.fit2cloud.com/1panel/package/v2/quick_start.sh)"
Docker安装海外非大陆服务器

Docker安装

wget -qO- get.docker.com | bash

卸载 Docker

sudo apt-get purge docker-ce docker-ce-cli containerd.io
sudo rm -rf /var/lib/docker
sudo rm -rf /var/lib/containerd

Docker-compose安装

sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose

授权 Docker-compose

sudo chmod +x /usr/local/bin/docker-compose

查看 Docker-Compose 版本

docker-compose --version
大陆服务器

安装 Docker

curl -fsSL https://bash.foreverlink.love/dockerinstall.sh | bash -s docker  --mirror Aliyun

卸载 Docker

sudo apt-get remove docker docker-engine
rm -fr /var/lib/docker/