d3c2e2597a2392c3ce54d4dab0ce902730a03475
[atutor.git] / mods / atutor_opencaps / opencaps / scripts / install.sh
1 #!/bin/sh
2
3 # apache, php5, mysql5
4 echo "============================"
5 echo "==Installing Apache, PHP, and MySql=="
6 echo "============================"
7 sudo apt-get -y update
8 sudo apt-get -y install apache2 php5 curl libcurl3 libcurl3-dev php5-curl mysql-server php5-mysql #user enters mysql password for root
9 sudo /etc/init.d/apache2 restart
10
11 # opencaps
12 echo "============================"
13 echo "==Installing OpenCaps=="
14 echo "============================"
15 echo "Creating database - please enter your mysql root password"
16 mysqladmin create opencaps -u root -p                                   
17 cd /var/www/
18 sudo wget http://opencaps.atrc.utoronto.ca/releases/opencaps.tar.gz
19 sudo tar -xvzf opencaps.tar.gz
20
21 cd opencaps
22 sudo cp install/config_template.php include/config.inc.php
23 sudo chmod 777 conversion_service/imported
24 sudo chmod 777 projects
25 echo "Installing database tables - please enter your mysql root password"
26 sudo mysql opencaps -u root -p  < install/oc_schema.sql         
27 sudo /etc/init.d/mysql start
28
29 # edit opencaps config
30
31 # add mysql info
32 echo "**** Please enter your mysql root password for the OpenCaps configuration file"
33 currentstate=`stty -g`
34 stty -echo
35 read pass
36 stty $currentstate                                                                                      
37 sed -i "s/password/$pass/" include/config.inc.php
38
39 # add matterhorn info
40 MY_IP=`ifconfig | grep "inet addr:" | grep -v 127.0.0.1 | awk '{print $2}' | cut -d':' -f2`
41 sed -i 's/?>/\$remote_systems[0][url]="http:\/\/'${MY_IP}':8080";\n?>/' include/config.inc.php
42 sed -i 's/?>/\$remote_systems[0][name]="Matterhorn";\n?>/' include/config.inc.php
43
44 echo "**** OpenCaps is installed and available at $MY_IP/opencaps"