更新Ubuntu为国内源

  1. 查看源文件
    cat /etc/apt/sources.list.d/ubuntu.sources
  2. 备份源文件
    cp /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sourcesbak
  3. 打开清华源镜像站
    https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
  4. 找到ubuntu软件仓库
    找到对应版本的源,这里以 Ubuntu 24.04 为例
    DEB822 格式 Ubuntu 版本选择Ubuntu 24.04 TLS(noble)
    复制下面源内容到以下文件中
    /etc/apt/sources.list.d/ubuntu.sources
    image
  1. 更新ubuntu系统
    sudo apt update && sudo apt upgrade -y

  2. 移除无用软件
    sudo apt autoremove

  3. 安装软件
    apt install -y tree