↓↓↓↓↓↓↓↓视频已上线 B 站↓↓↓↓↓↓↓↓
<h2 id="1">1.创建 glance 数据库</h2>
# mysql -uroot -p000000
>create database glance;
> grant all privileges on glance.* to 'glance'@'localhost' identified by '000000';
> grant all privileges on glance.* to 'glance'@'%' identified by '000000';
复制代码
<h2 id="2">2.获得 admin 凭证来获取只有管理员能执行的命令的访问权限</h2>
<h2 id="3">3.创建服务证数,创建用户,添加角色到项目上</h2>
创建 glance 用户
#openstack user create --domain default --password 000000 glance
添加 admin 角色到 glance 用户和 service 项目上
#openstack role add --project service --user glance admin
创建 glance 服务实体:
#openstack service create --name glance --description "OpenStack Image" image
复制代码
<h2 id="4">4.创建镜像服务的 API 端点</h2>
#openstack endpoint create --region RegionOne image public http://controller:9292
#openstack endpoint create --region RegionOne image internal http://controller:9292
#openstack endpoint create --region RegionOne image admin http://controller:9292
复制代码
<h2 id="5">5.安装 Glance 软件包,并配置</h2>
安装软件包
#yum -y install openstack-glance
复制代码
1.编辑文件 /etc/glance/glance-api.conf
#vi /etc/glance/glance-api.conf
在[database]下添加
connection = mysql+pymysql://glance:000000@controller/glance
在[keystone_authtoken]下添加
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = 000000 #此处六个零为之前创建的glance用户密码
在[paste_deploy]下添加
flavor = keystone
在[glance_store]下添加,配置本地文件系统存储和镜像文件位置
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/
复制代码
2.编辑文件 /etc/glance/glance-registry.conf
#vi /etc/glance/glance-registry.conf
在[database]下,添加
connection = mysql+pymysql://glance:000000@controller/glance
在 [keystone_authtoken]下,配置认证服务访问:
auth_uri = http://controller:5000
auth_url = http://controller:35357
memcached_servers = controller:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = 000000
在[paste_deploy]下添加
flavor = keystone
复制代码
<h2 id="6">6.同步数据库服务</h2>
# su -s /bin/sh -c "glance-manage db_sync" glance
复制代码
<h2 id="7">7.启动镜像服务并设置开机启动</h2>
#systemctl start openstack-glance-api.service openstack-glance-registry.service
#systemctl enable openstack-glance-api.service openstack-glance-registry.service
复制代码
<h2 id="8">8.验证操作,上传镜像</h2>
# . /root/admin-openrc
# glance image-create --name cirros --disk-format qcow2 --container-format bare --progress < /opt/mitaka/image/cirros-0.3.4-x86_64-disk.img
# openstack image list
复制代码
评论