Centos7.4安装openstack(queens)详细安装部署(三)-镜像服务(glance)安装
一、安装镜像服务
1.1、控制节点)配置镜像数据库
mysql -u root -pADMIN_PASS
1.2、创建glance数据库并设置访问权限
CREATE DATABASE glance; GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'ADMIN_PASS'; GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'ADMIN_PASS';
1.3、(控制节点)创建glance认证相关信息
openstack user create --domain default --password ADMIN_PASS glance 创建glance用户 openstack role add --project service --user glance admin 将glance用户加入service项目,并设置admin角色 openstack service create --name glance --description "OpenStack Image" image 创建镜像服务 openstack endpoint create --region RegionOne image public http://controller:9292 创建镜像api端口 openstack endpoint create --region RegionOne image internal http://controller:9292 openstack endpoint create --region RegionOne image admin http://controller:9292
二、(控制节点)安装软件包并配置配置文件
1.1、安装软件包
yum install openstack-glance -y
1.2、编辑/etc/glance/glance-api.conf文件并完成下面配置
cp /etc/glance/glance-api.conf{,.bak} grep '^[a-z\[]' /etc/glance/glance-api.conf.bak >/etc/glance/glance-api.conf [database] connection = mysql+pymysql://glance:ADMIN_PASS@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 = ADMIN_PASS [paste_deploy] flavor = keystone
1.3、编辑/etc/glance/glance-registry.conf文件,完成以下配置
cp /etc/glance/glance-registry.conf{,.bak} grep '^[a-z\[]' /etc/glance/glance-registry.conf.bak >/etc/glance/glance-registry.conf [database] connection = mysql+pymysql://glance:ADMIN_PASS@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 = ADMIN_PASS [paste_deploy] flavor = keystone
1.4、同步数据库
su -s /bin/sh -c "glance-manage db_sync" glance
1.5、(控制节点)设置服务的开机自启动,并启动服务
systemctl enable openstack-glance-api.service openstack-glance-registry.service
systemctl start openstack-glance-api.service openstack-glance-registry.service
三、(控制节点)验证操作
1.1、下载镜像
yum install wget -y wget http://download.cirros-cloud.net/0.3.5/cirros-0.3.5-x86_64-disk.img
1.2、上传镜像
openstack image create "cirros" --file cirros-0.3.5-x86_64-disk.img --disk-format qcow2 --container-format bare --public
1.3、确认下镜像是否成功上传
openstack image list +--------------------------------------+--------+--------+ | ID | Name | Status | +--------------------------------------+--------+--------+ | fcd97a6a-2125-4039-9ff8-be444d9e276c | cirros | active | +--------------------------------------+--------+--------+