diff --git a/docs/config/apache2-site b/docs/config/apache2-site index 5c23c6d1649..429153d2b6c 100644 --- a/docs/config/apache2-site +++ b/docs/config/apache2-site @@ -2,32 +2,33 @@ # change from 80 to 443 if you enable SSL ServerAdmin webmaster@localhost - DocumentRoot /path/to/project/base/www/lorisdb/htdocs/ + DocumentRoot %LORISROOT%htdocs/ Options FollowSymLinks AllowOverride None - + Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all - php_value include_path .:/usr/share/php:/usr/share/pear:/path/to/lorisdb/php/libraries:/path/to/jpgraph/src + php_value include_path .:/usr/share/php:/usr/share/pear:%LORISROOT%project/libraries:%LORISROOT%php/libraries - ErrorLog /var/log/apache2/PROJECTNAME-error.log + ErrorLog /var/log/apache2/%PROJECTNAME%-error.log # Possible values include: debug, info, notice, warn, error, crit, # alert, emerg. LogLevel warn - CustomLog /var/log/apache2/PROJECTNAME-access.log combined + CustomLog /var/log/apache2/%PROJECTNAME%-access.log combined ServerSignature Off -SSLEngine Off # change to On to enable, after updating cert paths below -SSLCertificateFile /etc/apache2/ssl/PROJECT-cert.pem -SSLCertificateKeyFile /etc/apache2/ssl/PROJECT-key.pem -SSLCACertificateFile /etc/apache2/ssl/CA-cacert.pem + #SSLEngine Off # change to On to enable, after updating cert paths below + + #SSLCertificateFile /etc/apache2/ssl/%PROJECTNAME%-cert.pem + #SSLCertificateKeyFile /etc/apache2/ssl/%PROJECTNAME%-key.pem + #SSLCACertificateFile /etc/apache2/ssl/CA-cacert.pem diff --git a/docs/config/config.xml b/docs/config/config.xml index 47ed65f81b3..d782091e44c 100644 --- a/docs/config/config.xml +++ b/docs/config/config.xml @@ -14,19 +14,19 @@ /PATH/TO/MINC/DATA/ROOT/mri-data/minc/ - /PATH/TO/lorisdb/ + %LORISROOT% SAME AS imagePath /PATH/TO/SMARTY/libs - HOSTNAME - USERNAME - PASSWORD - DATABASE - USErNAME - PASSWORD + %HOSTNAME% + %USERNAME% + %PASSWORD% + %DATABASE% + %USERNAME% + %PASSWORD% Example database @@ -40,7 +40,6 @@ DICOM Archive MRI Browser Data Query GUI - Database statistics @@ -128,32 +127,15 @@ - - 1 - 200 - - - - - main.css + main.css 25 0 - 0 - 0 + 0 + 0 - - - - - - - - - - @@ -172,26 +154,6 @@ 1 - - timepoint_flag - - all - - timepoint_flag - timepoint_flag_evaluate - - 0 - - - mri_safety - - all - - data_entry - mri_safety - - 0 - user_accounts @@ -201,25 +163,6 @@ 1 - - tracking_logs - - all - - tracking_logs - - 0 - - - certification - - all - - certification - certification_multisite - - 0 - diff --git a/tools/install.sh b/tools/install.sh new file mode 100755 index 00000000000..334997e18b0 --- /dev/null +++ b/tools/install.sh @@ -0,0 +1,108 @@ +#!/bin/sh +# This will: +# 1. Install PEAR libraries +# 2. Set up +# This will only install the database components and Loris config file. +# It will not affect any system + +CWD=`pwd`; + +if [ ! -f ../SQL/0000-00-00-schema.sql ]; then + echo "Could not find schema file"; + exit 1; +fi +if [ ! -d ../project ]; then + mkdir ../project +fi +if [ -f ../project/config.xml ]; then + echo "Loris appears to already be installed. Aborting." + exit 1; +fi + + +read -p "What is the database name? " mysqldb +read -p "Database host? " mysqlhost +read -p "What MySQL user will Loris connect as? " mysqluser +read -p "What MySQL is $mysqluser's password? " mysqlpass + +echo "exit" | mysql $mysqldb -h$mysqlhost -u$mysqluser -p$mysqlpass -A > /dev/null 2>&1 + +MySQLError=$?; + +if [ $MySQLError -eq 0 ]; then + RootDir=`dirname $CWD`; + echo "Creating config file" + sed -e "s/%HOSTNAME%/$mysqlhost/g" -e "s/%USERNAME%/$mysqluser/g" -e "s/%PASSWORD%/$mysqlpass/g" -e "s/%DATABASE%/$mysqldb/g" -e "s#%LORISROOT%#$RootDir/#g" ../docs/config/config.xml > ../project/config.xml + + if [ ! -d $RootDir/php/smarty/templates_c ]; then + echo "Creating templates_c" + mkdir $RootDir/php/smarty/templates_c + fi + echo "Fixing permissions on template_c" + chmod 777 $RootDir/php/smarty/templates_c/ + + echo "Creating database tables" + mysql $mysqldb -h$mysqlhost -u$mysqluser -p$mysqlpass -A >> logs/install-`date +%Y-%m-%d`.log 2>&1 < ../SQL/0000-00-00-schema.sql + read -p "Enter SiteMin user's password (will be echoed to screen, and prompted to reset on login): " lorispass + echo "Updating SiteMin password " + mysql $mysqldb -h$mysqlhost -u$mysqluser -p$mysqlpass -A -e "UPDATE users SET Password_MD5=CONCAT('aa', MD5('aa$lorispass')) WHERE ID=1" + + while true; do + read -p "Would you like to install PEAR libraries (affects system files)? [yn] " yn + case $yn in + [Yy]* ) + echo "Installing PEAR libraries (may prompt for sudo password)" + sudo pear upgrade-all >> logs/install-`date +%Y-%m-%d`.log 2>&1 + sudo pear install Benchmark >> logs/install-`date +%Y-%m-%d`.log 2>&1 + sudo pear install Config >> logs/install-`date +%Y-%m-%d`.log 2>&1 + sudo pear install File_Archive >> logs/install-`date +%Y-%m-%d`.log 2>&1 + sudo pear install HTML_Common >> logs/install-`date +%Y-%m-%d`.log 2>&1 + sudo pear install HTML_QuickForm >> logs/install-`date +%Y-%m-%d`.log 2>&1 + sudo pear config-set preferred_state beta >> logs/install-`date +%Y-%m-%d`.log 2>&1 + sudo pear install HTML_QuickForm2 >> logs/install-`date +%Y-%m-%d`.log 2>&1 + sudo pear install Mail >> logs/install-`date +%Y-%m-%d`.log 2>&1 + sudo pear install Mail_Mime >> logs/install-`date +%Y-%m-%d`.log 2>&1 + sudo pear install Net_SMTP >> logs/install-`date +%Y-%m-%d`.log 2>&1 + sudo pear install Net_Socket >> logs/install-`date +%Y-%m-%d`.log 2>&1 + sudo pear install OLE >> logs/install-`date +%Y-%m-%d`.log 2>&1 + sudo pear install Pager >> logs/install-`date +%Y-%m-%d`.log 2>&1 + sudo pear install PhpDocumentor >> logs/install-`date +%Y-%m-%d`.log 2>&1 + sudo pear install Spreadsheet_Excel_Writer >> logs/install-`date +%Y-%m-%d`.log 2>&1 + sudo pear install Structures_Graph >> logs/install-`date +%Y-%m-%d`.log 2>&1 + sudo pear install XML_Parser >> logs/install-`date +%Y-%m-%d`.log 2>&1 + break;; + [Nn]* ) + echo "Not installing PEAR libraries" + break;; + * ) echo "Please enter y or n" + esac + done; + while true; do + read -p "Would you like to automatically create/install apache config files? [yn] " yn + case $yn in + [Yy]* ) + read -p "Enter project name (no spaces): " projectname + if [ -f /etc/apache2/sites-available/$projectname ]; then + echo "Apache appears to already be configured for $projectname. Aborting\n" + exit 1 + fi; + + # Need to pipe to sudo tee because > is done as the logged in user, even if run through sudo + sed -e "s#%LORISROOT%#$RootDir/#g" -e "s#%PROJECTNAME%#$projectname#g" ../docs/config/apache2-site | sudo tee /etc/apache2/sites-available/$projectname > /dev/null + #sudo a2dissite default + #sudo a2ensite $projectname + break;; + [Nn]* ) + echo "Not configuring apache" + break;; + * ) echo "Please enter y or n" + esac + done; + + + echo "Installation complete." + echo "Must updated cli/php.ini if any command line scripts are to be used." +else + echo "Could not connect to database with user provided"; + exit 1; +fi;