## 1.更换软件源 在上一篇文章 [01.PVE系统安装](./01.PVE系统安装.md) 中,从刚装好的 PVE 系统中获取了系统的一些参数。 ![PVE系统信息](img/p01/pve_sys_info.jpg) 此处显示出 PVE 底层使用的是 Debian 的系统,代号为 `trixie` 。 为了后续能对 PVE 系统进行升级,需要更换其镜像仓库,也就是大家熟知的软件源。 当前处于 “离线” 安装状态,更换软件源后,因无网络连接,无法执行系统更新操作。 ### 1.1.系统软件源 使用终端工具登录到 PVE 服务器,查看现有软件源配置文件。 ```bash ## 查看系统默认软件源 $ cat /etc/apt/sources.list.d/debian.sources #### 系统默认软件源示例输出 Types: deb URIs: http://deb.debian.org/debian/ Suites: trixie trixie-updates Components: main contrib non-free-firmware Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg Types: deb URIs: http://security.debian.org/debian-security/ Suites: trixie-security Components: main contrib non-free-firmware Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg ``` 这里将使用 [中国科技大(USTC)](http://mirrors.ustc.edu.cn/help/proxmox.html) 的镜像仓库进行替换,执行以下命令。 ```bash ## 配置 PVE 系统默认软件源脚本 $ tee /etc/apt/sources.list.d/debian.sources >/dev/null <<'EOF' Types: deb URIs: https://mirrors.ustc.edu.cn/debian Suites: trixie trixie-updates Components: main contrib non-free non-free-firmware Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg Types: deb URIs: https://mirrors.ustc.edu.cn/debian-security Suites: trixie-security Components: main contrib non-free non-free-firmware Signed-By: /usr/share/keyrings/debian-archive-keyring.gpg EOF ``` ### 1.2. PVE 软件源 默认情况下,PVE 额外启用了 2 个官方源,且为订阅收费制,因此需要替换为免订阅源。 首先创建 PVE 免订阅软件源,执行以下命令。 ```bash ## 配置 PVE 系统免订阅软件源脚本 $ tee /etc/apt/sources.list.d/pve-no-subscription.sources >/dev/null <<'EOF' Types: deb URIs: https://mirrors.ustc.edu.cn/proxmox/debian/pve Suites: trixie Components: pve-no-subscription Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg EOF ``` 对于 Proxmox Backup Server 和 Proxmox Mail Gateway,请将以上命令路径中的 `pve` 分别替换为 `pbs` 和 `pmg` 。 进一步创建 PVE Ceph 免订阅软件源,Ceph 软件源为 PVE 8 之后默认安装,执行以下命令。 ```bash ## 配置 PVE Ceph 免订阅软件源脚本 $ if [ -f /etc/apt/sources.list.d/ceph.sources ]; then ( . /etc/os-release CEPH_CODENAME=$(ceph -v | awk '/^ceph version / { print $(NF - 1); exit }') if [ -z "$CEPH_CODENAME" ] || [ -z "${VERSION_CODENAME:-}" ]; then echo "Unable to determine Ceph or Debian codename." >&2 exit 1 fi tee /etc/apt/sources.list.d/pve-ceph-no-subscription.sources >/dev/null <