string each install together
This commit is contained in:
50
install.sh
50
install.sh
@@ -1,6 +1,5 @@
|
||||
echo "
|
||||
# Dependencies
|
||||
echo \"
|
||||
echo "
|
||||
yum -y update && yum -y upgrade
|
||||
yum -y install epel-release
|
||||
yum -y install vim nano gcc wget nginx libsqlite3x-devel.x86_64 postgresql-server postgresql-devel postgresql-contrib bzip2-devel zlib-devel libffi-devel openssl-devel policycoreutils-python.x86_64 0:2.5-22.el7
|
||||
@@ -8,10 +7,10 @@ firewall-cmd --zone=public --add-port=80/tcp --permanent
|
||||
firewall-cmd --zone=public --add-port=443/tcp --permanent
|
||||
firewall-cmd --reload
|
||||
semanage permissive -a httpd_t
|
||||
\" > dependsetup.sh
|
||||
" > dependsetup.sh
|
||||
|
||||
# Python
|
||||
echo \"
|
||||
echo "
|
||||
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
|
||||
tar xf Python-3.7.0.tar.xz
|
||||
cd Python-3.7.0
|
||||
@@ -22,31 +21,30 @@ make altinstall
|
||||
/usr/src/python37/bin/python3.7 -m pip install virtualenv
|
||||
cd ..
|
||||
rm Python-3.7.0.tar.xz
|
||||
\" > pythonsetup.sh
|
||||
" > pythonsetup.sh
|
||||
|
||||
# Django
|
||||
echo \"
|
||||
mkdir mysite
|
||||
echo "
|
||||
mkdir /home/centos/mysite
|
||||
cd /home/centos/mysite
|
||||
/usr/src/python37/bin/python3.7 -m virtualenv mysite/venv
|
||||
source mysite/venv/bin/activate
|
||||
pip install django gunicorn psycopg2-binary
|
||||
cd mysite
|
||||
django-admin startproject mysite
|
||||
cd ..
|
||||
sed -i 's/ALLOWED_HOSTS = \\\[\\\]/ALLOWED_HOSTS = \\\[\\\"centos.duco.net\\\"\\\]/' mysite/mysite/mysite/settings.py
|
||||
echo \\\"STATIC_ROOT = os.path.join(BASE_DIR, 'static')\\\" >> mysite/mysite/mysite/settings.py
|
||||
cd /home/centos/
|
||||
sed -i 's/ALLOWED_HOSTS = \[\]/ALLOWED_HOSTS = \[\"centos.duco.net\"\]/' mysite/mysite/mysite/settings.py
|
||||
echo \"STATIC_ROOT = os.path.join(BASE_DIR, 'static')\" >> mysite/mysite/mysite/settings.py
|
||||
python mysite/mysite/manage.py collectstatic
|
||||
python mysite/mysite/manage.py makemigrations
|
||||
python mysite/mysite/manage.py migrate
|
||||
deactivate
|
||||
\" > djangosetup.sh
|
||||
cp djangosetup.sh /home/centos/djangosetup.sh
|
||||
chown centos:centos /home/centos/djangosetup.sh
|
||||
chmod 700 /home/centos/djangosetup.sh
|
||||
chown -R centos:centos mysite
|
||||
cd /root/" > djangosetup.sh
|
||||
|
||||
# Gunicorn
|
||||
echo "
|
||||
echo \"
|
||||
echo \\\"
|
||||
[Unit]
|
||||
Description=gunicorn daemon
|
||||
After=network.target
|
||||
@@ -58,13 +56,13 @@ WorkingDirectory=/home/centos/mysite/mysite
|
||||
ExecStart=/home/centos/mysite/venv/bin/gunicorn --workers 3 --bind unix:/home/centos/mysite/mysite.sock mysite.wsgi:application
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target\\\" > /etc/systemd/system/gunicorn.service
|
||||
WantedBy=multi-user.target\" > /etc/systemd/system/gunicorn.service
|
||||
systemctl start gunicorn
|
||||
systemctl status gunicorn\" > gunicornsetup.sh
|
||||
systemctl status gunicorn" > gunicornsetup.sh
|
||||
|
||||
# Nginx
|
||||
echo "
|
||||
echo \"
|
||||
echo \\\"
|
||||
server {
|
||||
listen 80;
|
||||
server_name centos.duco.net;
|
||||
@@ -75,13 +73,13 @@ server {
|
||||
}
|
||||
|
||||
location / {
|
||||
proxy_set_header Host \\\\\\\$http_host;
|
||||
proxy_set_header X-Real-IP \\\\\\\$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \\\\\\\$proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto \\\\\\\$scheme;
|
||||
proxy_set_header Host \\\\\$http_host;
|
||||
proxy_set_header X-Real-IP \\\\\$remote_addr;
|
||||
proxy_set_header X-Forwarded-For \\\\\$proxy_add_x_forwarded_for;
|
||||
proxy_set_header X-Forwarded-Proto \\\\\$scheme;
|
||||
proxy_pass http://unix:/home/centos/mysite/mysite.sock;
|
||||
}
|
||||
}\\\" > /etc/nginx/conf.d/mysite.conf
|
||||
}\" > /etc/nginx/conf.d/mysite.conf
|
||||
sed -i 's/user nginx/user centos nginx/' /etc/nginx/nginx.conf
|
||||
systemctl restart nginx
|
||||
systemctl status nginx\" > nginxsetup.sh
|
||||
@@ -93,4 +91,8 @@ chmod 700 djangosetup.sh
|
||||
chmod 700 gunicornsetup.sh
|
||||
chmod 700 nginxsetup.sh
|
||||
" > master.sh
|
||||
|
||||
sh dependsetup.sh
|
||||
sh pythonsetup.sh
|
||||
sh djangosetup.sh
|
||||
sh gunicornsetup.sh
|
||||
sh nginxsetup.sh
|
||||
|
||||
Reference in New Issue
Block a user