⼿摸⼿教程之ubuntu20.04更改国内镜像源(附其他版本ubuntu
换源教程,最新详细教程)
windows10⾃带ubuntu系统更新到ubuntu20.04版本啦!默认的软件更新源是国外的,速度超级慢,⽤"apt install"安装软件时各种⽹络问题也是层出不穷(上次安装ubuntu后忘记修改源结果导致N多次安装半⼩时然后失败.....亲⾝经历了这种苦,回过头发现修改源之后很多⽹络问题迎刃⽽解),因此我们需要更换成国内镜像源,然后正常安装和更新软件。
unbuntu版本名
修改源之前提⽰⼤家先查看版本名,ubuntu20.04对应的是“focal”,也就是我下⾯镜像源中提到的。“eoan”代表ubuntu19.10,“xenial”代表ubuntu16.04,“bionic”代表ubuntu18.04,“disco”代表ubuntu19.04,但是最好还是查看⾃⼰的版本名,并更改相应位置的ubuntu版本名。⽤以下命令查看版本名:
lsb_release -c
得到的就是你的版本名啦!⽐如我的就是:
⾸先备份原来的软件源并另存:
sudo cp -v /etc/apt/sources.list /etc/apt/sources.list.backup
执⾏chmod命令更改⽂件权限使软件源⽂件可编辑:
sudo chmod777 /etc/apt/sources.list
之后通过gedit命令编辑软件源:
ubuntu vim命令sudo gedit /etc/apt/sources.list
如果报错提⽰:
sudo: gedit: command not found
那么直接使⽤vim修改:
vim /etc/apt/sources.list
顺便提⼀下vim的使⽤:进⼊后按i进⼊编辑模式(即INSERT插⼊),编辑完后先按Esc退出编辑模式,然后输⼊ :wq 退出即可。
打开源⽂件后,进⼊编辑模式将所有的代码删⼲净,然后复制粘贴你需要的镜像源(下⾯的镜像源任选⼀个就可以,我⽤的是阿⾥云的镜像源,这⾥记得把ubuntu版本名替换为你在⾃⼰系统上查看到的版本名):
编辑完后先按Esc退出编辑模式,输⼊ :wq 退出。
**阿⾥云源:**
deb mirrors.aliyun/ubuntu/ focal main restricted universe multiverse
deb mirrors.aliyun/ubuntu/ focal-security main restricted universe multiverse
deb mirrors.aliyun/ubuntu/ focal-updates main restricted universe multiverse
deb mirrors.aliyun/ubuntu/ focal-proposed main restricted universe multiverse
deb mirrors.aliyun/ubuntu/ focal-backports main restricted universe multiverse
deb-src mirrors.aliyun/ubuntu/ focal main restricted universe multiverse
deb-src mirrors.aliyun/ubuntu/ focal-security main restricted universe multiverse
deb-src mirrors.aliyun/ubuntu/ focal-updates main restricted universe multiverse
deb-src mirrors.aliyun/ubuntu/ focal-proposed main restricted universe multiverse
deb-src mirrors.aliyun/ubuntu/ focal-backports main restricted universe multiverse
**清华源**
deb mirrors.tuna.tsinghua.edu/ubuntu/ eoan main restricted universe multiverse
deb-src mirrors.tuna.tsinghua.edu/ubuntu/ eoan main restricted universe multiverse
deb mirrors.tuna.tsinghua.edu/ubuntu/ eoan-updates main restricted universe multiverse
deb-src mirrors.tuna.tsinghua.edu/ubuntu/ eoan-updates main restricted universe multiverse deb mirrors.tuna.tsinghua.edu/ubuntu/ eoan-backports main restricted universe multiverse deb-src mirrors.tuna.tsinghua.edu/ubuntu/ eoan-backports main restricted universe multiverse deb mirrors.tuna.tsinghua.edu/ubuntu/ eoan-security main restricted universe multiverse
deb-src mirrors.tuna.tsinghua.edu/ubuntu/ eoan-security main restricted universe multiverse deb mirrors.tuna.tsinghua.edu/ubuntu/ eoan-proposed main restricted universe multiverse deb-src mirrors.tuna.tsinghua.edu/ubuntu/ eoan-proposed main restricted universe multiverse 修改完软件源后,更新软件列表和软件:
sudo apt update
sudo apt upgrade
然后⼤功告成!如果还有什么问题,留⾔与我交流!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论