首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何在启用SELinux的Linux计算机上安装brat注释工具

如何在启用SELinux的Linux计算机上安装brat注释工具
EN

Stack Overflow用户
提问于 2013-01-25 09:33:55
回答 2查看 3.7K关注 0票数 8

这是一个自我回答的问题,描述了如何解决在普通Linux机器上安装brat注释工具时出现的问题,该问题用于创建用于NLP的带注释的语料库,该机器启用了SELinux。这是基于1.3版本的工具。

记录在案的安装过程包括以下步骤:

  1. 将.tar.gz文件解压缩到(Apache) web服务器目录中,通常是/var/www/html$HOME/public_html
  2. 可能将解压缩目录从brat-v1.3_Crunchy_Frog重命名为简单的目录,如brat
  3. 输入目录并运行sudo ./install.sh
  4. 如果web服务器(sudo service httpd start)尚未运行,则启动它

问题:在遵循此过程时,在浏览器中使用brat的任何尝试(通过将其定向到http://localhost/brat/index.xhtml )都会失败,屏幕上会显示以下错误消息:

代码语言:javascript
复制
Error: ActiongetCollectionInformation failed on error Internal Server Error
Error: Actionwhoami failed on error Internal Server Error
Error: ActionloadConf failed on error Internal Server Error

Apache日志(通常可以在/var/log/httpd/error_log中找到)还显示了错误:

代码语言:javascript
复制
(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

如何解决这个问题?

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2013-01-25 09:33:55

这是由SELinux引起的。解决这个问题的一种方法是禁用SELinux,但是一种不太激进的方法是根据brat的要求设置访问权限。

问题的根源是:

  1. brat将可执行脚本(CGI脚本)、静态文件以及带注释的数据都保存在同一个目录( html目录)中。
  2. 默认情况下,SELinux被配置为防止从非CGI目录执行CGI脚本.仅仅更改Apache配置在这里是没有帮助的。
  3. SELinux还被配置为防止CGI脚本将数据写入磁盘。

要修改SELinux配置,您需要按如下方式授予特定文件和目录的访问权限(在brat安装目录中这样做):

代码语言:javascript
复制
$> 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

($>表示命令提示符。)

第一个命令允许对当前目录的读访问(有时可能不必要)。第二个命令允许CGI脚本执行以.cgi结尾的所有文件(这是必要的)。第三个命令允许对workdata目录的写访问(也是必要的);每当您向work或` `data添加文件或子目录时,需要再次应用它。

票数 4
EN

Stack Overflow用户

发布于 2018-10-22 10:53:34

我也有同样的问题。能够通过以下更改/etc/apache2/apache2.conf文件来解决这个问题。

代码语言:javascript
复制
<Directory /var/www>
    Options Indexes FollowSymLinks
    #AllowOverride Options Indexes FileInfo
    Require all granted
    AddType application/xhtml+xml .xhtml
    AddType font/ttf .ttf
    # For CGI support
    AddHandler cgi-script .cgi
    # Comment out the line above and uncomment the line below for FastCGI
    #AddHandler fastcgi-script fcgi
</Directory>

<Directory /var/www/html>
    Options Indexes FollowSymLinks
    #AllowOverride Options Indexes FileInfo
    Require all granted
    AddType application/xhtml+xml .xhtml
    AddType font/ttf .ttf
    # For CGI support
    AddHandler cgi-script .cgi
    # Comment out the line above and uncomment the line below for FastCGI
    #AddHandler fastcgi-script fcgi
</Directory>

<Directory /var/www/html/brat>
    Options Indexes FollowSymLinks
    AllowOverride Options Indexes FileInfo
    Require all granted
    AddType application/xhtml+xml .xhtml
    AddType font/ttf .ttf
    # For CGI support
    #AddHandler cgi-script .cgi
    # Comment out the line above and uncomment the line below for FastCGI
    AddHandler fastcgi-script fcgi
    # For FastCGI, Single user installs should be fine with anything over 8
    #FastCgiConfig -maxProcesses 8
</Directory>

参考文献:Brat问题

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14518961

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档