`

编译安装openstack mitaka horizon

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

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

    前提条件:要有一台和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下载
https://releases.openstack.org/mitaka/index.html#mitaka-horizon
引用
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


这里下载最新的版本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

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

重启服务器
systemctl restart httpd.service


访问控制面板即可

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics