debian 安装完毕添加sudo及更换更新源
Debian安装完毕,未安装sudo,切换到root用户
su
输入密码,切换为root用户
Debian12默认的更新源为光盘源或国外源,速度保障都差强人意。所以安装完系统的第一步就是把源更换为国内源。
备份/etc/apt/sources.list
cp /etc/apt/sources.list /etc/apt/sources.list.bak
编辑/etc/apt/sources.list
nano /etc/apt/sources.list
更换为阿里云镜像源:
deb https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib deb-src https://mirrors.aliyun.com/debian/ bookworm main non-free non-free-firmware contrib deb https://mirrors.aliyun.com/debian-security/ bookworm-security main deb-src https://mirrors.aliyun.com/debian-security/ bookworm-security main deb https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib deb-src https://mirrors.aliyun.com/debian/ bookworm-updates main non-free non-free-firmware contrib deb https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib deb-src https://mirrors.aliyun.com/debian/ bookworm-backports main non-free non-free-firmware contrib
更换为腾讯云镜像源:
deb https://mirrors.tencent.com/debian/ bookworm main non-free non-free-firmware contrib deb-src https://mirrors.tencent.com/debian/ bookworm main non-free non-free-firmware contrib deb https://mirrors.tencent.com/debian-security/ bookworm-security main deb-src https://mirrors.tencent.com/debian-security/ bookworm-security main deb https://mirrors.tencent.com/debian/ bookworm-updates main non-free non-free-firmware contrib deb-src https://mirrors.tencent.com/debian/ bookworm-updates main non-free non-free-firmware contrib deb https://mirrors.tencent.com/debian/ bookworm-backports main non-free non-free-firmware contrib deb-src https://mirrors.tencent.com/debian/ bookworm-backports main non-free non-free-firmware contrib
更换为清华镜像源:
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
更换为中科大镜像源:
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
退出保存后执行:
apt-get update apt-get upgrade
安装sudo
apt-get install sudo
安装完成后,退出root用户
exit
编辑sudoers文件
nano /etc/sudoers
在root ALL=(ALL:ALL) ALL后添加
username ALL=(ALL:ALL) ALL
username替换为你的用户名,保存退出