Ubuntu如何换源?

1、进入root权限用户

1| su

root前

image

root后

image

2、备份源文件

1| sudo cp -v /etc/apt/sources.list /etc/apt/sources.list.backup

3、修改源文件

1| vim /etc/apt/sources.list

tips:如果出现Command 'vim' not found,but can be install with:
可以安装一下vim

1| apt install vim

image

进入大概是这样的界面

然后一直按 d 直到界面是空为止
然后按 i 进入编辑模式
复制文章下面的源,然后鼠标右键粘贴
然后按Esc退出编辑
输入 :wq* 退出
image

4、更新源

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse

点击查看代码
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
posted @ 2022-03-06 03:21  小码同学kki  阅读(483)  评论(0编辑  收藏  举报