FreeIPA 伺服器因編碼失敗而無法安裝

FreeIPA 伺服器因編碼失敗而無法安裝

我正在嘗試在 CentOS 7 節點上安裝 FreeIPA 伺服器。從乾淨的圖像開始,我運行以下程式碼(不包括一些不相關的部分):

        echo 'LANG=en_US.utf-8' >> /etc/environment
        echo 'LC_ALL=en_US.utf-8' >> /etc/environment

        yum -y install epel-release npm wget net-tools patch sbt python36u python36u-devel krb5-devel
        yum -y install python36u-pip

        yum install -y ipa-server

        systemctl start named
        systemctl enable named

        ln -s /bin/pip3.6 /bin/pip
        pip install --upgrade pip
        pip install kdcproxy ipaplatform gssapi ipalib

        ipa-server-install -p directoryManagerAdmin -a kerberosAdmin --ip-address=$ipaddress -n test.hadoop.com -r TEST.HADOOP.COM --mkhomedir -U

ipa-server-install 可以正常運作,直到開始嘗試使用 Web API。此時,由於內部伺服器錯誤而失敗。查看 /var/log/httpd/error_log 中的日誌,我發現以下錯誤重複了多次。

[Thu Jul 25 19:26:30.952879 2019] [wsgi:error] [pid 2934] mod_wsgi (pid=2934): Failed to exec Python script file '/usr/share/ipa/wsgi.py'.
[Thu Jul 25 19:26:30.952929 2019] [wsgi:error] [pid 2934] mod_wsgi (pid=2934): Exception occurred processing WSGI script '/usr/share/ipa/wsgi.py'.
[Thu Jul 25 19:26:30.953372 2019] [wsgi:error] [pid 2934] Traceback (most recent call last):
[Thu Jul 25 19:26:30.953402 2019] [wsgi:error] [pid 2934]   File "/usr/share/ipa/wsgi.py", line 48, in <module>
[Thu Jul 25 19:26:30.953406 2019] [wsgi:error] [pid 2934]     api.bootstrap(context='server', confdir=paths.ETC_IPA, log=None)
[Thu Jul 25 19:26:30.953414 2019] [wsgi:error] [pid 2934]   File "/lib/python3.6/site-packages/ipalib/plugable.py", line 494, in bootstrap
[Thu Jul 25 19:26:30.953417 2019] [wsgi:error] [pid 2934]     raise errors.SystemEncodingError(encoding=fse)
[Thu Jul 25 19:26:30.953432 2019] [wsgi:error] [pid 2934] ipalib.errors.SystemEncodingError: System encoding must be UTF-8, 'ascii' is not supported. Set LC_ALL="C.UTF-8", or LC_ALL="" and LC_CTYPE="C.UTF-8".

我已經嘗試設定 LC_ALL 和 LANG (如腳本中所示),但它仍然出現。我需要做什麼來解決這個問題,以便伺服器的 Web API 能夠正常運作?

編輯:根據 @abbra @michael-hampton 的建議,我恢復了對 Python 問題的修復。請參閱下面我正在運行的一組新命令,以及我在 httpd/error_log 中看到的錯誤之一。請注意,我發現其他軟體包也丟失了,但它們都很相似。

        yum -y install epel-release npm wget net-tools patch sbt krb5-devel

        yum install -y ipa-server

        systemctl start named
        systemctl enable named

/var/log/httpd/error_log 中的輸出:

[Fri Jul 26 14:20:03.334411 2019] [wsgi:error] [pid 2894] mod_wsgi (pid=2894): Failed to exec Python script file '/usr/share/ipa/wsgi.py'.
[Fri Jul 26 14:20:03.334456 2019] [wsgi:error] [pid 2894] mod_wsgi (pid=2894): Exception occurred processing WSGI script '/usr/share/ipa/wsgi.py'.
[Fri Jul 26 14:20:03.334675 2019] [wsgi:error] [pid 2894] Traceback (most recent call last):
[Fri Jul 26 14:20:03.334697 2019] [wsgi:error] [pid 2894]   File "/usr/share/ipa/wsgi.py", line 43, in <module>
[Fri Jul 26 14:20:03.334701 2019] [wsgi:error] [pid 2894]     from ipaplatform.paths import paths
[Fri Jul 26 14:20:03.334716 2019] [wsgi:error] [pid 2894] ModuleNotFoundError: No module named 'ipaplatform'

答案1

您可能已啟用 IUS 儲存庫。他們提供了覆蓋和擴展標準 CentOS 構建的軟體包。因此,它們使(在這種特殊情況下)您的系統與 IPA 伺服器包的要求不相容。如果您刪除 python36u-mod_wsgi,則會選擇原始版本(基於 python2)。

我不保證此配置(CentOS + IUS 軟體包)適用於 FreeIPA,因為沒有人測試過它。

相關內容