This repository has been archived by the owner on Jun 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 33
/
install-debian10.sh
148 lines (115 loc) · 3.08 KB
/
install-debian10.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/bin/bash
# Only support Debian 10
if [ `whoami` != "root" ]; then
echo "sudo or root is required!"
exit 1
fi
if [ ! -f "/etc/debian_version" ]; then
echo "Boss, do you want to try debian?"
exit 1
fi
input=$1
isInstallFront=true
isInstallXyz=true
skipCa=false
if [ "$1" = "s" ];then
skipCa=true
input="y"
fi
if [ -z $input ]; then
read -r -p "Install FastGit.org front? [Y/n] " input
fi
case $input in
[yY][eE][sS]|[yY])
echo "You selected install"
isInstallFront=true
;;
[nN][oO]|[nN])
echo "You selected no install"
isInstallFront=false
;;
*)
echo "Invalid input..."
exit 1
;;
esac
if [ -z $inputXyz ]; then
read -r -p "Install FastGit.xyz [Y/n] " inputXyz
fi
case $inputXyz in
[yY][eE][sS]|[yY])
echo "You selected install"
isInstallXyz=true
;;
[nN][oO]|[nN])
echo "You selected no install"
isInstallXyz=false
;;
*)
echo "Invalid input..."
exit 1
;;
esac
echo "[I] Basic operations"
apt update
apt install curl wget nano -y
echo "[I] Install Nginx & git"
apt install nginx -y
apt install git -y
echo "[I] I love NGINX"
systemctl enable nginx
systemctl start nginx
systemctl stop nginx
echo "[I] Install dhparam"
curl https://ssl-config.mozilla.org/ffdhe2048.txt > /var/lib/nginx/dhparam.pem
chmod +r /var/lib/nginx/dhparam.pem
echo "[I] Download confs"
mkdir fastgit-tmp
cd fastgit-tmp
git clone https://github.com/FastGitORG/nginx-conf --depth=1
echo "[I] Install confs"
cd nginx-conf
cp *.conf /etc/nginx/sites-enabled
mv /etc/nginx/sites-enabled/anti-floc.conf /etc/nginx/snippets/anti-floc.conf
mkdir -p /www/wwwroot/fg
mkdir -p /www/wwwlogs
cp robots.txt /www/wwwroot/fg
echo "OK!" > /www/wwwroot/fg/index.html
mkdir -p /var/www/cert/
if $isInstallXyz; then
echo "Please delete this line, enter XYZ certification here, and save" > /var/www/cert/fgxyz.pem
nano /var/www/cert/fgxyz.pem
echo "Please delete this line, enter XYZ private key here, and save" > /var/www/cert/fgxyz.key
nano /var/www/cert/fgxyz.key
else
rm -f /etc/nginx/sites-enabled/hub.fastgit.xyz.conf
fi
echo "[I] Process FastGit.org index.html"
if $isInstallFront; then
git clone "https://github.com/FastGitORG/www" /www/wwwroot/fgorg
rm -rf /www/wwwroot/fgorg/.git
rm -rf /www/wwwroot/fgorg/README.md
rm -rf /www/wwwroot/fgorg/LICENSE
else
rm -f /etc/nginx/sites-enabled/fastgit.org.conf
fi
echo "[I] Clean tmp"
cd ..
rm -fR nginx-conf
cd ..
rm -fR fastgit-tmp
if $skipCa; then
echo "Please put certification at /var/www/cert/fg.pem"
echo "Put private key at /var/www/cert/fg.key"
echo "Then run systemctl start nginx && systemctl reload nginx"
echo "Enjoy! :D"
exit 0
fi
echo "Please delete this line, enter certification here, and save" > /var/www/cert/fg.pem
nano /var/www/cert/fg.pem
echo "Please delete this line, enter private key here, and save" > /var/www/cert/fg.key
nano /var/www/cert/fg.key
nginx -t
systemctl start nginx
systemctl reload nginx
echo "Enjoy! :D"