OpenStack学习系列之七:安装部署仪表板Dashboard
Dashboard是openstack中提供的一个web前端控制台,以此来展示openstack的功能。Dashboard是一个基于Django Web Framework开发的标准的Python WSGI程序。
仪表板Dashboard(控制节点node1安装)
# 安装Dashboard
yum --enablerepo powertools install -y openstack-dashboard
---------------------------------------------# 配置
crudini --set /etc/openstack-dashboard/local_settings '' OPENSTACK_HOST '"node1"'
crudini --set /etc/openstack-dashboard/local_settings '' ALLOWED_HOSTS "['*', ]"
crudini --set /etc/openstack-dashboard/local_settings '' SESSION_ENGINE "'django.contrib.sessions.backends.cache'"
crudini --set /etc/openstack-dashboard/local_settings '' CACHES "{
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': 'node1:11211',
}
}"
crudini --set /etc/openstack-dashboard/local_settings '' OPENSTACK_KEYSTONE_URL '"http://%s:5000/identity/v3" % OPENSTACK_HOST'
crudini --set /etc/openstack-dashboard/local_settings '' OPENSTACK_KEYSTONE_MULTIDOMAIN_SUPPORT True
crudini --set /etc/openstack-dashboard/local_settings '' OPENSTACK_API_VERSIONS '{
"identity": 3,
"image": 2,
"volume": 3,
}'
crudini --set /etc/openstack-dashboard/local_settings '' OPENSTACK_KEYSTONE_DEFAULT_DOMAIN '"Default"'
crudini --set /etc/openstack-dashboard/local_settings '' OPENSTACK_KEYSTONE_DEFAULT_ROLE '"admin"'
# 单独配置,也可以不配置,这里是显示菜单,改为False则不显示,如果发现有些菜单不显示则可能是这里配置成False
OPENSTACK_NEUTRON_NETWORK = {
...
'enable_router': False,
'enable_quotas': False,
'enable_distributed_router': False,
'enable_ha_router': False,
'enable_lb': False,
'enable_firewall': False,
'enable_vpn': False,
'enable_fip_topology_check': False,
}
crudini --set /etc/openstack-dashboard/local_settings '' TIME_ZONE '"Asia/Shanghai"'
---------------------------------------------
crudini --set /etc/httpd/conf.d/openstack-dashboard.conf '' WSGIApplicationGroup %{GLOBAL}
---------------------------------------------# 重启服务
cd /usr/share/openstack-dashboard
python3 manage.py make_web_conf --apache > /etc/httpd/conf.d/openstack-dashboard.conf
ln -s /etc/openstack-dashboard /usr/share/openstack-dashboard/openstack_dashboard/conf
# 修改配置,最后一行添加
vi /etc/openstack-dashboard/local_settings # 最后一样添加如下内容
WEBROOT = '/dashboard/'
# 修改配置,将对应内容改成如下所示
vi /etc/httpd/conf.d/openstack-dashboard.conf
#WSGIScriptAlias / /usr/share/openstack-dashboard/openstack_dashboard/wsgi.py
WSGIScriptAlias /dashboard /usr/share/openstack-dashboard/openstack_dashboard/wsgi/django.wsgi
#Alias /static /usr/share/openstack-dashboard/static
Alias /dashboard/static /usr/share/openstack-dashboard/static
systemctl restart httpd.service memcached.service
浏览器登录验证
浏览器输入node1的IP地址http://192.168.31.101/dashboard,或者本地做主机名解析后输入http://node1/dashboard
输入域为default,用户名密码为admin/openstack,
登录之后Dashboard的概况页面