debian12 笔记

前言


最近在win10通过wsl安装了debian linux子系统(wsl2安装报错了。。所以改成了wsl),没想到安装的还是最新的debian12 (Bookworm)。的确和ubuntu有些不一样,现在把一些使用情况记录下来,以备参考。

正文


1. 更换国内源

# 切换到sudo
sudo su

# 备份原文件
cd /etc/apt
cp sources.list sources.list_bak

使用nano注释掉sources.list中的原来的源,插入国内源

deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free
# deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm main contrib non-free
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free
# deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-updates main contrib non-free
deb http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free
# deb-src http://mirrors.tuna.tsinghua.edu.cn/debian/ bookworm-backports main contrib non-free
deb http://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free
# deb-src http://mirrors.tuna.tsinghua.edu.cn/debian-security bookworm-security main contrib non-free

在这里,一开始找到的源是https开头的,更换完毕后apt update报错:Certificate verification failed: The certificate is NOT trusted.
后来参考:apt命令报证书错误的解决方法------- Certificate verification failed: The certificate is NOT trusted.,把https改为http就可以了

2. 把当前用户设置为sudoer

# 这种可能比较笨重
echo "你的用户名       ALL=(ALL:ALL)   NOPASSWD: ALL" >> /etc/sudoers

3. 命令自动补全

sudo su
apt install bash-completion

修改/etc/bash.bashrc
找到自动补全相关的注释行,去掉注释

# enable bash completion in interactive shells
if ! shopt -oq posix; then
  if [ -f /usr/share/bash-completion/bash_completion ]; then
    . /usr/share/bash-completion/bash_completion
  elif [ -f /etc/bash_completion ]; then
    . /etc/bash_completion
  fi
fi

退出bash或debian,重新进入即可

posted @ 2023-11-21 10:51  BrianSun  阅读(862)  评论(0)    收藏  举报