Ubuntu18.04中如何更换为清华的镜像源

版权声明:转载请注明来源! https://blog.csdn.net/CAU_Ayao/article/details/83507338

Ubuntu 的软件源配置文件是 /etc/apt/sources.list。在修改之前,先将系统自带的该文件做个备份,将该文件替换为清华源官网提供的内容,即可使用 TUNA 的软件源镜像。最重要的是使用清华源可以走ipv6~
清华源官网:https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/


  1. 首先需要使用root用户
sudo -s
  1. 进行源码备份.
cp /etc/apt/sources.list /etc/apt/sources.list.bak
  1. 进行源列表的修改
vi /etc/apt/sources.list

将sources.list中的内容提换如下

# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse

# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse

如图所示:
在这里插入图片描述
4. 查看是否已经修改

cat /etc/apt/sources.list

在这里插入图片描述
可以看到已经修改成功~
5. 执行更新列表

sudo apt-get update 

如图所示:
在这里插入图片描述
至此,已经将源更换为清华源~~

猜你喜欢

转载自blog.csdn.net/CAU_Ayao/article/details/83507338