next up previous contents
Next: 新增作業系統 image 到 Glance Up: Image 服務 Glance Previous: 認識 Glance   Contents

Glance 安裝

  1. 安裝套件
    [root@kvm4 ~]# yum install -y openstack-glance
    
  2. 使用 glance 原始設定檔
    [root@kvm4 ~]# cp /usr/share/glance/glance-registry-dist.conf /etc/glance/glance-registry.conf 
    cp: overwrite `/etc/glance/glance-registry.conf'? y
    
  3. 初使化 glance 資料庫。
    [root@kvm4 ~]# openstack-db --init --service glance --password 123qwe --rootpw 123qwe
    Creating 'glance' database.
    Updating 'glance' database password in /etc/glance/glance-registry.conf /etc/glance/glance-api.conf
    Initializing the glance database, please wait...
    Complete!
    
  4. 使用 openstack-config 工具設定 glance-api.conf。
    [root@kvm4 ~]# openstack-config --set /etc/glance/glance-api.conf \
    paste_deploy flavor keystone
    [root@kvm4 ~]# openstack-config --set /etc/glance/glance-api.conf \
    keystone_authtoken admin_tenant_name admin
    [root@kvm4 ~]# openstack-config --set /etc/glance/glance-api.conf \
    keystone_authtoken admin_user admin
    [root@kvm4 ~]# openstack-config --set /etc/glance/glance-api.conf \
    keystone_authtoken admin_password 123qwe
    
  5. 使用 openstack-config 工具設定 glance-registry.conf。
    [root@kvm4 ~]# openstack-config --set /etc/glance/glance-registry.conf \
    paste_deploy flavor keystone
    [root@kvm4 ~]# openstack-config --set /etc/glance/glance-registry.conf \
    keystone_authtoken admin_tenant_name admin
    [root@kvm4 ~]# openstack-config --set /etc/glance/glance-registry.conf \
    keystone_authtoken admin_user admin
    [root@kvm4 ~]# openstack-config --set /etc/glance/glance-registry.conf \
    keystone_authtoken admin_password 123qwe
    
  6. 啟動並設定開機自動啟動 openstack-glance-registry openstack-glance-api 服務。
    [root@kvm4 ~]# /etc/init.d/openstack-glance-registry start
    Starting openstack-glance-registry:                [  OK  ]
    [root@kvm4 ~]# chkconfig openstack-glance-registry on
    [root@kvm4 ~]# /etc/init.d/openstack-glance-api start
    Starting openstack-glance-api:                     [  OK  ]
    [root@kvm4 ~]# chkconfig openstack-glance-api on
    
  7. 查看 glance 紀錄檔,錯誤訊息不影響往後實作,原因待說明。
    [root@kvm4 ~]# tail /var/log/glance/*
    ==> /var/log/glance/api.log <==
    2014-01-25 03:03:25.193 21202 WARNING glance.store.base [-] \
    Failed to configure store correctly: Store s3 could not be configured correctly. \
    Reason: Could not find s3_store_host in configuration options. Disabling add method.
    2014-01-25 03:03:25.203 21202 ERROR glance.store.swift [-] \
    Could not find swift_store_auth_address in configuration options.
    2014-01-25 03:03:25.203 21202 WARNING glance.store.base [-] \
    Failed to configure store correctly: Store swift could not be configured correctly. \
    Reason: Could not find swift_store_auth_address in configuration options. Disabling add method.
    
    ==> /var/log/glance/registry.log <==
    
  8. 導入 admin 環境變數。
    [root@kvm4 ~]# source keystonerc_admin 
    [root@kvm4 ~(keystone_admin)]$
    
  9. 產生 glance 用戶,並新增其在租用戶 services 為 admin 角色。
    [root@kvm4 ~(keystone_admin)]# keystone user-create --name glance --pass 123qwe
    +----------+----------------------------------+
    | Property |              Value               |
    +----------+----------------------------------+
    |  email   |                                  |
    | enabled  |               True               |
    |    id    | d019862a71594e47805ae5cc3752f346 |
    |   name   |              glance              |
    | tenantId |                                  |
    +----------+----------------------------------+
    
  10. 設定用戶 glance 在租戶 services 的角色為 admin。
    [root@kvm4 ~(keystone_admin)]# keystone user-role-add --user glance --role admin --tenant services
    
  11. 產生 glance 服務,並記下其 id,以建立 endpoint。
    [root@kvm4 ~(keystone_admin)]# keystone service-create \
    --name glance --type image --description "Glance Image Service"
    +-------------+----------------------------------+
    |   Property  |              Value               |
    +-------------+----------------------------------+
    | description |       Glance Image Service       |
    |      id     | 67b9bbfd101a43f7843d337ba6dbb585 |
    |     name    |              glance              |
    |     type    |              image               |
    +-------------+----------------------------------+
    
  12. 建立 glance 的 endpoint。
    [root@kvm4 ~(keystone_admin)]# keystone endpoint-create \
    --service-id 67b9bbfd101a43f7843d337ba6dbb585 \
    --publicurl http://kvm4.deyu.wang:9292 \
    --adminurl http://kvm4.deyu.wang:9292 \
    --internalurl http://kvm4.deyu.wang:9292
    +-------------+----------------------------------+
    |   Property  |              Value               |
    +-------------+----------------------------------+
    |   adminurl  |    http://kvm4.deyu.wang:9292    |
    |      id     | ab01fca343c541bcb4ec4e6b0ab3f51c |
    | internalurl |    http://kvm4.deyu.wang:9292    |
    |  publicurl  |    http://kvm4.deyu.wang:9292    |
    |    region   |            regionOne             |
    |  service_id | 67b9bbfd101a43f7843d337ba6dbb585 |
    +-------------+----------------------------------+
    



2015-12-29