编译安装openstack mitaka horizon

本文提供了解决OpenStack Mitaka版本Dashboard中Securitygroupnotfoundforproject问题的方法,包括搭建开发环境、编译Horizon及配置步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

由于openstack的rpm包版本过低,有BUG只能自己手动编译安装新版本的horizon。

具体什么bug请看[url=http://powertech.iteye.com/blog/2363303]openstack mitaka版dashboard的BUG Security group not found for project [/url],如查你也碰到这样的问题,先恭喜你,已经有解决办法了。我在这个问题上已经排查了三周,你就不需要花三周时间了。

前提条件:要有一台和controller一样操作系统的另一台服务器,否则编译时需要下载依赖包,会损坏已配好的系统。

1、添加stack开发用户

sudo adduser stack

sudo tee <<<"stack ALL=(ALL) NOPASSWD: ALL" /etc/sudoers

groupadd stack
useradd -g stack -m stack

sudo su - stack


2、下载devstack,openstack的开发环境

git clone https://git.openstack.org/cgit/openstack-dev/devstack

git branch -a

*master
remotes/origin/HEAD -> origin/master
remotes/origin/master
remotes/origin/stable/kilo
remotes/origin/stable/liberty
remotes/origin/stable/mitaka
remotes/origin/stable/newton
remotes/origin/stable/ocata

//切换到自己用的版本
git checkout -b stable/mitaka



在devstack根目录,添加一个配置文件local.conf

[[local|localrc]]
ADMIN_PASSWORD=secret
DATABASE_PASSWORD=$ADMIN_PASSWORD
RABBIT_PASSWORD=$ADMIN_PASSWORD
SERVICE_PASSWORD=$ADMIN_PASSWORD


初始化开发环境,需要下载和安装比较多的包,时间稍常,只需等待

./stack.sh


3、下载horizon的源码,并进行编译和配置

git clone git://git.openstack.org/openstack/horizon

git branch -a

#切换到对应版本
git checkout stable/mitaka


sudo pip install -c http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/mitaka .

cp openstack_dashboard/local/local_settings.py.example openstack_dashboard/local/local_settings.py

sudo ./run_tests.sh --compilemessages
sudo ./manage.py collectstatic
sudo ./manage.py compress --force



或者手动下载打好的版本的包,不通过git下载
[url]https://releases.openstack.org/mitaka/index.html#mitaka-horizon[/url]
[quote]9.1.2 openstack/horizon ce80bb6fec3cb0262728e7ae8b9d695cf832e5bf
9.1.1 openstack/horizon 9a460aad76c05c411765af2b2d85b075a5f7004e
9.1.0 openstack/horizon 8211d685afed20469b5bfd53c008e4bc98e7047a
9.0.1 openstack/horizon f4b9e17315c69749e6e84a518b385b3698d5ab0e
9.0.0 openstack/horizon 2eb320bd31078e3728b91e4badc597624d0827f8[/quote]

这里下载最新的版本9.1.2,下载后,可以解压源码,执行以下操作
sudo pip install -c http://git.openstack.org/cgit/openstack/requirements/plain/upper-constraints.txt?h=stable/mitaka .

cp openstack_dashboard/local/local_settings.py.example openstack_dashboard/local/local_settings.py

sudo ./run_tests.sh --compilemessages
sudo ./manage.py collectstatic
sudo ./manage.py compress --force



打包后发到controller所在的服务器上
tar czvf horizon.tar.gz horizon/ --exclude .git



4、controller服务器上配置新版horizon,前题是你已经在该台服务器上通过命令安装过dashboard,
yum install openstack-dashboard


解压源文件
tar zxvf horizon.tar.gz


给httpd服务增加horizon.conf配置文件

#备份原文件
cp /etc/httpd/conf.d/openstack-dashboard.conf /etc/httpd/conf.d/openstack-dashboard.conf.bak

mv /etc/httpd/conf.d/openstack-dashboard.conf /etc/httpd/conf.d/horizon.conf


horizon.conf文件内容

WSGIDaemonProcess dashboard
WSGIProcessGroup dashboard
WSGISocketPrefix run/wsgi

WSGIScriptAlias /dashboard /opt/horizon/openstack_dashboard/wsgi/django.wsgi
Alias /dashboard/static /opt/horizon/static

<Directory /opt/horizon/openstack_dashboard/wsgi>
Options All
AllowOverride All
Require all granted
</Directory>

<Directory /opt/horizon/static>
Options All
AllowOverride All
Require all granted
</Directory>



在/opt/horizon目录下执行,否则会找不到所有样式文件

sudo ./manage.py collectstatic
sudo ./manage.py compress --force



修改/opt/horizon目录权限和修改lo

chmod -Rv 775 /opt/horizon


按官方文档添加和修改local_settings.py配置文件
cp /opt/horizon/openstack_dashboard/local/local_settings.py.example /opt/horizon/openstack_dashboard/local/local_settings.py

配置文档
[url]https://docs.openstack.org/mitaka/install-guide-rdo/horizon-install.html[/url]

重启服务器

systemctl restart httpd.service


访问控制面板即可
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值