![由于编码失败,FreeIPA 服务器无法安装](https://linux22.com/image/740657/%E7%94%B1%E4%BA%8E%E7%BC%96%E7%A0%81%E5%A4%B1%E8%B4%A5%EF%BC%8CFreeIPA%20%E6%9C%8D%E5%8A%A1%E5%99%A8%E6%97%A0%E6%B3%95%E5%AE%89%E8%A3%85.png)
我正在尝试在 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 完全有效,因为没有人测试过它。