这是一个自我回答的问题,描述了如何解决安装brat注释工具时出现的问题,该工具用于在启用了SELinux的普通Linux机器上创建用于NLP的注释语料库.这基于该工具的1.3版.
作为安装程序记录包括以下步骤:
/var/www/html或$HOME/public_htmlbrat-v1.3_Crunchy_Frog简单的目录,例如bratsudo ./install.shsudo service httpd start如果尚未运行,请启动Web服务器()问题:在执行此过程时,任何尝试在浏览器中使用brat(通过将其指向http://localhost/brat/index.xhtml失败,并在屏幕上显示以下错误消息:
Error: ActiongetCollectionInformation failed on error Internal Server Error
Error: Actionwhoami failed on error Internal Server Error
Error: ActionloadConf failed on error Internal Server Error
Run Code Online (Sandbox Code Playgroud)
Apache错误日志(通常位于/var/log/httpd/error_log)中也显示错误:
(13)Permission denied: exec of '/var/www/html/new/ajax.cgi' failed, referer: http://localhost/new/index.xhtml
Premature end of script headers: ajax.cgi, referer: http://localhost/new/index.xhtml
Run Code Online (Sandbox Code Playgroud)
如何解决这个问题呢?
这是SELinux 造成的。解决这个问题的一种方法是禁用 SELinux,但另一种不太激进的方法是根据 brat 的要求设置访问权限。
问题的根源是:
html目录要修改 SELinux 配置,您需要授予特定文件和目录的访问权限,如下所示(在 brat 安装目录中执行此操作):
$> chcon -t httpd_sys_content_t .
$> chcon -t httpd_sys_script_exec_t *.cgi
$> sudo chcon -R -t httpd_sys_script_rw_t work data
Run Code Online (Sandbox Code Playgroud)
($>代表命令提示符。)
第一个命令启用对当前目录的读访问(有时可能是不必要的)。第二个命令启用 CGI 脚本执行所有以 结尾的文件.cgi(这是必要的)。第三个命令启用对workanddata目录的写访问(也是必需的);work每当您将文件或子目录添加到“data.txt”或“data.txt”时,都需要再次应用它。