aws-ec2-redhat-apache-python-flask.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
yum repolist all | |
yum-config-manager --enable codeready-builder-for-rhel-8-rhui-rpms | |
yum --disablerepo=\* remove subscription-manager -y | |
yum update -y | |
yum install vim git wget httpd python39 python3-pip python39-mod_wsgi python3-markupsafe -y | |
python3 -m pip install virtualenv | |
systemctl enable httpd | |
dd if=/dev/zero of=/swapfile bs=128M count=32 | |
chmod 600 /swapfile | |
mkswap /swapfile | |
swapon /swapfile | |
swapon -s | |
echo "/swapfile swap swap defaults 0 0" >> /etc/fstab | |
cd /etc/httpd/conf | |
wget https://gist.githubusercontent.com/whittlem/6f6f646cdddb3211cab7b2a166e7faee/raw/7bc915c2ec869729efc88c8eaa66fadd74f1f74d/apache-wsgi-vhost.conf | |
mv apache-wsgi-vhost.conf vhost.conf | |
echo "" >> httpd.conf | |
echo "Include conf/vhost.conf" >> httpd.conf | |
cd /var/www/html | |
wget https://gist.githubusercontent.com/whittlem/6ba6c38ecb9253c30448e4750f8ca73b/raw/3db48b6f82e99a6909621268a046ab5a2f84dcfa/python-flask-run.py | |
mv python-flask-run.py run.py | |
wget https://gist.githubusercontent.com/whittlem/f5bd7411db381f229e4fb4425deca503/raw/7e8cc85dcc40694b238a4df2585f629c30c94765/python-flask-wsgi.py | |
mv python-flask-wsgi.py wsgi.py | |
mkdir /var/www/html/app | |
cd /var/www/html/app | |
wget https://gist.githubusercontent.com/whittlem/ec124b44073c0a90a4dc71f5486f9398/raw/17ad65567c6823c8fa297b2700f10fdf151db616/python-flask-app_init.py | |
mv /var/www/html/app/python-flask-app_init.py __init__.py | |
cd /var/www | |
virtualenv --python=python3 html | |
cd /var/www/html | |
source bin/activate | |
pip install --upgrade pip | |
pip install flask | |
systemctl restart httpd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment