Linux Ubuntu修改镜像源

Ubuntu修改镜像源


前言

   
   最近一直在尝试使用Ubuntu系统,因为刚接触,遇到很多问题,所以就把遇到的问题总结在这里给各位读者大大分享~ 后面还有很多类似的分享,感兴趣的话可以持续关注哦~
   

修改镜像源

   用apt-get安装一些东西的时候,经常就会出现‘Unable to locate package’,或者‘Temporary failure resolving ‘us.archive.ubuntu.com’’的报错,原因很可能是因为自带的镜像源我们访问不了,所以下载不了或者非常慢。解决办法就是:更换镜像源

(1)cd /etc/apt(pwd查看当前路径)
(2)在修改之前对文件进行备份(可以忽略)

   sudo cp sources.list sources.list.bak

(3)对文件进行修改

sudo vi sources.list

(vi/vim的操作对新手不是很友好,第一次用给我搞懵了,可以去查查vim的常用操作)
(4)添加镜像源:
我目前使用的所有镜像源

deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates universe
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-updates multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security main restricted
deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security universe deb http://mirrors.tuna.tsinghua.edu.cn/ubuntu/ xenial-security multiverse
deb http://cn.archive.ubuntu.com/ubuntu bionic main multiverse restricted universe
deb http://cn.archive.ubuntu.com/ubuntu bionic-updates main multiverse restricted universe
deb http://cn.archive.ubuntu.com/ubuntu bionic-security main multiverse restricted universe
deb http://cn.archive.ubuntu.com/ubuntu bionic-proposed main multiverse restricted universe

另外:网上关于的清华、阿里云等等的镜像源有很多,网上寻找即可
然后“:w”保存;
最后“:q”退出。
(5) 非!常!重!要! 改完镜像源一定记得更新下载源

sudo apt-get update

(6)下载你需要的包

apt-get install xxx


创作不易,各位读者大大看完留个赞和评论再走吧!求求了~

温馨提示   关注不容易让文章走丢哦~


其他linux内容整理见:https://blog.csdn.net/weixin_45386875/article/details/116308755

猜你喜欢

转载自blog.csdn.net/weixin_45386875/article/details/116231766