Centos7手动部署Openstack Mitaka版安装配置--(四)安装镜像服务glance

安装镜像服务glance

1、创建glance数据库

#mysql -uroot -phncgo110 -e "CREATE DATABASE glance;"

注意将hncgo110替换为自己的密码

2、创建数据库用户并赋予权限

#mysql -uroot -phncgo110 -e "GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'hncgo110';" 
#mysql -uroot -phncgo110 -e "GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'hncgo110';" 

注意将hncgo110替换为自己的密码

3、创建glance用户及赋予admin权限

#source /root/admin-openrc
#openstack user create --domain default glance --password hncgo110
#openstack role add --project service --user glance admin

注意将hncgo110替换为自己的密码

6、创建glance相关软件包

#yum install openstack-glance -y

7、修改glance配置文件
修改 /etc/glance/glance-api.conf(可以全部copy批量执行)

#openstack-config --set  /etc/glance/glance-api.conf database connection  mysql+pymysql://glance:hncgo110@192.168.31.100/glance
#openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken auth_uri http://192.168.31.100:5000
#openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken auth_url http://192.168.31.100:35357
#openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken memcached_servers  192.168.31.100:11211
#openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken auth_type password
#openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken project_domain_name default
#openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken user_domain_name default
#openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken project_name service 
#openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken username glance
#openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken password  hncgo110
#openstack-config --set  /etc/glance/glance-api.conf paste_deploy flavor keystone
#openstack-config --set  /etc/glance/glance-api.conf glance_store stores  file,http
#openstack-config --set  /etc/glance/glance-api.conf glance_store default_store file
#openstack-config --set  /etc/glance/glance-api.conf glance_store filesystem_store_datadir /var/lib/glance/images/

修改glance配置文件glance-registry.conf(可以全部copy批量执行)

#openstack-config --set  /etc/glance/glance-registry.conf database connection mysql+pymysql://glance:hncgo110@192.168.31.100/glance
#openstack-config --set  /etc/glance/glance-registry.conf keystone_authtoken auth_uri http://192.168.31.100:5000
#openstack-config --set  /etc/glance/glance-registry.conf keystone_authtoken auth_url http://192.168.31.100:35357
#openstack-config --set  /etc/glance/glance-registry.conf keystone_authtoken memcached_servers 192.168.31.100:11211
#openstack-config --set  /etc/glance/glance-registry.conf keystone_authtoken auth_type password
#openstack-config --set  /etc/glance/glance-registry.conf keystone_authtoken project_domain_name default
#openstack-config --set  /etc/glance/glance-registry.conf keystone_authtoken user_domain_name default
#openstack-config --set  /etc/glance/glance-registry.conf keystone_authtoken project_name service
#openstack-config --set  /etc/glance/glance-registry.conf keystone_authtoken username glance
#openstack-config --set  /etc/glance/glance-registry.conf keystone_authtoken password hncgo110
#openstack-config --set  /etc/glance/glance-registry.conf paste_deploy flavor keystone

9、同步数据库

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

10、启动glance及设置开机启动

#systemctl enable openstack-glance-api.service openstack-glance-registry.service
#systemctl start openstack-glance-api.service openstack-glance-registry.service
#systemctl status openstack-glance-api.service openstack-glance-registry.service
#systemctl list-unit-files |grep openstack-glance-api.service
#systemctl list-unit-files |grep openstack-glance-registry.service

4、创建image服务

#source /root/admin-openrc
#openstack service create --name glance --description "OpenStack Image" image

5、创建glance的endpoint

#openstack endpoint create --region RegionOne image public http://192.168.31.100:9292
#openstack endpoint create --region RegionOne image internal http://192.168.31.100:9292
#openstack endpoint create --region RegionOne image admin http://192.168.31.100:9292

12、下载镜像

#wget  http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img

13、上传镜像到glance

#source /root/admin-openrc
#openstack image create "cirros" --file cirros-0.3.4-x86_64-disk.img --disk-format qcow2 --container-format bare --public

14、查看镜像

#openstack image list
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值