These instructions guide the reader through the steps to install a small perl
CGI app which uses CGI::OptimalQuery. These instructions have been tested on
Scientific Linux 7.


Step 1) Install required packages
  sudo yum install libdbi-dbd-sqlite httpd perl-DBD-SQLite


Step 2) create and populate an sqlite database
  ./make_test_data.pl


Step 3) Configure Apache

  # edit an apache virtualhost
  sudo vi /etc/httpd/conf.d/0default.conf

  # add an apache alias to the CGI::OptimalQuery Resources directory
  Alias /OptimalQuery/ /path/to/perl-CGI-OptimalQuery/lib/CGI/OptimalQuery/Resources/

  # add a script alias to view the demos
  ScriptAlias /OptimalQueryDemo/ /path/to/perl-CGI-OptimalQuery/demo/cgi-bin/

  # configure file permissions so apache can access files
  export OQBASEPATH=/path/to/perl-CGI-OptimalQuery
  sudo chgrp -R apache $OQBASEPATH
  sudo chmod -R u=rwX,go=rX $OQBASEPATH
  sudo chmod -R ug+rwx $OQBASEPATH/demo/cgi-bin

  # if SELinux is installed, set file contexts so apache process is not blocked
  # run command: `sestatus` to determine if SELinux is enabled on your system
  sudo chcon -R system_u:object_r:httpd_sys_content_t:s0 $OQBASEPATH/demo/cgi-bin
  sudo chcon -R system_u:object_r:httpd_sys_rw_content_t:s0 $OQBASEPATH/demo/db
  sudo chcon -R system_u:object_r:usr_t:s0 $OQBASEPATH/lib

  # restart apache
  sudo apachectl restart


Step 4) Open your web browser to ..

  http://localhost/OptimalQueryDemo/index.pl
