设置环境变量,配置管理员账户
export OS_USERNAME=admin
export OS_PASSWORD=123456
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://192.168.253.130:5000/v3
export OS_IDENTITY_API_VERSION=3
一、导入环境
export OS_USERNAME=admin
export OS_PASSWORD=123456
export OS_PROJECT_NAME=admin
export OS_USER_DOMAIN_NAME=Default
export OS_PROJECT_DOMAIN_NAME=Default
export OS_AUTH_URL=http://192.168.253.130:5000/v3
export OS_IDENTITY_API_VERSION=3
- 创建glance数据库并授权
登录mariadb数据库
mysql -u root -p
创建数据库
CREATE DATABASE glance;
数据库授权
GRANT ALL PRIVILEGES ON glance. TO ‘glance’@’localhost’ IDENTIFIED BY ‘123456’;
GRANT ALL PRIVILEGES ON glance. TO ‘glance’@’%’ IDENTIFIED BY ‘123456;
GRANT ALL PRIVILEGES ON glance.* TO ‘glance’@’OpenStackController’ IDENTIFIED BY ‘123456’;
查看用户列表
openstack user list - 创建Glance服务
openstack user create —domain default —password-prompt glance
创建一个service项目
openstack project create service
增加service项目
openstack role add —project service —user glance admin
创建镜像
openstack service create —name glance —description “OpenStack Image” image
- 创建Glance API端点
openstack endpoint create —region RegionOne image public http://192.168.253.130:9292
openstack endpoint create —region RegionOne image internal http://192.168.253.130:9292
openstack endpoint create —region RegionOne image admin http://192.168.253.130:9292 - 安装Glance
yum install openstack-glance -y
5.配置Glance
vim /etc/glance/glance-api.conf
[database]
connection=mysql+pymysql://glance:GLANCE_DBPASS@192.168.253.130/glance
[keystone_authtoken]
# will be removed in the S release.
auth_uri=http://192.168.253.130:5000
auth_url=http://192.168.253.130:5000
memcached_servers=192.168.253.130:11211
auth_type=password
project_domain_name=Default
user_domain_name=Default
project_name=service
user=glance
password=123456
flavor=keystone #注释打开
[glance_store]
stores=file,http
default_store=file
filesystem_store_datadir=/var/lib/glance/images
vim /etc/glance/glance-registry.conf
[database]
connection=mysql+pymysql://glance:GLANCE_DBPASS@192.168.253.130/glance
[keystone_authtoken]
# will be removed in the S release.
auth_uri=http://192.168.253.130:5000
auth_url=http://192.168.253.130:5000
memcached_servers=192.168.253.130:11211
auth_type=password
project_domain_name=Default
user_domain_name=Default
project_name=service
user=glance
password=123456
flavor=keystone #注释打开
初始化数据库
glance-manage db_sync启动设置
启动api
systemctl enable openstack-glance-api
systemctl start openstack-glance-api
systemctl status openstack-glance-api
启动registry
systemctl enable openstack-glance-registry
systemctl start openstack-glance-registry
systemctl status openstack-glance-registry
如果API不能正常启动(权限不够)则使用以下命令:
chown -R glance:glance /var/log/glance/api.log