Openstack部署及keystone.glance元件安裝
阿新 • • 發佈:2018-12-30
Openstack部署及keystone.glance元件安裝
文章開始把我喜歡的這句話送個大家:這個世界上還有什麼比自己寫的程式碼執行在一億人的電腦上更酷的事情嗎,如果有那就是讓這個數字再擴大十倍。
一.安裝Openstack
首先,配置IP
- #network Management
- auto eth0
- iface eth0 inet static
- address 10.80.80.10
- netmask 255.255.255.0
- #network loopback
- auto lo
- iface lo inet loopback
執行命令
- # /etc/init.d/networking restart
新增Openstack源
- # apt-get install -y python-software-properties
- # add-apt-repository cloud-archive:icehouse
然後更新系統
- # apt-get update
-
- # apt-get upgrade -y
- # apt-get dist-upgrade -y
安裝NTP服務
- # apt-get install -y ntp
安裝mysql資料庫
- # apt-get install -y mysql-server python-mysqldb
修改mysql的監聽ip 重啟mysql服務
- # service mysql restart
安裝RabbitMQ
- # apt-get install -y rabbitmq-server
預設使用者guest密碼guest
二.keystone元件安裝
1.獲取keystone
- # apt-get insatll -y keystone
2.修改配置檔案
檔案路徑: /etc/keystone/keystone.conf
最後檔案中的配置如下:
- admin_token = openstack
- admin_bind_host=0.0.0.0
- admin_port=35357
- public_port=5000
- public_endpoint=http://localhost:%(public_port)s/
- admin_endpoint=http://localhost:%(admin_port)s/
- debug = True
- verbose = True
- log_file=/var/log/keystone/keystone.log
- connection = mysql://keystoneuser:[email protected]/keystone
3.建立keystone資料庫
- # mysql -uroot -p -e "CREATE DATABASE keystone"
- # mysql -uroot -p -e "GRANT ALL PRIVILEGES ON keystone.* TO'keystoneuser'@'localhost'IDENTIFIED BY 'openstack';"service keystone status
- # keystone-manage db_sync
4.重啟keystone服務
- # service keystone restart
5.建立keystone使用者
建立一個tenant
- # keystone tenant-create --name=admin
建立一個使用者
- # keystone user-create --name=admin --pass="opensatck"
- # keystone role-create --name=admin
關聯角色,使用者和tenant
- # keystone user-role-add --user admin --role admin --tenant admin
6.定義services和API endpoints
- # keystone service-create --name keystone --type identity --description 'OpenStack Identity'
- # keystone endpoint-create --service-id 01fa6ef7e6f847c4a684bfd29c2e9fb5 --publicurl 'http://192.168.0.101:5000/v2.0' --adminurl 'http://10.80.80.10:35357/v2.0' --internalurl 'http://10.80.80.10:5000/v2.0'
檔案存放位置可以在預設登陸的使用者資料夾下,為方便訪問,可放在了 /root 下
- export OS_TENANT_NAME=admin
- export OS_USERNAME=admin
- export OS_PASSWORD=openstack
- export OS_AUTH_URL="http://192.168.0.101:5000/v2.0/"
- # source openstackrc
三 glance元件安裝
1.安裝glance軟體
- # apt-get install -y glance
2.修改glance配置檔案 /etc/glance/glance-api.config
- debug = True
- default_store = file
- bind_host = 0.0.0.0
- bind_port = 9292
- log_file = /var/log/glance/api.log
- backlog = 4096
- workers = 1
- registry_host = 0.0.0.0
- registry_port = 9191
- registry_client_protocol = http
- rabbit_host = localhost
- rabbit_port = 5672
- rabbit_use_ssl = false
- rabbit_userid = guest
- rabbit_password = guest
- rabbit_virtual_host = /
- rabbit_notification_exchange = glance
- rabbit_notification_topic = notifications
- rabbit_durable_queues = False
- qpid_notification_exchange = glance
- qpid_notification_topic = notifications
- qpid_hostname = localhost
- qpid_port = 5672
- qpid_username =
- qpid_password =
- qpid_sasl_mechanisms =
- qpid_reconnect_timeout = 0
- qpid_reconnect_limit = 0
- qpid_reconnect_interval_min = 0
- qpid_reconnect_interval_max = 0
- qpid_reconnect_interval = 0
- qpid_heartbeat = 5
- qpid_protocol = tcp
- qpid_tcp_nodelay = True
- filesystem_store_datadir = /var/lib/glance/images/
- swift_store_auth_version = 2
- swift_store_auth_address = 127.0.0.1:5000/v2.0/
- swift_store_user = jdoe:jdoe
- swift_store_key = a86850deb2742ec3cb41518e26aa2d89
- swift_store_container = glance
- swift_store_create_container_on_put = False
- swift_store_large_object_size = 5120
- swift_store_large_object_chunk_size = 200