通常这应该是装上系统后做的第一件事,阿里/清华二选一,本人亲测,可以成功
可以通过修改系统的/etc/apt/sources.list
文件来完成。以下是详细步骤:
修改/etc/apt/sources.list
打开终端。
备份当前的/etc/apt/sources.list
文件:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
编辑/etc/apt/sources.list
文件:
sudo nano /etc/apt/sources.list
清空文件内容(或注释掉原有内容),然后添加清华大学的镜像源:
# 默认注释了源码仓库,如有需要可自行取消注释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 multiversedeb 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 multiversedeb 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 multiversedeb 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
也可以使用阿里巴巴的镜像源,内容如下:
deb http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiverse# deb-src http://mirrors.aliyun.com/ubuntu/ jammy main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiverse# deb-src http://mirrors.aliyun.com/ubuntu/ jammy-updates main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiverse# deb-src http://mirrors.aliyun.com/ubuntu/ jammy-backports main restricted universe multiversedeb http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse# deb-src http://mirrors.aliyun.com/ubuntu/ jammy-security main restricted universe multiverse
保存并关闭文件(在nano中按Ctrl+O
保存,然后按Ctrl+X
退出编辑)。
更新软件包列表
运行以下命令更新软件包列表:
sudo apt update
这样,你的Ubuntu系统就会使用清华大学或阿里巴巴的镜像源来进行软件包的下载和更新了。