ubuntu 更换镜像源
ubuntu 更换镜像源
时间:2023年6月5日
配置:ubuntu 22.04 LTS
为什么要更换源
镜像源网站就像官方源的国内经销商,因为直接访问官方源太慢了,而访问国内的镜像源网站更快一点。也有可能是因为现有的源网站已经失效或者不适合使用,需要更换一个合适的。
更换源的过程
lsb_release -c #查看版本号
sudo vim /etc/apt/sources.list
可以看到里面已经有了官方源,你可以删掉官方源然后添加国内的镜像源网站。
清华源的配置文件如下:
# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
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
deb http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ jammy-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ jammy-proposed main restricted universe multiverse
然后执行以下命令更新软件源
apt-get clean all # 清除之前的源缓存
apt-get update # 更新
可能遇到的问题

遇到该问题是因为虽然添加了该软件源,但是没有授权。
使用以下命令授权
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 40976EAF437D05B5 # 签名序列
# 对所有签名授权后再次更新软件源即可成功
apt-get update
man apt-key # 查看有关apt-key 的详细信息
参考链接
https://www.zhihu.com/question/413453462
https://mirrors.tencent.com/help/ubuntu.html
这篇好文章是转载于:学新通技术网
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 学新通技术网
- 本文地址: /boutique/detail/tanhjgiceb