换源
# 方式一:执行在线脚本
$ bash <(curl -sSL https://linuxmirrors.cn/main.sh)
# 方式二:保存脚本后执行
$ curl -sSL https://linuxmirrors.cn/main.sh -o linuxmirrors.sh && chmod +x ./linuxmirrors.sh && bash ./linuxmirrors.sh
+-----------------------------------+
| ⡇ ⠄ ⣀⡀ ⡀⢀ ⡀⢀ ⡷⢾ ⠄ ⡀⣀ ⡀⣀ ⢀⡀ ⡀⣀ ⢀⣀ |
| ⠧⠤ ⠇ ⠇⠸ ⠣⠼ ⠜⠣ ⠇⠸ ⠇ ⠏ ⠏ ⠣⠜ ⠏ ⠭⠕ |
+-----------------------------------+
欢迎使用 GNU/Linux 更换系统软件源脚本
运行环境 Debian GNU/Linux 12 (bookworm) x86_64
系统时间 2025-09-26 00:54 Asia/Shanghai
➜ 清华大学
╭─ 软件源是否使用 HTTP 协议?
│
╰─ ● 是 / ○ 否
'/etc/apt/sources.list' -> '/etc/apt/sources.list.bak'
✔ 已备份原有 sources.list 源文件
◉ 更新软件源...
……
Fetched 16.6 MB in 10s (1,725 kB/s)
Reading package lists... Done
✔ 软件源更换完毕
╭─ 是否跳过更新软件包?
│
╰─ ● 是 / ○ 否
✨ 脚本运行完毕,更多使用教程详见官网 👉 https://linuxmirrors.cn
Powered by LinuxMirrors
BBR 加速
询问 AI 后,优先选择BBR Plus
+FQ
/FQ-Codel
,如果需要多人公平分配带宽,可以选择BBR Plus
+CAKE
,但 CAKE 的 CPU 资源消耗更多。
一键脚本:
- one_click_script/KERNEL_CN.md at master · jinwyp/one_click_script
- ylx2016/Linux-NetSpeed: 将 Linux 现常用的网络加速集成在一起
- byJoey/Actions-bbr-v3: 同步官方内核更新
创建交换分区
使用free -h
命令如果Swap
那一行的total
是0B
或0
,就是没有交换分区。
# 创建一个 1GB 大小的文件名为 swapfile
sudo fallocate -l 1G /swapfile
# 设置正确的文件权限,确保只有 root 用户能读写
sudo chmod 600 /swapfile
# 将这个文件设置为 Linux 的 swap 文件
sudo mkswap /swapfile
# 激活 swap 文件
sudo swapon /swapfile
# 设置为开机自动挂载:将 swapfile 的信息追加到 /etc/fstab 文件末尾
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
# 查看验证
free -h
评论区