mirror of
https://gitee.com/callmer/pve_toss_notes.git
synced 2026-08-31 22:12:51 +08:00
更新 PVE 软件源配置方法
This commit is contained in:
+52
-47
@@ -16,76 +16,90 @@
|
||||
|
||||
```bash
|
||||
## 进入系统软件源配置目录
|
||||
$ cd /etc/apt
|
||||
$ cd /etc/apt/sources.list.d
|
||||
|
||||
## 查看系统默认镜像配置
|
||||
$ cat sources.list
|
||||
|
||||
## 将默认软件源配置文件进行备份
|
||||
$ cp sources.list sources.list.bak
|
||||
$ cat debian.sources
|
||||
```
|
||||
|
||||
系统默认镜像配置记录如下。
|
||||
|
||||
```bash
|
||||
deb http://ftp.debian.org/debian bookworm main contrib
|
||||
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
|
||||
|
||||
deb http://ftp.debian.org/debian bookworm-updates main contrib
|
||||
|
||||
# security updates
|
||||
deb http://security.debian.org bookworm-security main contrib
|
||||
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) 的镜像仓库进行替换,使用如下命令。
|
||||
|
||||
**注意:该命令为两行,在输入时请逐行输入并回车执行。**
|
||||
这里将使用 [中国科技大(USTC)](http://mirrors.ustc.edu.cn/help/proxmox.html) 的镜像仓库进行替换,使用如下命令。
|
||||
|
||||
```bash
|
||||
## 替换系统软件仓库
|
||||
## 配置 PVE 系统默认软件源脚本
|
||||
|
||||
$ sed -i 's|^deb http://ftp.debian.org|deb https://mirrors.ustc.edu.cn|g' /etc/apt/sources.list
|
||||
cat > /etc/apt/sources.list.d/debian.sources <<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
|
||||
|
||||
$ sed -i 's|^deb http://security.debian.org|deb https://mirrors.ustc.edu.cn/debian-security|g' /etc/apt/sources.list
|
||||
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
|
||||
|
||||
如果希望能更新 CPU 的 `microcode` ,则需要手动添加镜像 `non-free` 、 `non-free-firmware` 参数,完整系统源示例如下。
|
||||
|
||||
```bash
|
||||
deb https://mirrors.ustc.edu.cn/debian/ bookworm main contrib non-free non-free-firmware
|
||||
|
||||
deb https://mirrors.ustc.edu.cn/debian/ bookworm-updates main contrib non-free non-free-firmware
|
||||
|
||||
# security updates
|
||||
deb https://mirrors.ustc.edu.cn/debian-security/ bookworm-security main contrib non-free non-free-firmware
|
||||
```
|
||||
|
||||
### 1.2. PVE 软件源
|
||||
|
||||
默认情况下,PVE 额外启用了 2 个官方源,且为订阅收费制,因此需要替换为免费源。
|
||||
|
||||
首先创建 PVE 免费软件源,执行以下命令。
|
||||
首先创建 PVE 免订阅软件源,执行以下命令。
|
||||
|
||||
```bash
|
||||
## 创建 PVE 免费软件源
|
||||
## 配置 PVE 系统免订阅软件源脚本
|
||||
|
||||
$ source /etc/os-release
|
||||
cat > /etc/apt/sources.list.d/pve-no-subscription.sources <<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
|
||||
|
||||
$ echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/pve $VERSION_CODENAME pve-no-subscription" > /etc/apt/sources.list.d/pve-no-subscription.list
|
||||
```
|
||||
|
||||
对于 Proxmox Backup Server 和 Proxmox Mail Gateway,请将以上命令中的 `pve` 分别替换为 `pbs` 和 `pmg` 。
|
||||
对于 Proxmox Backup Server 和 Proxmox Mail Gateway,请将以上命令路径中的 `pve` 分别替换为 `pbs` 和 `pmg` 。
|
||||
|
||||
进一步创建 PVE Ceph 免费软件源,Ceph 软件源为 PVE 8 之后默认安装,执行以下命令。
|
||||
进一步创建 PVE Ceph 免订阅软件源,Ceph 软件源为 PVE 8 之后默认安装,执行以下命令。
|
||||
|
||||
```bash
|
||||
## 创建 PVE Ceph 免费软件源脚本
|
||||
## 配置 PVE Ceph 免订阅软件源脚本
|
||||
|
||||
if [ -f /etc/apt/sources.list.d/ceph.list ]; then
|
||||
if [ -f /etc/apt/sources.list.d/ceph.sources ]; then
|
||||
CEPH_CODENAME=`ceph -v | grep ceph | awk '{print $(NF-1)}'`
|
||||
source /etc/os-release
|
||||
echo "deb https://mirrors.ustc.edu.cn/proxmox/debian/ceph-$CEPH_CODENAME $VERSION_CODENAME no-subscription" > /etc/apt/sources.list.d/ceph-no-subscription.list
|
||||
cat > /etc/apt/sources.list.d/ceph-no-subscription.sources <<EOF
|
||||
Types: deb
|
||||
URIs: https://mirrors.ustc.edu.cn/proxmox/debian/ceph-$CEPH_CODENAME
|
||||
Suites: $VERSION_CODENAME
|
||||
Components: no-subscription
|
||||
Signed-By: /usr/share/keyrings/proxmox-archive-keyring.gpg
|
||||
|
||||
EOF
|
||||
fi
|
||||
|
||||
```
|
||||
|
||||
最后,删除 PVE 官方付费软件源,执行以下命令。
|
||||
@@ -94,7 +108,7 @@ fi
|
||||
|
||||
```bash
|
||||
## 删除付费软件源
|
||||
$ rm -rvf /etc/apt/sources.list.d/pve-enterprise.list /etc/apt/sources.list.d/ceph.list
|
||||
$ rm -rvf /etc/apt/sources.list.d/pve-enterprise.sources /etc/apt/sources.list.d/ceph.sources
|
||||
```
|
||||
|
||||
创建完成后对其进行检查。
|
||||
@@ -104,13 +118,7 @@ $ rm -rvf /etc/apt/sources.list.d/pve-enterprise.list /etc/apt/sources.list.d/ce
|
||||
$ cat /etc/apt/sources.list.d/*
|
||||
```
|
||||
|
||||
如果输出结果中有 USTC 的镜像地址,则表示命令已经正确执行。
|
||||
|
||||
```bash
|
||||
#### PVE 免费软件源示例输出
|
||||
deb https://mirrors.ustc.edu.cn/proxmox/debian/ceph-quincy bookworm no-subscription
|
||||
deb https://mirrors.ustc.edu.cn/proxmox/debian/pve bookworm pve-no-subscription
|
||||
```
|
||||
如果输出结果中均为 USTC 的镜像地址,则表示命令已经正确执行。
|
||||
|
||||
### 1.3. PVE CT 源
|
||||
|
||||
@@ -119,11 +127,8 @@ deb https://mirrors.ustc.edu.cn/proxmox/debian/pve bookworm pve-no-subscription
|
||||
由于该功能暂时未被使用,因此本文只做记录。
|
||||
|
||||
```bash
|
||||
## 备份 CT Templates 源
|
||||
$ cp /usr/share/perl5/PVE/APLInfo.pm /usr/share/perl5/PVE/APLInfo.pm.bak
|
||||
|
||||
## 替换 CT Templates 链接
|
||||
$ sed -i 's|http://download.proxmox.com|https://mirrors.ustc.edu.cn/proxmox|g' /usr/share/perl5/PVE/APLInfo.pm
|
||||
$ sed -i.bak 's|http://download.proxmox.com|https://mirrors.ustc.edu.cn/proxmox|g' /usr/share/perl5/PVE/APLInfo.pm
|
||||
|
||||
## 重启 PVE API 守护进程
|
||||
$ systemctl restart pvedaemon.service
|
||||
|
||||
Reference in New Issue
Block a user