debian旧版本系统apt-get update的方式
apt-get update时候一般会出现这样的错误:
changed its ‘Suite’ value from ‘stable-updates’ to ‘oldstable-updates’
解决步骤:
apt-get –allow-releaseinfo-change update
apt-get dist-upgrade
apt-get updatedebian上安装add-apt-repository的方法
apt -y install software-properties-common dirmngr apt-transport-https lsb-release ca-certificates
Debian大版本升级的方式
升级前需要事先安装好aptitude
apt-get install aptitude
比如代号为bullseye的11,升级到代号为bookworm的12
/etc/apt/sources.list的内容:
deb http://mirrors.nju.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
deb http://mirrors.nju.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
deb http://mirrors.nju.edu.cn/debian-security bookworm-security/updates main contrib non-free non-free-firmware
比如代号为bookworm的12,升级到代号为trixie的13
/etc/apt/sources.list的内容:
deb http://mirrors.nju.edu.cn/debian/ trixie main contrib non-free non-free-firmware
deb http://mirrors.nju.edu.cn/debian/ trixie-updates main contrib non-free non-free-firmware
deb http://mirrors.nju.edu.cn/debian-security trixie-security/updates main contrib non-free non-free-firmware
一键升级脚本(12升级到13)
#!/bin/bash
set -e
echo "=== Debian 12 (Bookworm) -> Debian 13 (Trixie) 升级脚本 ==="
# 检查是否 root
if [ "$(id -u)" -ne 0 ]; then
echo "请用 root 权限运行此脚本"
exit 1
fi
# 检查当前版本
CURRENT_CODENAME=$(lsb_release -sc 2>/dev/null || grep -oP 'VERSION_CODENAME=\K\w+' /etc/os-release)
if [ "$CURRENT_CODENAME" != "bookworm" ]; then
echo "检测到当前系统不是 Debian 12 (bookworm),而是: $CURRENT_CODENAME"
echo "本脚本仅支持从 Debian 12 升级到 13,请手动确认后再操作。"
exit 1
fi
echo "确认: 当前系统为 Debian 12 (Bookworm),开始升级..."
echo "[1/6] 更新并清理当前系统..."
apt update
apt -y upgrade
apt -y full-upgrade
apt -y --purge autoremove
echo "[2/6] 备份 sources.list 到 /etc/apt/sources.list.bak"
cp /etc/apt/sources.list /etc/apt/sources.list.bak.$(date +%F-%H%M)
echo "[3/6] 修改 sources.list 为 Debian 13 (trixie)"
cat >/etc/apt/sources.list <<EOF
deb http://deb.debian.org/debian trixie main contrib non-free-firmware
deb http://security.debian.org/debian-security trixie-security main contrib non-free-firmware
deb http://deb.debian.org/debian trixie-updates main contrib non-free-firmware
EOF
echo "[4/6] 更新软件包索引..."
apt update
echo "[5/6] 执行最小升级..."
apt -y upgrade --without-new-pkgs
echo "[6/6] 执行完整升级..."
apt -y full-upgrade
echo "=== 升级完成,建议重启系统 ==="
echo "使用命令: reboot"
中国大陆镜像:
http://ftp.cn.debian.org/debian/ (中国科技大)
http://mirrors.nju.edu.cn/debian/ (南京大学)
aptitude update && aptitude dist-upgrade
reboot 重启系统
apt-get update && apt-get full-upgrade
apt-get --purge autoremove
执行 apt-get update && apt-get upgrade 来下载与启用安全更新
Debian禁用ipv6
在/etc/default/grub的GRUB_CMDLINE_LINUX=地方加上ipv6.disable=1,执行命令update-grub,然后重启
Debian下vi的问题
安装了Debian,却发现其自带的vi存在问题:
1)不支持语法高亮提示
2)不支持Backspace键的删除功能
原来Debian中自带的vi是vim-tiny,程序本身就是不支持语法高亮和Backspace删除功能。
可以使用以下办法解决:
1)重新安装其它版本的vi
apt-get install vim vim-runtime exuberant-ctags
2)配置~/.vimrc
添加syntax on
关闭vi的自动缩进
echo “:set nocindent” >>~/.vimrc
g++: fatal error: Killed signal terminated program cc1plus
虚拟内存不足导致
dd if=/dev/zero of=/swap_add1 bs=4k count=128000
mkswap /swap_add1;swapon /swap_add1
然后重新make即可。