Ubuntu 22.04,把软件更新源更改为阿里或者清华镜像

avatar
作者
筋斗云
阅读量:0

通常这应该是装上系统后做的第一件事,阿里/清华二选一,本人亲测,可以成功

可以通过修改系统的/etc/apt/sources.list文件来完成。以下是详细步骤:

修改/etc/apt/sources.list

  1. 打开终端。

  2. 备份当前的/etc/apt/sources.list文件:

    sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak 
  3. 编辑/etc/apt/sources.list文件:

    sudo nano /etc/apt/sources.list 
  4. 清空文件内容(或注释掉原有内容),然后添加清华大学的镜像源:

    # 默认注释了源码仓库,如有需要可自行取消注释 deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-updates main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-backports main restricted universe multiverse deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-security main restricted universe multiverse 
  5. 也可以使用阿里巴巴的镜像源,内容如下:

    deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse # deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse # deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse # deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse # deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse 
  6. 保存并关闭文件(在nano中按Ctrl+O保存,然后按Ctrl+X退出编辑)。

更新软件包列表

  1. 运行以下命令更新软件包列表:

    sudo apt update 

这样,你的Ubuntu系统就会使用清华大学或阿里巴巴的镜像源来进行软件包的下载和更新了。

广告一刻

为您即时展示最新活动产品广告消息,让您随时掌握产品活动新动态!