您的位置:首页 > 运维架构

手动安装liberty版本openstack环境(allinone)---安装glance

2015-11-28 18:13 609 查看
作者:【吴业亮】云计算开发工程师

博客:http://blog.csdn.net/wylfengyujiancheng

1、创建glance数据库

[code]# mysql -uroot -pChangeme_123 -e "CREATE DATABASE glance;


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

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

[code]# mysql -uroot -pChangeme_123 -e "GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'localhost' IDENTIFIED BY 'Changeme_123';" 
# mysql -uroot -pChangeme_123 -e "GRANT ALL PRIVILEGES ON glance.* TO 'glance'@'%' IDENTIFIED BY 'Changeme_123';"


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

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

[code]# source /root/admin-openrc.sh 
# openstack user create  glance  --password Changeme_123
# openstack role add --project service --user glance admin


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

4、创建image服务

[code]# openstack service create --name glance --description "OpenStack Image service" image


5、创建glance的endpoint

[code]# openstack endpoint create --region RegionOne   image public http://${HOSTNAME}:9292  
# openstack endpoint create --region RegionOne   image internal http://${HOSTNAME}:9292 
# openstack endpoint create --region RegionOne   image admin http://${HOSTNAME}:9292[/code] 
6、创建glance相关rpm包

[code]# yum install openstack-glance python-glance python-glanceclient -y


7、修改glance配置文件/etc/glance/glance-api.conf

[code]# openstack-config --set  /etc/glance/glance-api.conf database connection  mysql://glance:Changeme_123@${HOSTNAME}/glance
# openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken auth_uri  http://${HOSTNAME}:5000 # openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken auth_url  http://${HOSTNAME}:35357 # openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken auth_plugin  password
# openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken project_domain_id  default
# openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken user_domain_id  default
# openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken username  glance 
# openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken password  Changeme_123 
# openstack-config --set  /etc/glance/glance-api.conf keystone_authtoken project_name  service  
# openstack-config --set  /etc/glance/glance-api.conf paste_deploy flavor  keystone 
# 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/
# openstack-config --set  /etc/glance/glance-api.conf DEFAULT notification_driver  noop 
# openstack-config --set  /etc/glance/glance-api.conf DEFAULT verbose  True


8、修改glance配置文件/etc/glance/glance-registry.conf

[code]# openstack-config --set  /etc/glance/glance-registry.conf database connection  mysql://glance:Changeme_123@${HOSTNAME}/glance
# openstack-config --set  /etc/glance/glance-registry.conf keystone_authtoken auth_uri  http://${HOSTNAME}:5000 
# openstack-config --set  /etc/glance/glance-registry.conf keystone_authtoken auth_url  http://${HOSTNAME}:35357 
# openstack-config --set  /etc/glance/glance-registry.conf keystone_authtoken auth_plugin  password
# openstack-config --set  /etc/glance/glance-registry.conf keystone_authtoken project_domain_id  default 
# openstack-config --set  /etc/glance/glance-registry.conf keystone_authtoken user_domain_id  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 Changeme_123 
# openstack-config --set  /etc/glance/glance-registry.conf paste_deploy flavor  keystone 
# openstack-config --set  /etc/glance/glance-registry.conf DEFAULT notification_driver  noop 
# openstack-config --set  /etc/glance/glance-registry.conf DEFAULT verbose  True


9、同步数据库

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


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

[code]# systemctl enable openstack-glance-api.service openstack-glance-registry.service 
# systemctl start openstack-glance-api.service openstack-glance-registry.service


11、将glance版本号写入环境变量中

[code]# echo " " >>  /root/admin-openrc.sh && \
# echo " " >>  /root/demo-openrc.sh
# echo "export OS_IMAGE_API_VERSION=2" | tee -a /root/admin-openrc.sh  /root/demo-openrc.sh


12、下载镜像

[code]# wget  http://download.cirros-cloud.net/0.3.4/cirros-0.3.4-x86_64-disk.img[/code] 
13、上传镜像到glance

[code]# source /root/admin-openrc.sh 
# glance image-create --name "cirros-0.3.4-x86_64" --file cirros-0.3.4-x86_64-disk.img  \
--disk-format qcow2 --container-format bare --visibility public --progress


14、查看镜像

[code]# glance image-list
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: