Python

OpsCenter 5.1.2 在 CentOS 5 上啟用 SSL 時無法啟動

  • May 29, 2015

這也適用於 OpsCenter 5.1.0 和 5.1.1。

嘗試在 CentOS 5 伺服器上執行 OpsCenter 5.1.2 時出現以下錯誤:

Unhandled Error
Traceback (most recent call last):
File "/usr/share/opscenter/lib/py-redhat/2.6/shared/amd64/twisted/scripts/_twistd_unix.py", line 317, in startApplication
app.startApplication(application, not self.config['no_save'])
File "/usr/share/opscenter/lib/py-redhat/2.6/shared/amd64/twisted/application/app.py", line 653, in startApplication
service.IService(application).startService()
File "/usr/share/opscenter/lib/py-redhat/2.6/shared/amd64/twisted/application/service.py", line 277, in startService
service.startService()
File "/usr/share/opscenter/lib/py-redhat/2.6/shared/amd64/twisted/internet/defer.py", line 1141, in unwindGenerator
return _inlineCallbacks(None, f(*args, **kwargs), Deferred())
--- <exception caught here> ---
File "/usr/share/opscenter/lib/py-redhat/2.6/shared/amd64/twisted/internet/defer.py", line 1020, in _inlineCallbacks
result = g.send(result)
File "/usr/lib/python2.6/site-packages/opscenterd/OpsCenterdService.py", line 45, in startService
File "/usr/lib/python2.6/site-packages/opscenterd/OpsCenterdService.py", line 101, in setupWebServer
File "/usr/lib/python2.6/site-packages/opscenterd/WebServer.py", line 120, in makeWebServer
File "/usr/lib/python2.6/site-packages/opscenterd/SslUtils.py", line 2, in <module>
exceptions.ImportError: No module named OpenSSL

python26 是從 EPEL 安裝的。這是來自 Datastax 的 OpsCenter。SSL 支持在 OpsCenter 5.0.x 中執行良好。

pyOpenSSL 不包含在 EPEL 的 python26 中。它必須手動安裝。幸運的是,這可以通過 easy_install python 模組(包含在 setuptools 中)輕鬆完成,但需要先手動安裝。

安裝建構 pyOpenSSL 和 setuptools 所需的軟體包:

yum install gcc gcc-c++ libffi-devel openssl-devel

下載並安裝 setuptools:

cd /usr/local/src/
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-16.0.tar.gz
tar zxf setuptools-16.0.tar.gz
cd setuptools-16.0
python26 setup.py install

注意:最好檢查是否有新版本的 setuptools 可用。

安裝 pyOpenSSL:

python26 -m easy_install pyOpenSSL

確保您使用的python26命令不僅僅是python,因為 CentOS 5 安裝了 Python 2.4。

OpsCenter 的 SSL 支持現在應該可以工作了。

引用自:https://serverfault.com/questions/695163