PVE 默认的软件源是用的国外服务器,所以我们的环境下进行软件更新、安装的时候都会比较慢。现在国内已经有许多的镜像仓库供我们使用。
PVE 本身也有自己的软件软,但是都是收费的。我们需要将其删除,不然在软件安装时会提示一些 401 的认证错误
rm -rf /etc/apt/sources.list.d/pve-enterprise.list
以防错误操作,我们先将文件进行备份
cp /etc/apt/sources.list /etc/apt/sources.list.bak
编辑默认软件源文件
nano /etc/apt/sources.list
我们将默认的连接前面加上 # 号进行注释,或者删除这些链接
deb 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 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 https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian bullseye pve-no-subscription
deb https://mirrors.ustc.edu.cn/debian/ bullseye main contrib non-free deb https://mirrors.ustc.edu.cn/debian/ bullseye-updates main contrib non-free deb https://mirrors.ustc.edu.cn/debian/ bullseye-backports main contrib non-free deb https://mirrors.ustc.edu.cn/debian-security bullseye-security main contrib deb https://mirrors.ustc.edu.cn/proxmox/debian bullseye pve-no-subscription
选择以上其中一个粘贴到 /etc/apt/sources.list 文件中
粘贴完成后按 ctrl + x,会提示是否保存,我们输入(不区分大小写) y 进行保存
rm /etc/apt/sources.list rm /etc/apt/sources.list.d/* echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye main contrib non-free">>/etc/apt/sources.list echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-updates main contrib non-free">>/etc/apt/sources.list echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian/ bullseye-backports main contrib non-free">>/etc/apt/sources.list echo "deb https://mirrors.tuna.tsinghua.edu.cn/debian-security bullseye-security main contrib non-free">>/etc/apt/sources.list echo "deb https://mirrors.tuna.tsinghua.edu.cn/proxmox/debian bullseye pve-no-subscription">>/etc/apt/sources.list
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 速度就很快了。