openstack 安装 Glance

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/ywmack/article/details/81540563

openstack Q版

服务器系统centos7

控制端IP:192.168.50.31

计算端IP:192.168.50.32

Glance

下面所有操作全在控制端

初始化数据库

# 登录数据库
mysql -u root -p

# 创建表
CREATE DATABASE glance;

# 授权
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'glance';
GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'glance';

创建keystone的认证

#获得 admin 凭证
. admin-openrc

#创建 glance 用户
openstack user create --domain default --password-prompt glance
会提示输入帐号密码

#添加 admin 角色到 glance 用户和 service 项目上
openstack role add --project service --user glance admin

# 创建``glance``服务实体:
openstack service create --name glance --description "OpenStack Image" image

#创建镜像服务的 API 端点:
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

安装配置

# YUM安装 glance
yum -y install openstack-glance

# 修改配置文件glance-api.conf 
vim /etc/glance/glance-api.conf 
[database]
connection = mysql+pymysql://glance:glance@controller/glance

[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = glance

[paste_deploy]
flavor = keystone

[glance_store]
stores = file,http
default_store = file
filesystem_store_datadir = /var/lib/glance/images/

# 修改配置文件glance-registry.conf
vim /etc/glance/glance-registry.conf
[database]
connection = mysql+pymysql://glance:glance@controller/glance

[keystone_authtoken]
auth_uri = http://controller:5000
auth_url = http://controller:5000
memcached_servers = controller:11211
auth_type = password
project_domain_name = Default
user_domain_name = Default
project_name = service
username = glance
password = glance

[paste_deploy]
flavor = keystone

# 同步数据库
su -s /bin/sh -c "glance-manage db_sync" glance

# 配置服务
systemctl enable openstack-glance-api.service openstack-glance-registry.service
systemctl start openstack-glance-api.service openstack-glance-registry.service

创建简单镜像

# 获得 admin 凭证
. admin-openrc
# 下载镜像
wget http://download.cirros-cloud.net/0.4.0/cirros-0.4.0-x86_64-disk.img
# 上传镜像
openstack image create "cirros" \
--file cirros-0.4.0-x86_64-disk.img \
--disk-format qcow2 --container-format bare \
--public
# 验证操作
openstack image list

猜你喜欢

转载自blog.csdn.net/ywmack/article/details/81540563
今日推荐