安装horizon

在控制节点上安装


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

posted @ 2019-07-18 12:57  小白的日常  阅读(576)  评论(0编辑  收藏  举报