Ubuntu 更换清华大学镜像源

Ubuntu 更换镜像源

通常我们使用ubunntu的时候总是出现网络过慢导致的更新下载失败等问题。

Ubuntu默认的服务器是在国外,自然连接就很慢。

这里我们更换成国内的镜像源,这里使用清华镜像源。

操作步骤如下:https://blog.csdn.net/qq_57171795/article/details/123109463

下面介绍更换清华镜像源的方法

1.打开Ubuntu的控制台(快捷键ctrl+Alt T)

在这里插入图片描述

2.进入 /etc/apt/路径

cd /etc/apt/

3.将sources.list备份保存为sources.backup.list,以防止有需要的时候更换回来

cp -a sources.list sources.backup.list

4.打开清华镜像官方,在搜索框输入ubuntu ,点击ubuntu旁边的小问号

https://mirrors.tuna.tsinghua.edu.cn/

https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/

5.根据相应的版本复制镜像源码,查看ubuntu版本。
在这里插入图片描述

查看ubuntu对应的版本方法:

cat /etc/issue

这里我的版本号是:21.10,需要在清华网站上选择相应的版本后再复制镜像源码
在这里插入图片描述

6.打开sources.list

sudo gedit sources.list

7.将sources.list内的内容清空,粘贴刚刚复制的镜像源,并保存(save)

下面的是ubuntu20.04

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

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

下图是21.10:
在这里插入图片描述
8.更新镜像源

 sudo apt-get update

在这里插入图片描述
到这里就完成了。

猜你喜欢

转载自blog.csdn.net/m0_37755995/article/details/128906054
今日推荐