國內小眾云主機Debian系統更換軟件源鏡像以優化下載速度

國內如騰訊云、阿里云、華為云這些大型的云主機商家一般不存在此問題,但是一些比較小眾的國內云主機經常會遇到的問題,如下載更新軟件速度慢。如果預裝系統沒有根據位置選擇合適軟件源鏡像,建議手動修改 Debian 軟件源鏡像以加快速度。本文將指導新手用戶更換軟件源,希望對用戶有所幫助。

國內 Debian 軟件源鏡像

列出幾個常用國內 Debian 軟件源鏡像。點此可查看完整鏡像節點。

鏡像節點 鏡像地址
Debian http://ftp.cn.debian.org/debian/
阿里云 http://mirrors.aliyun.com/debian/
華為云 http://mirrors.aliyun.com/debian/
網易 http://mirrors.163.com/debian/
清華大學 http://mirrors.tuna.tsinghua.edu.cn/debian/
中國科大 http://mirrors.ustc.edu.cn/debian/
蘭州大學 http://mirror.lzu.edu.cn/debian/

更換 Debian 軟件源鏡像

在操作前,先重命名備份軟件源配置文件,以便在需要時可以還原。

mv /etc/apt/sources.list /etc/apt/sources.list.bak

創建新的配置文件。

vi /etc/apt/sources.list

內容如下(通常只需按需修改其中發行版代號和鏡像地址,詳細查看后面備注介紹)。

deb http://ftp.cn.debian.org/debian/ buster main contrib non-free
deb-src http://ftp.cn.debian.org/debian/ buster main contrib non-free

deb http://ftp.cn.debian.org/debian-security/ buster/updates main contrib non-free
deb-src http://ftp.cn.debian.org/debian-security/ buster/updates main contrib non-free

deb http://ftp.cn.debian.org/debian/ buster-updates main contrib non-free
deb-src http://ftp.cn.debian.org/debian/ buster-updates main contrib non-free

deb http://ftp.cn.debian.org/debian/ buster-backports main contrib non-free
deb-src http://ftp.cn.debian.org/debian/ buster-backports main contrib non-free

逐個介紹配置內容里的參數含義:

  • deb:二進制軟件包;
  • deb-src:源代碼軟件包;
  • 網址:軟件包鏡像地址;
  • 發行版代號:適用對應發行版的軟件包,可用 lsb_release -c 命令查詢代號名稱;
  • 發行版代號跟隨參數:軟件包類型(xxxxx/updates 安全錯誤更新,xxxxx-updates?普通維護更新,xxxxx-backports 向后移植軟件包,將較新軟件補丁移植到舊版軟件上);
  • main:遵循 DFSG 標準的自由軟件;
  • contrib:遵循 DFSG 標準的自由軟件,但存在?non-free 依賴;
  • non-free:不符合 DFSG 標準的軟件;

更新配置文件后重建軟件包索引生效。

apt-get update

如果你用的是 https 軟件源鏡像地址,那么需要確保已安裝下面兩個軟件。

apt-get install apt-transport-https ca-certificates
贊(0)
版權聲明:本文采用知識共享 署名4.0國際許可協議 [BY-NC-SA] 進行授權, 轉載請注明出處。
文章名稱:《國內小眾云主機Debian系統更換軟件源鏡像以優化下載速度》
文章鏈接:http://www.lrracing.com/19450.html
【聲明】:國外主機測評僅分享信息,不參與任何交易,也非中介,所有內容僅代表個人觀點,均不作直接、間接、法定、約定的保證,讀者購買風險自擔。一旦您訪問國外主機測評,即表示您已經知曉并接受了此聲明通告。
【關于安全】:任何 IDC商家都有倒閉和跑路的可能,備份永遠是最佳選擇,服務器也是機器,不勤備份是對自己極不負責的表現,請保持良好的備份習慣。