更換 PVE7 軟件倉庫源和 CT 模板(LXC)源為國內源


PVE7 安裝后默認配置的 apt 軟件源和 CT (LXC) 容器模板源均是官方默認的,國內使用性能不佳,建議替換為 清華 Tuna 提供的國內鏡像源,速度將有一個較大的提升。

如果 pve 官網 iso 鏡像下載較慢,也可在 tuna 提供的鏡像站下載:https://mirrors.tuna.tsinghua.edu.cn/proxmox/iso/

注:本文以 pve 7.0.2 (debian 11 bulleye) 為例,其他版本請自行在鏡像網站尋找對應地址。

替換 apt 軟件源

替換前建議先更新下證書,否則可能由於證書不可用導致 https 無法使用,進而無法下載所有軟件。

sudo apt install apt-transport-https ca-certificates

首先替換通用軟件源, Debian 的軟件源配置文件是 /etc/apt/sources.list,備份后將其中內容修改為以下即可。

# 默認注釋了源碼鏡像以提高 apt update 速度,如有需要可自行取消注釋
deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free


# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free


deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free


# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free


deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free

# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free


deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free


# deb-src https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free

 

之后替換 pve 軟件源,pve 鏡像默認的 pve 軟件源配置文件是 /etc/apt/sources.list.d/pve-enterprise.list ,備份后將其中內容替換為以下即可:

deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian bullseye pve-no-subscription

最后更新下,速度很快:

sudo apt-get update

修改 CT Templates (LXC 容器) 源

將 /usr/share/perl5/PVE/APLInfo.pm 文件中默認的源地址 http://download.proxmox.com 替換為 https://mirrors.tuna.tsinghua.edu.cn/proxmox 即可。

可以使用如下命令修改:

cp /usr/share/perl5/PVE/APLInfo.pm /usr/share/perl5/PVE/APLInfo.pm_back

sed -i 's|http://download.proxmox.com|https://mirrors.tuna.tsinghua.edu.cn/proxmox|g' /usr/share/perl5/PVE/APLInfo.pm

 

針對 /usr/share/perl5/PVE/APLInfo.pm 文件的修改,重啟后生效。

systemctl restart pvedaemon.service

之后在 pve 網頁端下載 CT Templates 速度就很快了。

參考文獻


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM