Ubuntu 20.04 是 Ubuntu 的第 8 個 LTS 版本,其重大更新和改進將在 2030 年前終止,計划於2020年 4 月 23 日發布。
國內有很多Ubuntu的鏡像源,包括阿里的、網易的,還有很多教育網的源,比如:清華源、中科大源。
我們這里以清華源為例講解如何修改Ubuntu 20.04
里面默認的源。
編輯/etc/apt/sources.list
文件, 在文件最前面添加以下條目(操作前請做好相應備份):
清華源
# 默認注釋了源碼鏡像以提高 apt update 速度,如有需要可自行取消注釋
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
# 預發布軟件源,不建議啟用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
然后執行命令:
sudo apt-get update
sudo apt-get upgrade
- 1
- 2
其他幾份國內源如下:
阿里源
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
如果20focal 的源
更新軟件有問題可以使用18
bionic
的源:
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe
方案三:
## 1. set to update /etc/apt/sources.list echo $(date '+%Y-%m-%d %H:%M:%S') '>> 1.0.0.0 . set to update /etc/apt/sources.list' # 1.1 backup sources.list echo $(date '+%Y-%m-%d %H:%M:%S') '>> 1.1.0.0 . backup /etc/apt/sources.list' sudo mv /etc/apt/sources.list /etc/apt/sources.list.old.$(date '+%Y%m%d%H%M%S') # 1.2 create new sources.list , with 777 privileges echo $(date '+%Y-%m-%d %H:%M:%S') '>> 1.2.0.0 . create new sources.list , with 777 privileges' sudo touch /etc/apt/sources.list sudo chmod 777 /etc/apt/sources.list # 1.3 set the aliyun sources echo $(date '+%Y-%m-%d %H:%M:%S') '>> 1.3.0.0 . set the aliyun sources ' sudo cat > /etc/apt/sources.list <<EOF # See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://mirrors.aliyun.com/ubuntu/ focal main restricted # deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted ## Major bug fix updates produced after the final release of the ## distribution. deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted # deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team. Also, please note that software in universe WILL NOT receive any ## review or updates from the Ubuntu security team. deb http://mirrors.aliyun.com/ubuntu/ focal universe # deb-src http://mirrors.aliyun.com/ubuntu/ focal universe deb http://mirrors.aliyun.com/ubuntu/ focal-updates universe # deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates universe ## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu ## team, and may not be under a free licence. Please satisfy yourself as to ## your rights to use the software. Also, please note that software in ## multiverse WILL NOT receive any review or updates from the Ubuntu ## security team. deb http://mirrors.aliyun.com/ubuntu/ focal multiverse # deb-src http://mirrors.aliyun.com/ubuntu/ focal multiverse deb http://mirrors.aliyun.com/ubuntu/ focal-updates multiverse # deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates multiverse ## N.B. software from this repository may not have been tested as ## extensively as that contained in the main release, although it includes ## newer versions of some applications which may provide useful features. ## Also, please note that software in backports WILL NOT receive any review ## or updates from the Ubuntu security team. 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 ## Uncomment the following two lines to add software from Canonical's ## 'partner' repository. ## This software is not part of Ubuntu, but is offered by Canonical and the ## respective vendors as a service to Ubuntu users. # deb http://archive.canonical.com/ubuntu focal partner # deb-src http://archive.canonical.com/ubuntu focal partner deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted # deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted deb http://mirrors.aliyun.com/ubuntu/ focal-security universe # deb-src http://mirrors.aliyun.com/ubuntu/ focal-security universe deb http://mirrors.aliyun.com/ubuntu/ focal-security multiverse # deb-src http://mirrors.aliyun.com/ubuntu/ focal-security multiverse EOF