Files
ProjectAGiPrompt/20-物理服务器虚拟机/1-2026年3月25日-安装.md
2026-04-29 09:46:36 +08:00

7.0 KiB
Raw Blame History

关键发现:collectd 不在 EPEL而在 CentOS Stream 9 OpsTools SIG 仓库中 。oVirt 完整安装需要 10+ 个 CentOS SIG 仓库,以下给出从头开始的完整操作。 computingforgeeks


第一步:修复 OpenEuler dnf 兼容性

# 解决 "Detection of Platform Module failed" 问题
echo "module_platform_id=platform:el9" >> /etc/dnf/dnf.conf

# 验证
grep module_platform_id /etc/dnf/dnf.conf

第二步:清理之前添加的错误仓库

# 删除上次添加的错误仓库
rm -f /etc/yum.repos.d/ovirt-master.repo
rm -f /etc/yum.repos.d/ovirt-4.5.repo
rm -f /etc/yum.repos.d/epel9-manual.repo

dnf clean all

第三步:添加全套依赖仓库(全部使用国内镜像)


# 直接覆盖写入正确的 SIG 仓库文件
cat > /etc/yum.repos.d/centos9-stream-sigs.repo << 'EOF'
[c9s-ovirt45]
name=CentOS Stream 9 - oVirt 4.5 SIG
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/SIGs/9-stream/virt/x86_64/ovirt-45/
enabled=1
gpgcheck=0

[c9s-opstools]
name=CentOS Stream 9 - OpsTools SIG (collectd)
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/SIGs/9-stream/opstools/x86_64/collectd-5/
enabled=1
gpgcheck=0

[c9s-openstack-yoga]
name=CentOS Stream 9 - OpenStack Yoga SIG
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/SIGs/9-stream/cloud/x86_64/openstack-yoga/
enabled=1
gpgcheck=0

[c9s-rabbitmq]
name=CentOS Stream 9 - RabbitMQ 38 SIG
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/SIGs/9-stream/messaging/x86_64/rabbitmq-38/
enabled=1
gpgcheck=0

[c9s-nfv-openvswitch]
name=CentOS Stream 9 - NFV OpenvSwitch SIG
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/SIGs/9/nfv/x86_64/openvswitch-common/
enabled=1
gpgcheck=0

[c9s-ceph-pacific]
name=CentOS Stream 9 - Ceph Pacific SIG
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/SIGs/9-stream/storage/x86_64/ceph-pacific/
enabled=1
gpgcheck=0

[c9s-gluster10]
name=CentOS Stream 9 - Gluster 10 SIG
baseurl=https://mirrors.tuna.tsinghua.edu.cn/centos-stream/SIGs/9-stream/storage/x86_64/gluster-10/
enabled=1
gpgcheck=0

[c9s-extras]
name=CentOS Stream 9 - Extras
baseurl=https://mirrors.aliyun.com/centos-stream/SIGs/9-stream/extras/x86_64/extras-common/
enabled=1
gpgcheck=0
EOF

# 一次性写入所有必需仓库文件
cat > /etc/yum.repos.d/centos9-stream-base.repo << 'EOF'
[c9s-baseos]
name=CentOS Stream 9 - BaseOS
baseurl=https://mirrors.aliyun.com/centos-stream/9-stream/BaseOS/x86_64/os/
enabled=1
gpgcheck=0

[c9s-appstream]
name=CentOS Stream 9 - AppStream
baseurl=https://mirrors.aliyun.com/centos-stream/9-stream/AppStream/x86_64/os/
enabled=1
gpgcheck=0

[c9s-crb]
name=CentOS Stream 9 - CRB
baseurl=https://mirrors.aliyun.com/centos-stream/9-stream/CRB/x86_64/os/
enabled=1
gpgcheck=0
EOF

cat > /etc/yum.repos.d/epel9.repo << 'EOF'
[epel9]
name=EPEL 9 - x86_64 (Aliyun Mirror)
baseurl=https://mirrors.aliyun.com/epel/9/Everything/x86_64/
enabled=1
gpgcheck=0
priority=99
EOF

cat > /etc/yum.repos.d/ovirt-4.5-upstream.repo << 'EOF'
[ovirt-4.5]
name=oVirt 4.5 Upstream
baseurl=https://resources.ovirt.org/pub/ovirt-4.5/rpm/el9/
enabled=1
gpgcheck=0
EOF

第四步:验证仓库并更新缓存

dnf clean all && dnf makecache

# 验证关键包可以被找到
dnf info collectd | grep -E "Name|Version|Repo"
dnf info python3-os-brick | grep -E "Name|Version|Repo"
dnf info ovirt-engine | grep -E "Name|Version|Repo"

预期输出示例:

Name         : collectd
Version      : 5.12.0
Repository   : c9s-opstools

Name         : ovirt-engine
Version      : 4.5.7
Repository   : ovirt-4.5

第五步:安装 oVirt Engine

# 安装 oVirt Engine忽略 OpenEuler 与 RHEL 的轻微包名差异)
dnf install -y ovirt-engine \
  --setopt=module_platform_id=platform:el9 \
  --allowerasing

# 安装过程中如有提示 "is it ok [y/N]" 类问题,输入 y 确认

安装过程约下载 500MB1GB 的包,根据网速需要 5-15 分钟。


第六步配置主机名FQDN 必须可解析)

# 设置 FQDN
hostnamectl set-hostname ovirt.local.lan

# 添加本地解析
echo "192.168.11.14  ovirt.local.lan  ovirt" >> /etc/hosts

# 验证(必须返回 FQDN不能是 localhost
hostname -f
ping -c 2 $(hostname -f)

第七步:运行配置向导

engine-setup

交互配置参考(直接回车使用默认值即可):

Configure Engine on this host (Yes, No) [Yes]:                  ↵ 回车
Configure Image I/O Proxy on this engine (Yes, No) [Yes]:       ↵ 回车
Configure WebSocket Proxy on this machine (Yes, No) [Yes]:      ↵ 回车
Configure Data Warehouse on this engine (Yes, No) [Yes]:        ↵ 回车
Application mode (both, virt, gluster) [both]:                  ↵ 回车
Default SHE Storage Domain type (glusterfs, nfs) [nfs]:         ↵ 回车

Engine database host [localhost]:                                ↵ 回车
Engine database port [5432]:                                     ↵ 回车
Engine database name [engine]:                                   ↵ 回车
Engine database user [engine]:                                   ↵ 回车
Engine database password:                                        输入密码
oVirt Engine FQDN [ovirt.local.lan]:                            ↵ 回车

Use default credentials (admin@internal) [Yes]:                  ↵ 回车
Engine admin password:                                           输入Web登录密码

Firewall manager to configure (iptables, firewalld) [firewalld]: ↵ 回车

Confirm installation settings [OK]:                             ↵ 回车

成功后输出:

--== SUMMARY ==--
Web access is enabled at:
    https://ovirt.local.lan/ovirt-engine
    http://ovirt.local.lan/ovirt-engine
Please use "admin" user to login

第八步:安装 VDSM宿主节点代理

dnf install -y ovirt-host \
  --setopt=module_platform_id=platform:el9 \
  --allowerasing

systemctl enable --now vdsmd supervdsmd

# 验证
systemctl status vdsmd | grep -E "Active|Main"

第九步:登录 Web Portal 添加宿主机

浏览器访问 https://192.168.11.14/ovirt-engine,用户名 admin,密码为 engine-setup 中设置的密码。

计算 → 主机 → 新建
  名称:    node-openeuler
  主机名:  192.168.11.14
  SSH端口: 22
  认证方式: 密码(填 root 密码)
  → 确定

# 等待约 3-5 分钟,状态变为「已开机」即成功

第十步:安装完成后清理临时仓库

# 保留 ovirt-4.5-upstream后续升级用删除临时的 CentOS 依赖仓库
rm -f /etc/yum.repos.d/centos9-stream-base.repo
rm -f /etc/yum.repos.d/centos9-stream-sigs.repo
rm -f /etc/yum.repos.d/epel9.repo

# 仅保留:
ls /etc/yum.repos.d/
# openEuler 原始仓库(不动)
# ovirt-4.5-upstream.repo保留用于 oVirt 后续更新)

dnf clean all

说明:清理仓库后已安装的包不受影响,仅禁止后续从这些源拉取新包,符合"安装完成后去除"的要求。