| 20 | {{{ |
| 21 | #!div style="background: #fdd; border: 3px ridge; width: 800px;" |
| 22 | |
| 23 | The original install script pruned to just do Apache 2.2 is: |
| 24 | |
| 25 | {{{ |
| 26 | #!sh |
| 27 | |
| 28 | #!/bin/bash |
| 29 | #---------------------------------------------------------------------- |
| 30 | # Copyright (c) 2012 Raytheon BBN Technologies |
| 31 | # |
| 32 | # Permission is hereby granted, free of charge, to any person obtaining |
| 33 | # a copy of this software and/or hardware specification (the "Work") to |
| 34 | # deal in the Work without restriction, including without limitation the |
| 35 | # rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 36 | # and/or sell copies of the Work, and to permit persons to whom the Work |
| 37 | # is furnished to do so, subject to the following conditions: |
| 38 | # |
| 39 | # The above copyright notice and this permission notice shall be |
| 40 | # included in all copies or substantial portions of the Work. |
| 41 | # |
| 42 | # THE WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 43 | # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 44 | # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 45 | # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
| 46 | # HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 47 | # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 48 | # OUT OF OR IN CONNECTION WITH THE WORK OR THE USE OR OTHER DEALINGS |
| 49 | # IN THE WORK. |
| 50 | #---------------------------------------------------------------------- |
| 51 | |
| 52 | # Usual directory for downloading software in ProtoGENI hosts is `/local` |
| 53 | cd /local |
| 54 | #Get the hostname to see if we are at the server or the client |
| 55 | hn=`echo $HOSTNAME | cut -d'.' -f 1` |
| 56 | |
| 57 | ##### Check if file is there ##### |
| 58 | if [ ! -f "./installed.txt" ] |
| 59 | then |
| 60 | #### Create the file #### |
| 61 | sh -i -c `sudo touch "./installed.txt"` |
| 62 | |
| 63 | #### Run one-time commands #### |
| 64 | |
| 65 | #Install necessary packages |
| 66 | sudo apt-get update |
| 67 | sudo apt-get -y install apache2 iperf & EPID=$! |
| 68 | wait $EPID |
| 69 | |
| 70 | # Install custom software |
| 71 | ## Customize apache installation |
| 72 | |
| 73 | |
| 74 | ## Reboot the host if needed |
| 75 | fi |
| 76 | ##### Run Boot-time commands |
| 77 | # Start services |
| 78 | # If this is the server then start the iperf and configure and start the http server |
| 79 | if [ $hn == "server" ] |
| 80 | then |
| 81 | |
| 82 | # Enable web server stats |
| 83 | sudo /usr/sbin/a2enmod status |
| 84 | sudo rm /etc/apache2/mods-enabled/status.conf |
| 85 | |
| 86 | echo "<Location /server-status>" | sudo tee -a /etc/apache2/sites-available/default > /dev/null |
| 87 | echo " SetHandler server-status" |sudo tee -a /etc/apache2/sites-available/default > /dev/null |
| 88 | echo " Allow from all" | sudo tee -a /etc/apache2/sites-available/default > /dev/null |
| 89 | echo "</Location>" | sudo tee -a /etc/apache2/sites-available/default > /dev/null |
| 90 | echo "ExtendedStatus On" | sudo tee -a /etc/apache2/conf.d/extendedstatus > /dev/null |
| 91 | |
| 92 | # Copy the website under /var/www/ |
| 93 | sudo cp -R ./website/* /var/www/ |
| 94 | sudo rm -rf /var/www/html |
| 95 | sudo ln -s /var/www/ /var/www/html |
| 96 | |
| 97 | # Start the webserver |
| 98 | sudo /usr/sbin/apache2ctl restart |
| 99 | sudo service apache2 restart |
| 100 | |
| 101 | # Start the iperf server |
| 102 | sudo mkdir -p /var/www/iperflogs |
| 103 | iperf_server_log="/var/www/iperflogs/iperf-server.log" |
| 104 | sudo bash -c "iperf -s -i 10 &> $iperf_server_log" |
| 105 | else |
| 106 | # If this is the client start the script for transfers |
| 107 | # Wait 60 seconds just to give some time to the server to come up |
| 108 | sleep 60 |
| 109 | ./scripts/client-wget.sh& |
| 110 | ./scripts/client-iperf.sh& |
| 111 | fi |
| 112 | # Start my service -- assume it was installed at /usr/local/bin |
| 113 | }}} |
| 114 | }}} |
| 115 | |