【ubuntu20.04】配置apt国内源

1. 各大源官网

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

http://mirrors.163.com/

https://developer.aliyun.com/mirror/

https://mirrors.ustc.edu.cn/

https://mirrors.huaweicloud.com/home

 

2. 配置

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo vim /etc/apt/sources.list

清华源

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

deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-updates main restricted universe multiverse

deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-updates main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-backports main restricted universe multiverse

deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-backports main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-security main restricted universe multiverse

deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-security main restricted universe multiverse

deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-proposed main restricted universe multiverse

deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ eoan-proposed main restricted universe multiverse

阿里源

deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse

deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse

 

网易163源

deb http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse

deb http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ focal main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ focal-security main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ focal-updates main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ focal-proposed main restricted universe multiverse

deb-src http://mirrors.163.com/ubuntu/ focal-backports main restricted universe multiverse

华为源

1、备份配置文件:
sudo cp -a /etc/apt/sources.list /etc/apt/sources.list.bak
2、修改sources.list文件,将http://archive.ubuntu.com和http://security.ubuntu.com替换成http://repo.huaweicloud.com,可以参考如下命令:
sudo sed -i "s@http://.*archive.ubuntu.com@http://repo.huaweicloud.com@g" /etc/apt/sources.list
sudo sed -i "s@http://.*security.ubuntu.com@http://repo.huaweicloud.com@g" /etc/apt/sources.list
3、执行apt-get update更新索引

官方源

自带/etc/apt/sources.list 文件中内容

选择任意一个替换文件中的内容

 

3、执行更新

sudo apt-get update
sudo apt-get upgrade

 

posted @ 2022-03-25 11:34  代码诠释的世界  阅读(1859)  评论(0编辑  收藏  举报