openstack

CentOS Stream 8 手工搭建 OpenStack V 版(03 Glance)

小云
103
2023-10-14 13:50:42
栏目: 编程语言

要手工搭建 CentOS Stream 8 上的 OpenStack V 版本,你需要按照以下步骤进行:

  1. 首先,确保你的 CentOS Stream 8 系统已经安装和配置好了。可以通过执行以下命令来检查版本:
cat /etc/redhat-release

确保系统版本为 CentOS Stream 8。

  1. 安装和配置 Glance 服务。Glance 是 OpenStack 中负责管理镜像的服务。

2.1 安装 Glance 服务:

sudo dnf install openstack-glance

2.2 配置 Glance 服务。编辑 /etc/glance/glance-api.conf 文件,设置以下配置项:

[DEFAULT]
...
enabled_backends = <backend_type>
...
[database]
...
connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance
...
[glance_store]
...
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
...

<backend_type> 替换为你想要使用的后端类型,如 filerbd

编辑 /etc/glance/glance-registry.conf 文件,设置以下配置项:

[database]
...
connection = mysql+pymysql://glance:GLANCE_DBPASS@controller/glance
...

2.3 创建 Glance 数据库。执行以下命令:

sudo mysql

在 MySQL 命令行中执行以下命令:

CREATE DATABASE glance;
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'GLANCE_DBPASS';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'GLANCE_DBPASS';
FLUSH PRIVILEGES;

'GLANCE_DBPASS' 替换为你设置的数据库密码。

2.4 同步 Glance 数据库。执行以下命令:

sudo su -s /bin/sh -c "glance-manage db_sync" glance

2.5 启动和配置 Glance 服务。执行以下命令:

sudo systemctl enable --now openstack-glance-api openstack-glance-registry
  1. 验证 Glance 服务是否正常工作。执行以下命令:
openstack image list

如果没有报错并且能够列出镜像列表,则说明 Glance 服务已经成功安装和配置好了。

这样,你就完成了在 CentOS Stream 8 上手工搭建 OpenStack V 版本中的 Glance 服务的安装和配置。

0
看了该问题的人还看了