Ubuntu26.04換阿里云鏡像源過程
更新時間:2026年05月11日 10:14:22 作者:小小的木頭人
本文介紹了將Ubuntu 26.04鏡像源從原始源替換為阿里云源的方法,首先備份原始的源文件,然后編輯并替換為阿里云源的內容,接著更新緩存并驗證更新是否生效,文章還提供了一鍵腳本,直接執(zhí)行即可
先備份原始源,再替換為阿里云源即可。
Ubuntu 26.04(Resolute Raccoon)默認已經使用 .sources 格式,而不是老的 sources.list。
1. 備份原配置
sudo cp /etc/apt/sources.list.d/ubuntu.sources /etc/apt/sources.list.d/ubuntu.sources.bak
2. 編輯鏡像源
sudo vim /etc/apt/sources.list.d/ubuntu.sources
將內容替換為:
Types: deb URIs: https://mirrors.aliyun.com/ubuntu/ Suites: resolute resolute-updates resolute-backports Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg Types: deb URIs: https://mirrors.aliyun.com/ubuntu/ Suites: resolute-security Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg
3. 更新緩存
sudo apt update
4. 驗證是否生效
apt policy
或者:
grep -E "mirrors.aliyun.com" /etc/apt/sources.list.d/ubuntu.sources
一鍵腳本(推薦)
直接執(zhí)行:
sudo bash -c 'cat > /etc/apt/sources.list.d/ubuntu.sources <<EOF Types: deb URIs: https://mirrors.aliyun.com/ubuntu/ Suites: resolute resolute-updates resolute-backports Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg Types: deb URIs: https://mirrors.aliyun.com/ubuntu/ Suites: resolute-security Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg EOF' sudo apt update
總結
以上為個人經驗,希望能給大家一個參考,也希望大家多多支持腳本之家。
相關文章
Linux使用其他用戶(非root用戶)設置root權限及免密(Centos7為例)
這篇文章主要介紹了Linux使用其他用戶(非root用戶)設置root權限及免密(Centos7為例),具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2024-05-05

