CentOS6.2下一步一步源代码安装OpenStack(六)horizon配置、运行、测试

长平狐 发布于 2012/08/24 09:59
阅读 2K+
收藏 1

更新:5月4日;添加noVNC的配置

1配置

1.1创建配置文件:
[ugyn@cc ~]$ vim install/horizon-2012.1/openstack_dashboard/local/local_settings.py
http://docs.openstack.org/trunk/openstack-compute/install/content/local-settings-py-file.html示例配置文件拷入其中,修改数据库信息,在USE_SSL = False下添加一行:
SECRET_KEY = 'elj1IWiLoWHgcyYxVLj7cMrGOxWl0'随意修改部分字符即可。
将该文件拷贝一份到horizon安装目录:
[ugyn@cc ~]$ sudo cp install/horizon-2012.1/openstack_dashboard/local/local_settings.py /usr/lib/python2.6/site-packages/horizon-2012.1-py2.6.
egg/openstack_dashboard/local/local_settings.py

1.2为httpd创建horizon配置文件
[ugyn@cc ~]$ sudo vim /etc/httpd/conf.d/horizon.conf
内容如下:

<VirtualHost *:80>
    WSGIScriptAlias / /usr/lib/python2.6/site-packages/horizon-2012.1-py2.6.egg/openstack_dashboard/wsgi/django.wsgi
    WSGIDaemonProcess horizon user=apache group=apache processes=3 threads=10 home=/usr/lib/python2.6/site-packages/horizon-2012.1-py2.6.egg

    SetEnv APACHE_RUN_USER apache
    SetEnv APACHE_RUN_GROUP apache
    WSGIProcessGroup horizon

    DocumentRoot /usr/lib/python2.6/site-packages/horizon-2012.1-py2.6.egg/.blackhole/
    Alias /media /usr/lib/python2.6/site-packages/horizon-2012.1-py2.6.egg/openstack_dashboard/static

    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>

    <Directory /usr/lib/python2.6/site-packages/horizon-2012.1-py2.6.egg/>
        Options Indexes FollowSymLinks MultiViews
        AllowOverride None
        Order allow,deny
        allow from all
    </Directory>

    ErrorLog /var/log/httpd/horizon_error.log
    LogLevel warn
    CustomLog /var/log/httpd/horizon_access.log combined
</VirtualHost>

WSGISocketPrefix /var/run/httpd

创建目录:mkdir /usr/lib/python2.6/site-packages/horizon-2012.1-py2.6.egg/.blackhole

1.3初始化数据库:
[ugyn@cc ~]$ install/horizon-2012.1/manage.py syncdb
DEBUG:openstack_dashboard.settings:Running in debug mode without debug_toolbar.
/usr/lib/python2.6/site-packages/django/conf/__init__.py:75: DeprecationWarning: The ADMIN_MEDIA_PREFIX setting has been removed; use STATIC_URL instead.
  "use STATIC_URL instead.", DeprecationWarning)
/usr/lib/python2.6/site-packages/django/conf/__init__.py:110: DeprecationWarning: The SECRET_KEY setting must not be empty.
  warnings.warn("The SECRET_KEY setting must not be empty.", DeprecationWarning)
/usr/lib/python2.6/site-packages/django/utils/translation/__init__.py:63: DeprecationWarning: Translations in the project directory aren't supported anymore. Use the LOCALE_PATHS setting instead.
  DeprecationWarning)
/usr/lib/python2.6/site-packages/django/core/cache/__init__.py:82: DeprecationWarning: settings.CACHE_* is deprecated; use settings.CACHES instead.
  DeprecationWarning
/usr/lib/python2.6/site-packages/nose/plugins/manager.py:405: UserWarning: Module wsgiref was already imported from /usr/lib64/python2.6/wsgiref/__init__.pyc, but /usr/lib/python2.6/site-packages is being added to sys.path
  import pkg_resources
DEBUG:nose.plugins.manager:DefaultPluginManager load plugin xcover = nosexcover:XCoverage
DEBUG:django.db.backends:(0.000) SHOW TABLES; args=()
Creating tables ...
Creating table django_session
DEBUG:django.db.backends:(0.096) CREATE TABLE `django_session` (
    `session_key` varchar(40) NOT NULL PRIMARY KEY,
    `session_data` longtext NOT NULL,
    `expire_date` datetime NOT NULL
)
;; args=()
Installing custom SQL ...
Installing indexes ...
DEBUG:django.db.backends:(0.176) CREATE INDEX `django_session_c25c2c28` ON `django_session` (`expire_date`);; args=()
DEBUG:django.db.backends:(0.000) SET foreign_key_checks=0; args=()
DEBUG:django.db.backends:(0.000) SET foreign_key_checks=1; args=()
Installed 0 object(s) from 0 fixture(s)

2运行


重启httpd
[ugyn@cc ~]$ sudo service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd: Warning: DocumentRoot [/usr/lib/python2.6/site-packages/horizon-2012.1-py2.6.egg/.blackhole/] does not exist
httpd: apr_sockaddr_info_get() failed for cc.sigsit.org
httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1 for ServerName
                                                           [  OK  ]
关闭nova-api并重新运行

3测试

登录界面:

镜像列表:


创建实例:

4配置noVNC

参考文档:http://docs.openstack.org/trunk/openstack-compute/install/content/ch_install-dashboard.html

4.1配置
vnc的配置在nova.conf文件中,在文件的后面已经添加了以下内容:
# NOVNC CONSOLE
novncproxy_base_url=http://10.61.2.88:6080/vnc_auto.html
xvpvncproxy_base_url=http://10.61.2.88:6081/console
vncserver_proxyclient_address=10.61.2.88
vncserver_listen=10.61.2.88

这里vncserver_listen的值在计算节点上时应配置成计算节点的ip,不然会报错libvirtError: operation failed: failed to retrieve chardev info in qemu with 'info chardev'而无法启动实例。

4.2启动nova-consoleauth
noVNC要通过nova-consoleauth来进行token的验证,且nova-all不启动nova-consoleauth,因此我们得另外启动nova-consoleauth

4.3安装noVNC代理
essex版不包含nova-novncproxy,我们得自己下载安装
地址:https://github.com/cloudbuilders/noVNC
解压至:/var/lib/noVNC
请确定已经安装了numpy,如果没有请运行:
sudo yum --enablerepo=iso --disablerepo=base,updates,extras install numpy
进入目录:/var/lib/noVNC
运行:utils/nova-novncproxy --flagfile=/etc/nova/nova.conf

 这里一定要进行目录/var/lib/noVNC,运行时会当前目录做为根目录,否则路径就不对了


这样就可以了,但在 我这里的运行结果并不理想,有时候就只有一个黑框看不到东西,有时能看到内容,但无法鼠标,键盘输入。

北方工业大学 | 云计算研究中心 | 姜永


原文链接:http://blog.csdn.net/ugyn109/article/details/7487537
加载中
返回顶部
顶部