12.2. 重命名胶囊服务器
Capsule 服务器的主机名由 Satellite 服务器组件和注册的所有主机引用。此流程可确保除了重命名胶囊服务器外,您也更新对新主机名的所有引用。
重命名您的胶囊服务器主机会关闭该主机上的所有 Satellite 服务。重命名完成后服务会重启。
先决条件
- 在重命名前备份您的 Capsule 服务器。如果您无法成功重命名,请从备份中恢复。更多信息请参阅 第 10 章 备份 Satellite 服务器和胶囊服务器。
在 Capsule 服务器上运行主机名和
主机名
-fsatellite-change-hostname
脚本将无法完成。如果
hostname
命令返回 Capsule 服务器的短名称,而不是 FQDN,请在尝试使用satellite-change-hostname
脚本前,使用hostnamectl set-hostname My_Old_FQDN
来正确设置旧的 FQDN。
流程
在卫星服务器上,为胶囊服务器生成一个新的证书存档文件。
如果您使用默认 SSL 证书,请输入以下命令:
# capsule-certs-generate \ --foreman-proxy-fqdn new-capsule.example.com \ --certs-tar /root/new-capsule.example.com-certs.tar
请确定您输入到
.tar
文件的完整路径。- 如果您使用自定义 SSL 证书,请为胶囊服务器创建一个新的 SSL 证书。有关更多信息,请参阅安装 Capsule 服务器 中的 使用自定义 SSL 证书配置 Capsule 服务器。
在受管主机上,将证书存档文件复制到胶囊服务器。例如,将存档文件复制到
root
用户的主目录:# scp /root/new-capsule.example.com-certs.tar root@capsule.example.com:
在 Capsule 服务器上,运行
satellite-change-hostname
脚本,并提供主机的新名称、Satellite 凭据和证书存档文件名。# satellite-change-hostname new-capsule.example.com --username admin \ --password password \ --certs-tar /root/new-capsule.example.com-certs.tar
请确定您输入到
.tar
文件的完整路径。-
如果您为 Capsule 服务器创建了自定义证书,请输入在上一步中返回的
satellite-installer
命令,在 Capsule 服务器上部署证书。如需更多信息,请参阅 安装 Capsule 服务器 中的 向 Capsule 服务器部署自定义 SSL 证书。
在所有胶囊客户端上,输入以下命令重新安装 bootstrap RPM、重新注册客户端并刷新其订阅。
您可以使用远程执行功能执行此步骤。如需更多信息,请参阅 管理主机 中的 配置和设置远程作业。
# dnf remove katello-ca-consumer* # dnf install http://new-capsule.example.com/pub/katello-ca-consumer-latest.noarch.rpm # subscription-manager register --org="My_Organization" \ --environment="Library" \ --force # subscription-manager refresh
在 Satellite Web UI 中更新 Capsule 主机名。
- 在 Satellite Web UI 中,导航到 Infrastructure > Capsules。
- 在列表中找到 Capsule Server,然后单击 Edit。
- 编辑 Name 和 URL 字段,以匹配胶囊服务器的新主机名,然后单击 Submit。
- 在 DNS 服务器上,为您的胶囊服务器的新主机名添加记录,并删除之前主机名的记录。