1. 程式人生 > 其它 >【ubuntu20.04】配置apt國內源

【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