注意:该安装是在前面已经安装好keystone的基础上进行的,请先查看CentOS 6.2下源码安装OpenStack的keystone再进行以下操作(见 )!
1.获取最新的glance代码:
cd
git clone https://github.com/openstack/glance.git
2.卸裁Python-crypto
CentOS通过yum安装的该软件版本太低,会导致glance无法启动,将在下一步安装依赖时自动安装最新版本
sudo yum remove python-crypto
3.安装依赖:
sudo yum install python-devel
修改glance/tools/pip-requires注释掉以下两行(暂时使用默认的file作为镜像存储,且已经安装好keystone,故不需要安装):
swift
-e git://github.com/openstack/keystone.git@ab6be05068068b0902db44b1d60f56eea4fe1215#egg=keystone
sudo pip install -r glance/tools/pip-requires
4.安装glance:
cd glance && sudo python setup.py install
5.配置glance:
拷贝默认配置文件:sudo cp -R etc /etc/glance
配置glance使用keystone认证:
更新/etc/glance/glance-api-paste.ini的以下选项为keystone中的设置值:
[filter:authtoken]
admin_tenant_name = service
admin_user = glance
admin_password = yourservicepassword
在/etc/glance/glance-api.conf尾添加:
[paste_deploy]
flavor = keystone
更新/etc/glance/glance-registry-paste.ini的以下选项为keystone中的设置值
[filter:authtoken]
admin_tenant_name = service
admin_user = glance
admin_password = yourservicepassword
在/etc/glance/glance-registry.conf尾添加:
[paste_deploy]
flavor = keystone
设置glance的mysql连接:
修改/etc/glance/glance-registry.conf下的sql_connection = mysql://glance:glance@10.10.10.138/glance
登录mysql创建所需数据库及用户:
create database glance;
grant all privileges on glance.* to 'glance'@'%' identified by 'glance';
配置glance的通信服务器、存储:
查看/etc/glance/glance-api.conf进行配置
6.创建log目录:
sudo mkdir /var/log/glance
7.启动glance:
sudo glance-control registry start
sudo glance-control api start
8.验证glance是否启动:
sudo ps aux | grep glance
应有如下类似的输出:
[ugyn@cc ~]$ sudo ps aux | grep glance
root 4286 0.4 1.4 264060 30548 ? Ss 13:23 0:00 /usr/bin/python /usr/bin/glance-api
root 4297 0.3 1.5 352432 31736 ? Ss 13:24 0:00 /usr/bin/python /usr/bin/glance-registry
ugyn 4345 0.0 0.0 103236 840 pts/3 S+ 13:25 0:00 grep glance
9.境像上传:
下载境像:Ubuntu/ttylinux-uec/ttylinux-uec-amd64-12.1_2.6.35-22_1.tar.gz
解压:tar xzvf ttylinux-uec-amd64-12.1_2.6.35-22_1.tar.gz
上传kernel:
glance -I glance -K yourservicepassword -T service -N :5000/v2.0 add disk_format=aki container_format=aki < ttylinux-uec-amd64-12.1_2.6.35-22_1-vmlinuz
输出见最后图片
上传initrd:
glance -I glance -K yourservicepassword -T service -N :5000/v2.0 add disk_format=ari container_format=ari < ttylinux-uec-amd64-12.1_2.6.35-22_1-loader
输出见最后图片
上传image:
注意:这里要用到前面输出的两个id值!
glance -I glance -K yourservicepassword -T service -N :5000/v2.0 add disk_format=ami container_format=ami kernel_id=aca5d1b4-0482-487d-a457-6a2d13ea499c ramdisk_id=3a391def-b0ae-4719-8ded-fef22368923e < ttylinux-uec-amd64-12.1_2.6.35-22_1.img
输出见最后图片
10.验证:
glance -I glance -K yourservicepassword -T service -N :5000/v2.0 index
输出: