heartranked

git clone https://git.tarina.org/heartranked
Log | Files | Refs

apache2install.sh (2073B)


      1 #!/bin/bash
      2 
      3 ROOT_UID=0   # Root has $UID 0.
      4 
      5 if [ "$UID" -eq "$ROOT_UID" ]
      6 then
      7    echo "OK"
      8 else
      9     echo "Run with sudo!"
     10     echo "sudo ./install.sh"
     11     exit 0
     12 fi
     13 
     14 echo "Hurray! du e sudo user!"
     15 cat <<'EOF'
     16 
     17       .__---~~~(~~-_.
     18    _-'  ) -~~- ) _-" )_
     19   (  ( `-,_..`.,_--_ '_,)_
     20  (  -_)  ( -_-~  -_ `,    )
     21  (_ -_ _-~-__-~`, ,' )__-'))--___--~~~--__--~~--___--__..
     22  _ ~`_-'( (____;--==,,_))))--___--~~~--__--~~--__----~~~'`=__-~+_-_.
     23 (@) (@) `````      `-_(())_-~  mn
     24 EOF
     25 
     26 echo "Installing all dependencies..."
     27 apt-get update
     28 sudo apt install apache2 libapache2-mod-wsgi-py3 python3-pip python3-pil python3-bcrypt python3-webpy python3-markdown
     29 pip3 install webpy-v.0.76.zip
     30 
     31 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
     32 ACONF="/etc/apache2/sites-available/heartranked.conf"
     33 
     34 echo "Adding local site to /etc/apache2/sites-available/heartranked.conf"
     35 cat <<'EOF' > $ACONF
     36 <VirtualHost *:80>
     37     ServerName localhost
     38 EOF
     39 echo "    DocumentRoot $DIR" >> $ACONF
     40 echo "    WSGIScriptAlias / $DIR/server.py" >> $ACONF
     41 echo "    WSGIPassAuthorization On" >> $ACONF
     42 echo "    AddType text/html .py" >> $ACONF
     43 echo "    Alias /static $DIR/public_html/" >> $ACONF
     44 echo "    <Directory $DIR/public_html>" >> $ACONF
     45 cat <<'EOF' >> $ACONF
     46         Options FollowSymlinks
     47 	AllowOverride None
     48 	Require all granted
     49     </Directory>
     50     ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
     51     <Directory "/usr/lib/cgi-bin">
     52         AllowOverride None
     53         Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
     54         Require all granted
     55     </Directory>
     56 EOF
     57 echo "    ErrorLog $DIR/error.log" >> $ACONF
     58 echo "</VirtualHost>" >> $ACONF
     59 
     60 echo "<Directory $DIR>" >> /etc/apache2/apache2.conf
     61 cat <<'EOF' >> /etc/apache2/apache2.conf
     62 	Options Indexes FollowSymLinks
     63 	AllowOverride None
     64 	Require all granted
     65 </Directory>
     66 EOF
     67 
     68 sudo a2ensite heartranked.conf
     69 sudo systemctl restart apache2
     70 
     71 cat <<'EOF'
     72                        .-.
     73         .-""`""-.    |(@ @)
     74      _/`oOoOoOoOo`\_ \ \-/
     75     '.-=-=-=-=-=-=-.' \/ \
     76       `-=.=-.-=.=-'    \ /\
     77          ^  ^  ^       _H_ \
     78 
     79 EOF
     80