Install and Configure OpenStack Image Service (Glance) for Ubuntu 14.04

Based on Ubuntu 14.04 LTS x86_64


1. Install and Configure OpenStack Image Service (Glance)

aptitude -y install glance python-glanceclient


mysql -uroot -p
mysql> create database glance;
mysql> grant all privileges on glance.* to 'glance'@'localhost' identified by 'GLANCE-DBPASS';
mysql> grant all privileges on glance.* to 'glance'@'%' identified by 'GLANCE-DBPASS';
mysql> flush privileges;


vi /etc/glance/glance-api.conf
[database]
connection = mysql://glance:glance@MYSQL-SERVER/glance

[DEFAULT]

rpc_backend = rabbit
rabbit_host = controller

rabbit_password = GUEST-PASS


vi /etc/glance/glance-registry.conf
[database]
connection = mysql://glance:glance@MYSQL-SERVER/glance


rm -rf /var/lib/glance/glance.sqlite

glance-manage db_sync


2. vi /etc/glance/glance-registry.conf

[keystone_authtoken]
auth_host=controller
auth_port=35357
auth_protocol=http

auth_uri=http://controller:5000

admin_tenant_name=service
admin_user=glance
admin_password=GLANCE-USER-PASSWORD
# add at the last
flavor=keystone

vi /etc/glance/glance-api.conf

[keystone_authtoken]
auth_host=controller
auth_port=35357
auth_protocol=http

auth_uri=http://controller:5000

admin_tenant_name=service
admin_user=glance
admin_password=GLANCE-USER-PASSWORD
# add at the last
flavor=keystone


# add glance user (set in service tenant)
keystone user-create --tenant service --name glance --pass GLANCE-USER-PASSWORD

# add glance user in admin role
keystone user-role-add --user glance --tenant service --role admin


# add service for glance
keystone service-create --name=glance --type=image --description="Glance Image Service"

# add endpoint for glance
keystone endpoint-create --region RegionOne --service glance --publicurl=http://controller:9292 --internalurl=http://controller:9292 --adminurl=http://controller:9292


chown -R glance:glance /etc/glance /var/log/glance

service glance-registry restart; service glance-api restart


3. add CirrOS for verify
wget http://cdn.download.cirros-cloud.net/0.3.2/cirros-0.3.2-x86_64-disk.img

Upload the image to the Image Service
glance image-create --name="CirrOS 0.3.2" --disk-format=qcow2 --container-format=bare --is-public=true < cirros-0.3.2-x86_64-disk.img
glance image-list

你可能感兴趣的:(glance)