ubuntu 21.04对source.list.d目录的介绍(软件源、换源)
生活随笔
收集整理的這篇文章主要介紹了
ubuntu 21.04对source.list.d目录的介绍(软件源、换源)
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1. sources.list
- sources.list 位于/etc/apt目錄下
- sources.list是一個普通可編輯的文本文件,保存了ubuntu軟件更新的源服務器的地址.
2. sources.list.d/*.list
- sources.list.d/*.list位于/etc/apt/sources.list.d目錄下
- 為在單獨文件中寫入源的地址提供了一種方式,通常用來安裝第三方的軟件.
3. 換源
- 首先查看自己的Ubuntu系統的codename(這一步很重要),直接導致你更新的源是否對你的系統起效果,查看方法:
lsb_release -a
Q&A
- No LSB modules are available.
解:
apt install lsb-core -y4. 鏡像源獲取
| 阿里云 | ||
| * | xenial | https://mirrors.aliyun.com/ubuntu/dists/xenial |
| * | xenial-backports | https://mirrors.aliyun.com/ubuntu/dists/xenial-backports |
| * | xenial-proposed | https://mirrors.aliyun.com/ubuntu/dists/xenial-proposed |
| * | xenial-security | https://mirrors.aliyun.com/ubuntu/dists/xenial-security |
| * | xenial-updates | https://mirrors.aliyun.com/ubuntu/dists/xenial-updates |
| 清華 | ||
| * | xenial | https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/xenial |
| * | xenial-backports | https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/xenial-backports |
| * | xenial-proposed | https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/xenial-proposed |
| * | xenial-security | https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/xenial-security |
| * | xenial-updates | https://mirrors.tuna.tsinghua.edu.cn/ubuntu/dists/xenial-updates |
| 中科大 | ||
| * | xenial | http://mirrors.ustc.edu.cn/ubuntu/dists/xenial/ |
| * | xenial-backports | http://mirrors.ustc.edu.cn/ubuntu/dists/xenial-backports |
| * | xenial-proposed | http://mirrors.ustc.edu.cn/ubuntu/dists/xenial-proposed |
| * | xenial-security | http://mirrors.ustc.edu.cn/ubuntu/dists/xenial-security |
| * | xenial-updates | http://mirrors.ustc.edu.cn/ubuntu/dists/xenial-updates |
**注意:**根據codename找.
5. 選擇源
ping mirrors.aliyun.com ping mirrors.tuna.tsinghua.edu.cn ping mirrors.ustc.edu.cn總結:aliyun的源在時延上表現最好.
6. 備份并修改sources.list
cp /etc/apt/sources.list /etc/apt/sources_init.list``vim /etc/apt/sources.list``apt update7. 命令或腳本
1. 命令
格式:sudo sed -i ‘s/<原域名/新域名>/g’ /etc/apt/sources.list
- 官方源換阿里云源
sudo sed -i 's/archive.ubuntu.com/mirrors.aliyun.com/g' /etc/apt/sources.list - 官方源換清華源
sudo sed -i 's/archive.ubuntu.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list - 官方源換中科大源
sudo sed -i 's/archive.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list - 阿里云源換清華源
sudo sed -i 's/mirrors.aliyun.com/mirrors.tuna.tsinghua.edu.cn/g' /etc/apt/sources.list
2. 腳本
- 換阿里云源
cd /etc/apt
vim Init_sources.sh
注意:
- 腳本必須位于/etc/apt目錄中.
- MirrorsName值可以更改為其他鏡像的域名.
8. 阿里云Ubuntu16.0.4服務器源
## Note, this file is written by cloud-init on first boot of an instance ## modifications made here will not survive a re-bundle. ## if you wish to make changes you can: ## a.) add 'apt_preserve_sources_list: true' to /etc/cloud/cloud.cfg ## or do the same in user-data ## b.) add sources in /etc/apt/sources.list.d ## c.) make changes to template file /etc/cloud/templates/sources.list.tmpl# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to # newer versions of the distribution. deb http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial main deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial main## Major bug fix updates produced after the final release of the ## distribution. deb http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial-updates main deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial-updates main## 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.cloud.aliyuncs.com/ubuntu/ xenial universe deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial universe deb http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial-updates universe deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial-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.cloud.aliyuncs.com/ubuntu/ xenial multiverse # deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial multiverse # deb http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial-updates multiverse # deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial-updates multiverse## Uncomment the following two lines to add software from the 'backports' ## repository. ## 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.cloud.aliyuncs.com/ubuntu/ xenial-backports main restricted universe multiverse # deb-src http://mirrors.cloud.aliyuncs.com/ubuntu/ xenial-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 xenial partner # deb-src http://archive.canonical.com/ubuntu xenial partnerdeb http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security main deb-src http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security main deb http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security universe deb-src http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security universe # deb http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security multiverse # deb-src http://mirrors.cloud.aliyuncs.com/ubuntu xenial-security multiverse參考鏈接:https://www.jianshu.com/p/5400722c369c
總結
以上是生活随笔為你收集整理的ubuntu 21.04对source.list.d目录的介绍(软件源、换源)的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 阿里云ubuntu软件包镜像源地址
- 下一篇: ubuntu21.04安装微信3.2.1