How to install Brat annotation tool on Linux machine with SELinux enabled

This is an autoresponder question that describes how to troubleshoot problems when installing the Brat annotation tool , which is used to create annotations for use in NLP, on a regular Linux machine that has SELinux enabled. It is based on version 1.3 of the tool.

The documented installation procedure includes the following steps:

  • Unpack the .tar.gz file in your web server (Apache) directory, usually /var/www/html

    or$HOME/public_html

  • Maybe rename the unzipped directory from brat-v1.3_Crunchy_Frog

    to something simple likebrat

  • Enter the directory and run sudo ./install.sh

  • Start the web server ( sudo service httpd start

    ) if not already started

Problem: When following this procedure, any attempt to use the sibling in the browser (by redirecting it to http://localhost/brat/index.xhtml

fails with the following error messages displayed on the screen:

Error: ActiongetCollectionInformation failed on error Internal Server Error
Error: Actionwhoami failed on error Internal Server Error
Error: ActionloadConf failed on error Internal Server Error

      

The Apache error log (usually found in /var/log/httpd/error_log

) also shows errors:

(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

      

How to solve this problem?

+3


source to share


1 answer


This is caused by SELinux. One way to solve this problem is to disable SELinux, but a somewhat less drastic method is to set permissions as required by brat.

Roots of the problem:

  • brat stores executable scripts (CGI scripts), static files, and annotated data in one directory, directory html

  • SELinux is configured by default to prevent execution of CGI scripts from directories other than CGI. Simply changing the Apache config doesn't help here.
  • SELinux is also configured to prevent CGI scripts from being written to disk

To change your SELinux configuration, you need to grant permissions to specific files and directories as follows (do it from the brat installation directory):



$> 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

      

( $>

represents the command line.)

The first command allows you to read access to the current directory (sometimes this is optional). The second command allows the CGI script to execute all files ending in .cgi

(required). The third command allows write access to the directory work

and data

(also required); it must be used again when you add files or subdirectories to work

or `data.

+4


source







All Articles