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