系统:CentOS-8.2.2004 平台:x86-64
采用编译安装,源代码获取
git clone https://github.com/kimchi-project/wok.git源代码从github签出速度比较慢,可以使用国内镜像加速,使用国内镜像加速方法见Github国内mirror加速,加速镜像见GitHub 加速镜像
wok编译需要automake、gcc 、make 等依赖
dnf install automake gcc make libtool libxslt gettext-devel pip3 install pyflakes pyyaml解决方法:缺少automake工具
dnf install automake 报错信息如下 checking for gcc... no checking for cc... no checking for cl.exe... no configure: error: no acceptable C compiler found in $PATH解决办法:缺少gcc
dnf install gcc 报错信息如下 configure.ac:59: error: required file 'build-aux/compile' not found configure.ac:59: 'automake --add-missing' can install 'compile' configure.ac:59: error: required file 'build-aux/config.guess' not found configure.ac:59: 'automake --add-missing' can install 'config.guess' configure.ac:59: error: required file 'build-aux/config.sub' not found configure.ac:59: 'automake --add-missing' can install 'config.sub'解决办法:
## 可能需要多执行几次此命令 automake --add-missing 报错信息如下 checking whether make sets $(MAKE)... no解决办法:缺少make
dnf install make 报错信息如下 checking for pyflakes... no configure: WARNING: pyflakes not found解决办法:
pip3 install pyflakes 报错信息如下 ModuleNotFoundError: No module named 'yaml'解决办法:
pip3 install pyyaml 报错信息如下 xsltproc: Command not found解决办法:
dnf install libxslt解决办法:
pip3 install cherrypy 报错信息如下 ModuleNotFoundError: No module named 'ldap'解决办法:安装过程中出现报错,处理办法见 python常见错误处理[CentOS8系统](pip安装应用)
pip3 install python-ldap 报错信息如下 Traceback (most recent call last): File "/usr/lib/python3.6/site-packages/wok/auth.py", line 34, in <module> import PAM ModuleNotFoundError: No module named 'PAM' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/bin/wokd", line 30, in <module> import wok.server File "/usr/lib/python3.6/site-packages/wok/server.py", line 28, in <module> from wok import auth File "/usr/lib/python3.6/site-packages/wok/auth.py", line 36, in <module> import pam as PAM ModuleNotFoundError: No module named 'pam'解决办法:
pip3 install python-pam 报错信息如下 ModuleNotFoundError: No module named 'Cheetah'解决办法:
pip3 install Cheetah3 报错信息如下 ModuleNotFoundError: No module named 'lxml'解决办法:
pip3 install lxml 报错信息如下 ModuleNotFoundError: No module named 'psutil'解决办法:
pip3 install psutil 报错信息如下 ModuleNotFoundError: No module named 'websockify'解决办法:注意:kimchi使用最新版websockify时存在问题
pip3 install websockify==0.7.0 报错信息如下 ModuleNotFoundError: No module named 'jsonschema'解决办法:
pip3 install jsonschema 报错信息如下 rc: 4 error: Redirecting to /bin/systemctl status nginx.service Unit nginx.service could not be found. returned from cmd: service nginx status Redirecting to /bin/systemctl start nginx.service Failed to start nginx.service: Unit nginx.service not found.解决办法:
dnf install nginx 报错信息如下 ModuleNotFoundError: No module named 'OpenSSL'解决办法:
pip3 install pyOpenSSL执行systemctl status nginx.service后,显示报错信息如下
Oct 23 21:57:03 kimchi nginx[63332]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok Oct 23 21:57:03 kimchi nginx[63332]: nginx: [emerg] bind() to 0.0.0.0:8001 failed (13: Permission denied) Oct 23 21:57:03 kimchi nginx[63332]: nginx: configuration file /etc/nginx/nginx.conf test failed执行tail -100f /var/log/nginx/error.log命令查看日志错误信息,显示错误信息如下
63706#0: bind() to 0.0.0.0:8001 failed (13: Permission denied)解决办法:问题的产生原因是 SELinux 基于最小权限原则默认拦截了 Nginx 的请求,可以通过关闭SELinux解决
# 临时关闭 SELinux setenforce 0 # 临时启动 SELinux:setenforce 1 # 永久关闭/启动:修改/etc/sysconfig/selinux后重启系统 vim /etc/sysconfig/selinux # 将“SELINUX=enforcing“改成“SELINUX=desabled”在http {}属性中添加以下内容
# wok include /etc/nginx/conf.d/*.conf; 当使用asdf安装python时,则需要重写启动脚本 编辑/usr/bin/wokd-wrapper文件 vim /usr/bin/wokd-wrapper添加以下内容
#!/bin/bash . /root/.asdf/asdf.sh asdf local python 3.6.12 /root/.asdf/shims/python /bin/wokd编辑/usr/lib/systemd/system/wokd.service文件
vim /usr/lib/systemd/system/wokd.service将以下内容覆盖原文件
[Unit] Description=Wok - Webserver Originated from Kimchi Documentation=https://github.com/kimchi-project/wok/wiki Wants=nginx.service After=nginx.service Wants=apache2.service After=apache2.service [Service] Type=simple User=root ExecStart=/usr/bin/wokd-wrapper ExecStop=/usr/bin/pkill -s $MAINPID EnvironmentFile=/etc/wok/wok.conf KillMode=process [Install] WantedBy=multi-user.target