在控制節點上安裝
controllerHost='controller'
ADMIN_PASSWD='Ideal123!'
1.安裝dashboard組件
yum -y install openstack-dashboard
2.配置dashboard允許所有IP訪問
sed -i "/ALLOWED_HOSTS =/c\ALLOWED_HOSTS = ['*']" /etc/openstack-dashboard/local_settings
3.配置dashboard限制API的版本號
sed -i '/^#OPENSTACK_API_VERSIONS/i\OPENSTACK_API_VERSIONS = {"data-processing": 1.1,\
"identity": 3,\
"image": 2,\
"volume": 2,\
"compute": 2}' /etc/openstack-dashboard/local_settings
4.配置dashboard使用memcached緩存session,註釋掉其它的緩存配置
line_index=$(sed -n -e "/^CACHES/=" /etc/openstack-dashboard/local_settings)
sed -i "${line_index},+5d" /etc/openstack-dashboard/local_settings
sed -i "${line_index} a CACHES = {\n'default': {\n'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',\
\n'LOCATION': '${controllerHost}:11211'\n}}" /etc/openstack-dashboard/local_settings
sed -i 's/^SESSION_ENGINE/#&/' /etc/openstack-dashboard/local_settings
echo "SESSION_ENGINE = 'django.contrib.sessions.backends.cache'" >> /etc/openstack-dashboard/local_settings
5.配置dashboard得知keystone服務的地址
sed -i "/OPENSTACK_HOST =/c\OPENSTACK_HOST = '${controllerHost}'" /etc/openstack-dashboard/local_settings
sed -i '/^OPENSTACK_KEYSTONE_URL/c\OPENSTACK_KEYSTONE_URL = "http://%s:5000/v3" % OPENSTACK_HOST' /etc/openstack-dashboard/local_settings
6.配置dashboard啓用對多域的支持,在登陸的時候需要輸入域
sed -i "/OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT =/c\OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT = True" /etc/openstack-dashboard/local_settings
7.配置dashboard中創建的用戶都屬於Default域
sed -i "/OPENSTACK_KEYSTONE_DEFAULT_DOMAIN =/c\OPENSTACK_KEYSTONE_DEFAULT_DOMAIN = 'Default'" /etc/openstack-dashboard/local_settings
8.配置dashboard中創建的用戶都是user角色
sed -i '/OPENSTACK_KEYSTONE_DEFAULT_ROLE =/c\OPENSTACK_KEYSTONE_DEFAULT_ROLE = "user"' /etc/openstack-dashboard/local_settings
9.配置dashboard中的時區
sed -i '/TIME_ZONE =/c\TIME_ZONE = "Asia/Shanghai"' /etc/openstack-dashboard/local_settings
10.配置httpd使用WSGI運行python程序
sed -i '/WSGISocketPrefix/a\WSGIApplicationGroup %{GLOBAL}' /etc/httpd/conf.d/openstack-dashboard.conf
11.配置httpd服務的監聽IP
sed -i "s/Listen 80/Listen 0.0.0.0:80/g" /etc/httpd/conf/httpd.conf
12.啓動dashboard服務
systemctl enable httpd.service memcached.service
systemctl restart httpd.service memcached.service
systemctl status httpd.service memcached.service
dashboard報錯處理
1.登陸頁面,無法跳轉
sed -i 's/^SESSION_ENGINE/#&/' /etc/openstack-dashboard/local_settings
echo "SESSION_ENGINE = 'django.contrib.sessions.backends.file'" >> /etc/openstack-dashboard/local_settings
systemctl restart httpd memcached && systemctl status httpd memcached
2.出錯啦! 遇到異常情況,請刷新
systemctl restart rabbitmq-server && systemctl status rabbitmq-server
3.Bad Request (400)
sed -i "/ALLOWED_HOSTS =/c\ALLOWED_HOSTS = ['*']" /etc/openstack-dashboard/local_settings
systemctl restart httpd memcached && systemctl status httpd memcached