OpenStack to build a private cloud-based enterprise (3) Glance

1. Install Glance

[root@linux-node1 ~]# yum install -y openstack-glance


2.Glance database configuration

Glance-api.conf

[root@linux-node1 ~]# vim /etc/glance/glance-api.conf
[database]
connection= mysql+pymysql://glance:[email protected]/glance


glance-registry.conf

[root@linux-node1 ~]# vim /etc/glance/glance-registry.conf
[database]
connection= mysql+pymysql://glance:[email protected]/glance



3. Set Keystone

[root@linux-node1 ~]# vim /etc/glance/glance-api.conf
[keystone_authtoken]
auth_uri = http://192.168.56.11:5000
auth_url = http://192.168.56.11:35357
memcached_servers = 192.168.56.11:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance

[paste_deploy]
flavor=keystone


glance-registry.conf configuration

[root@linux-node1 ~]# vim /etc/glance/glance-registry.conf
[keystone_authtoken]
auth_uri = http://192.168.56.11:5000
auth_url = http://192.168.56.11:35357
memcached_servers = 192.168.56.11:11211
auth_type = password
project_domain_name = default
user_domain_name = default
project_name = service
username = glance
password = glance

[paste_deploy]
flavor=keystone


4. Set the image storage Glance

[root@linux-node1 ~]# vim /etc/glance/glance-api.conf
[glance_store]
stores = file,http
default_store=file
filesystem_store_datadir=/var/lib/glance/images/


5. synchronize database

[root@linux-node1 ~]# su -s /bin/sh -c "glance-manage db_sync" glance


6. Start Glance Service

# systemctl enable openstack-glance-api.service
# systemctl enable openstack-glance-registry.service
# systemctl start openstack-glance-api.service
# systemctl start openstack-glance-registry.service


7.Glance service registration
   you want to let other services can use Glance, we need to complete the registration service at Keystone. Note that you need to source about the admin environment variables.

[root@linux-node1 ~]# source admin-openstack.sh
# openstack service create --name glance --description "OpenStack Image service" image
# openstack endpoint create --region RegionOne   image public http://192.168.56.11:9292
# openstack endpoint create --region RegionOne   image internal http://192.168.56.11:9292
# openstack endpoint create --region RegionOne   image admin http://192.168.56.11:9292


8. Test state Glance

[root@linux-node1 ~]# source admin-openstack.sh
[root@linux-node1 ~]# openstack image list


9.Glance mirror
at the beginning of the implementation phase of OpenStack platform, if not mirrored. You can use a mirror experiment to test, this is a small Linux system.

[root@linux-node1 ~]# cd /usr/local/src
[root@linux-node1 src]# wget http://download.cirros-cloud.n ... k.img

[root@linux-node1 src]# openstack image create "cirros" --disk-format qcow2 \
--container-format bare --file cirros-0.3.5-x86_64-disk.img --public
[root@linux-node1 src]# openstack image list
+--------------------------------------+--------+--------+
| ID                                   | Name   | Status |
+--------------------------------------+--------+--------+
| cf154a84-a73a-451b-bcb3-83c98e7c0d3e | cirros | active |
+--------------------------------------+--------+--------+

Guess you like

Origin www.cnblogs.com/zhanghn8/p/11278189.html