Repository navigation
Expand file tree
/
Copy pathnc-dependencies.sh
More file actions
316 lines (282 loc) · 7.3 KB
/
Copy pathnc-dependencies.sh
File metadata and controls
316 lines (282 loc) · 7.3 KB
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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
#!/bin/bash
ID=`id -u`
if [ "x$ID" != "x0" ]; then
echo "Run as root!"
exit 1
fi
clear
echo "#################################"
echo "### installation Starting ###"
echo "#################################"
echo
echo
echo "############################################"
echo "### Updating and Upgrading Databases ###"
echo "############################################"
apt update
apt upgrade -y
echo
echo
echo "#####################################################"
echo "### Checking/installing MariaDB Server/Client ###"
echo "#####################################################"
apt show mariadb-server > /dev/null 2>&1 > result ;cat result | grep "APT-Manual-Installed" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo
echo Installing mariadb-server
apt install -y mariadb-server > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo Installation Failed!
exit 1
fi
echo "###################################"
echo "### Securing MariaDB Server ###"
echo "###################################"
wget https://raw.githubusercontent.com/javito1081/personal/master/mysql_secure.sh > /dev/null 2>&1
chmod a+x mysql_secure.sh
./mysql_secure.sh rootnodoubt > /dev/null 2>&1
rm mysql_secure.sh
echo
echo Done!
fi
rm result
apt show mariadb-client > /dev/null 2>&1 > result ;cat result | grep "APT-Manual-Installed" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo
echo Installing mariadb-client
apt install -y mariadb-client > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo Installation Failed!
exit 1
fi
echo
echo Done!
fi
rm result
systemctl status mariadb | grep Active
systemctl status mariadb | grep "Active: active" > /dev/null 2>&1
if [ $? == 0 ]; then
cat /etc/mysql/my.cnf | grep -F [mysqld] > /dev/null 2>&1
if [ $? -ne 0 ]; then
bash -c "echo -en '\n[mysqld]' >> /etc/mysql/my.cnf"
fi
cat /etc/mysql/my.cnf | grep innodb_large_prefix=true > /dev/null 2>&1
if [ $? -ne 0 ]; then
sed -i "/^\[mysqld\]/a innodb_large_prefix=true" /etc/mysql/my.cnf
fi
cat /etc/mysql/my.cnf | grep innodb_file_format=barracuda > /dev/null 2>&1
if [ $? -ne 0 ]; then
sed -i "/^\[mysqld\]/a innodb_file_format=barracuda" /etc/mysql/my.cnf
fi
cat /etc/mysql/my.cnf | grep innodb_file_per_table=1 > /dev/null 2>&1
if [ $? -ne 0 ]; then
sed -i "/^\[mysqld\]/a innodb_file_per_table=1" /etc/mysql/my.cnf
fi
else
echo
echo MariaDB is not Active, check \"journalctl -xe\" for details
exit 1
fi
service mysql restart
echo
echo
echo "#######################################################"
echo "### Checking/installing PHP7.2 and Dependencies ###"
echo "#######################################################"
apt show php7.2 > /dev/null 2>&1 > result ;cat result | grep "APT-Manual-Installed" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo
echo Installing php7.2
apt install -y php7.2 > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo Installation Failed!
exit 1
fi
echo
echo Done!
fi
rm result
apt show php7.2-fpm > /dev/null 2>&1 > result ;cat result | grep "APT-Manual-Installed" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo
echo Installing php7.2-fqm
apt install -y php7.2-fpm > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo Installation Failed!
exit 1
fi
echo
echo Done!
fi
rm result
apt show php7.2-mysql > /dev/null 2>&1 > result ;cat result | grep "APT-Manual-Installed" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo
echo Installing php7.2-mysql
apt install -y php7.2-mysql > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo Installation Failed!
exit 1
fi
echo
echo Done!
fi
rm result
apt show php7.2-mbstring > /dev/null 2>&1 > result ;cat result | grep "APT-Manual-Installed" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo
echo Installing php7.2-mbstring
apt install -y php7.2-mbstring > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo Installation Failed!
exit 1
fi
echo
echo Done!
fi
rm result
apt show php7.2-xml > /dev/null 2>&1 > result ;cat result | grep "APT-Manual-Installed" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo
echo Installing php7.2-xml
apt install -y php7.2-xml > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo Installation Failed!
exit 1
fi
echo
echo Done!
fi
rm result
apt show php7.2-gd > /dev/null 2>&1 > result ;cat result | grep "APT-Manual-Installed" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo
echo Installing php7.2-gd
apt install -y php7.2-gd > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo Installation Failed!
exit 1
fi
echo
echo Done!
fi
rm result
apt show php7.2-curl > /dev/null 2>&1 > result ;cat result | grep "APT-Manual-Installed" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo
echo Installing php7.2-curl
apt install -y php7.2-curl > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo Installation Failed!
exit 1
fi
echo
echo Done!
fi
rm result
apt show php-imagick > /dev/null 2>&1 > result ;cat result | grep "APT-Manual-Installed" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo
echo Installing php-imagick
apt install -y php-imagick > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo Installation Failed!
exit 1
fi
echo
echo Done!
fi
rm result
apt show php7.2-zip > /dev/null 2>&1 > result ;cat result | grep "APT-Manual-Installed" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo
echo Installing php7.2-zip
apt install -y php7.2-zip > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo Installation Failed!
exit 1
fi
echo
echo Done!
fi
rm result
apt show php7.2-bz2 > /dev/null 2>&1 > result ;cat result | grep "APT-Manual-Installed" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo
echo Installing php7.2-bz2
apt install -y php7.2-bz2 > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo Installation Failed!
exit 1
fi
echo
echo Done!
fi
rm result
apt show php7.2-intl > /dev/null 2>&1 > result ;cat result | grep "APT-Manual-Installed" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo
echo Installing php7.2-intl
apt install -y php7.2-intl > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo Installation Failed!
exit 1
fi
echo
echo Done!
fi
rm result
apt show php-apcu > /dev/null 2>&1 > result ;cat result | grep "APT-Manual-Installed" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo
echo Installing php-apcu
apt install -y php-apcu > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo Installation Failed!
exit 1
fi
service php7.2-fpm restart
echo
echo Done!
fi
rm result
cat /etc/php/7.2/fpm/pool.d/www.conf | grep ";clear_env = no" > /dev/null 2>&1
if [ $? == 0 ]; then
sed -i "s/\;clear_env = no/clear_env = no/g" /etc/php/7.2/fpm/pool.d/www.conf
systemctl restart php7.2-fpm
fi
echo
echo
echo "################################################"
echo "### Checking/installing Nginx Web Server ###"
echo "################################################"
systemctl disable apache2 > /dev/null 2>&1
systemctl stop apache2 > /dev/null 2>&1
apt show nginx > /dev/null 2>&1 > result ;cat result | grep "APT-Manual-Installed" > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo
echo Installing nginx
apt install -y nginx > /dev/null 2>&1
if [ $? -ne 0 ]; then
echo Installation Failed!
exit 1
fi
rm /etc/nginx/sites-enabled/default
echo
echo Done!
systemctl status nginx | grep Active
fi
rm result
echo
echo
echo Checking status on php7.2-fpm
systemctl status php7.2-fpm | grep Active
echo
echo
echo "##################################"
echo "### Done with Dependencies ###"
echo "##################################"
echo
# read -n 1 -s -r -p "Press any key to continue"
echo
echo