-
Notifications
You must be signed in to change notification settings - Fork 0
/
instubp2arm.sh
448 lines (352 loc) · 10.5 KB
/
instubp2arm.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
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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
#!/bin/bash
##############################
#### Disable Services ####
##############################
systemctl disable named
systemctl disable usermin
systemctl disable dovecot
systemctl disable proftpd
systemctl disable clamav-freshclam
systemctl disable clamav-daemon
systemctl disable postgrey
##############################
#### install new PHP versions
##############################
echo | add-apt-repository ppa:ondrej/php
echo | add-apt-repository ppa:ondrej/apache2
apt update
apt upgrade -y
systemctl restart apache2
apt update
apt upgrade -y
apt install php7.4-bcmath php7.4-bz2 php7.4-cgi php7.4-curl php7.4-dba -y
apt install php7.4-gd php7.4-gmp php7.4-imap php7.4-fpm php7.4-json php7.4-xml php7.4-common -y
apt install php7.4-intl php7.4-ldap php7.4-mbstring php7.4-mysql php7.4-odbc php7.4-pspell -y
apt install php7.4-soap php7.4-sqlite3 php7.4-tidy php7.4-xmlrpc php7.4-xsl php7.4-zip php7.4-imagick php7.4-redis -y
apt install php8.0-bcmath php8.0-bz2 php8.0-cgi php8.0-curl php8.0-dba php8.0-fpm php8.0-gd -y
apt install php8.0-gmp php8.0-igbinary php8.0-imagick php8.0-imap php8.0-intl php8.0-ldap php8.0-mbstring -y
apt install php8.0-mysql php8.0-odbc php8.0-opcache php8.0-pspell php8.0-readline -y
apt install php8.0-redis php8.0-soap php8.0-sqlite3 php8.0-tidy php8.0-xml php8.0-xmlrpc php8.0-xsl php8.0-zip -y
apt install php8.1-bcmath php8.1-bz2 php8.1-cgi php8.1-curl php8.1-dba php8.1-fpm -y
apt install php8.1-gd php8.1-gmp php8.1-igbinary php8.1-imagick php8.1-imap php8.1-intl php8.1-ldap php8.1-mbstring -y
apt install php8.1-mysql php8.1-odbc php8.1-opcache php8.1-pspell php8.1-readline -y
apt install php8.1-redis php8.1-soap php8.1-sqlite3 php8.1-tidy php8.1-xml php8.1-xmlrpc php8.1-xsl php8.1-zip -y
apt install php8.2-bcmath php8.2-bz2 php8.2-cgi php8.2-curl php8.2-dba php8.2-fpm -y
apt install php8.2-gd php8.2-gmp php8.2-igbinary php8.2-imagick php8.2-imap php8.2-intl php8.2-ldap php8.2-mbstring -y
apt install php8.2-mysql php8.2-odbc php8.2-opcache php8.2-pspell php8.2-readline -y
apt install php8.2-redis php8.2-soap php8.2-sqlite3 php8.2-tidy php8.2-xml php8.2-xmlrpc php8.2-xsl php8.2-zip -y
##############################
#### Change php.ini parameters
##############################
cat >> /etc/php/7.4/fpm/php.ini <<'EOF'
[PHP]
output_buffering = Off
max_execution_time = 300
max_input_time = 300
memory_limit = 512M
post_max_size = 1024M
upload_max_filesize = 1024M
date.timezone = Europe/Zurich
max_input_vars = 10000
[Session]
session.gc_maxlifetime = 3600
EOF
cat >> /etc/php/7.4/cgi/php.ini <<'EOF'
[PHP]
output_buffering = Off
max_execution_time = 300
max_input_time = 300
memory_limit = 512M
post_max_size = 1024M
upload_max_filesize = 1024M
date.timezone = Europe/Zurich
max_input_vars = 10000
[Session]
session.gc_maxlifetime = 3600
EOF
cat >> /etc/php/7.4/cli/php.ini <<'EOF'
[PHP]
output_buffering = Off
max_execution_time = 300
max_input_time = 300
memory_limit = 512M
post_max_size = 1024M
upload_max_filesize = 1024M
date.timezone = Europe/Zurich
max_input_vars = 10000
[Session]
session.gc_maxlifetime = 3600
EOF
cat >> /etc/php/8.0/fpm/php.ini <<'EOF'
[PHP]
output_buffering = Off
max_execution_time = 300
max_input_time = 300
memory_limit = 512M
post_max_size = 1024M
upload_max_filesize = 1024M
date.timezone = Europe/Zurich
max_input_vars = 10000
[Session]
session.gc_maxlifetime = 3600
[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.jit_buffer_size=256M
EOF
cat >> /etc/php/8.0/cgi/php.ini <<'EOF'
[PHP]
output_buffering = Off
max_execution_time = 300
max_input_time = 300
memory_limit = 512M
post_max_size = 1024M
upload_max_filesize = 1024M
date.timezone = Europe/Zurich
max_input_vars = 10000
[Session]
session.gc_maxlifetime = 3600
[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.jit_buffer_size=256M
EOF
cat >> /etc/php/8.0/cli/php.ini <<'EOF'
[PHP]
output_buffering = Off
max_execution_time = 300
max_input_time = 300
memory_limit = 512M
post_max_size = 1024M
upload_max_filesize = 1024M
date.timezone = Europe/Zurich
max_input_vars = 10000
[Session]
session.gc_maxlifetime = 3600
[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.jit_buffer_size=256M
EOF
cat >> /etc/php/8.1/fpm/php.ini <<'EOF'
[PHP]
output_buffering = Off
max_execution_time = 300
max_input_time = 300
memory_limit = 512M
post_max_size = 1024M
upload_max_filesize = 1024M
date.timezone = Europe/Zurich
max_input_vars = 10000
[Session]
session.gc_maxlifetime = 3600
[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.jit_buffer_size=256M
EOF
cat >> /etc/php/8.1/cgi/php.ini <<'EOF'
[PHP]
output_buffering = Off
max_execution_time = 300
max_input_time = 300
memory_limit = 512M
post_max_size = 1024M
upload_max_filesize = 1024M
date.timezone = Europe/Zurich
max_input_vars = 10000
[Session]
session.gc_maxlifetime = 3600
[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.jit_buffer_size=256M
EOF
cat >> /etc/php/8.1/cli/php.ini <<'EOF'
[PHP]
output_buffering = Off
max_execution_time = 300
max_input_time = 300
memory_limit = 512M
post_max_size = 1024M
upload_max_filesize = 1024M
date.timezone = Europe/Zurich
max_input_vars = 10000
[Session]
session.gc_maxlifetime = 3600
[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.jit_buffer_size=256M
EOF
cat >> /etc/php/8.2/fpm/php.ini <<'EOF'
[PHP]
output_buffering = Off
max_execution_time = 300
max_input_time = 300
memory_limit = 512M
post_max_size = 1024M
upload_max_filesize = 1024M
date.timezone = Europe/Zurich
max_input_vars = 10000
[Session]
session.gc_maxlifetime = 3600
[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.jit_buffer_size=256M
EOF
cat >> /etc/php/8.2/cgi/php.ini <<'EOF'
[PHP]
output_buffering = Off
max_execution_time = 300
max_input_time = 300
memory_limit = 512M
post_max_size = 1024M
upload_max_filesize = 1024M
date.timezone = Europe/Zurich
max_input_vars = 10000
[Session]
session.gc_maxlifetime = 3600
[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.jit_buffer_size=256M
EOF
cat >> /etc/php/8.2/cli/php.ini <<'EOF'
[PHP]
output_buffering = Off
max_execution_time = 300
max_input_time = 300
memory_limit = 512M
post_max_size = 1024M
upload_max_filesize = 1024M
date.timezone = Europe/Zurich
max_input_vars = 10000
[Session]
session.gc_maxlifetime = 3600
[opcache]
opcache.enable=1
opcache.enable_cli=1
opcache.jit_buffer_size=256M
EOF
#####################################
#### Enable additional Apache modules
#####################################
a2enmod http2
a2enmod headers
a2enmod expires
a2enmod include
a2enmod proxy_http2
##############################
#### Restart Apache / PHP-FPM
##############################
systemctl restart apache2
systemctl restart php7.4-fpm.service
systemctl restart php8.0-fpm.service
systemctl restart php8.1-fpm.service
systemctl restart php8.2-fpm.service
################################
#### install new Python versions (issuse still investigating!!
################################
: <<'END'
echo | add-apt-repository ppa:deadsnakes/ppa -y
apt update
apt install python3.11 -y
apt install python3.11-venv -y
echo | update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.10 1
echo | update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.11 2
echo 2 | update-alternatives --config python3
apt install python3-pip -y
cd /root
wget https://raw.githubusercontent.com/fdmgit/install-ubuntu-22.04/main/messages.py
cp messages.py /usr/lib/python3/dist-packages/acme/messages.py
rm messages.py
echo | ln -s /usr/lib/python3/dist-packages/apt_pkg.cpython-310-aarch64-linux-gnu.so /usr/lib/python3/dist-packages/apt_pkg.so
END
######################################
#### install additional Python modules
######################################
apt install python3-venv -y
apt install python3-pip -y
cd /root
##############################
#### Install Redis Server
##############################
echo | add-apt-repository ppa:redislabs/redis
apt update
apt install redis -y
systemctl enable --now redis-server
systemctl restart redis-server
cat >> /etc/sysctl.conf <<'EOF'
vm.overcommit_memory = 1
EOF
###################################
#### add config files to Virtualmin
###################################
cd /etc/webmin/virtual-server/plans
wget https://raw.githubusercontent.com/fdmgit/virtualmin/main/160880314564582
cd /etc/webmin/virtual-server/templates
wget https://raw.githubusercontent.com/fdmgit/virtualmin/main/server-level.tar.gz
tar -xvzf server-level.tar.gz
rm server-level.tar.gz
cd /root
###################################
#### add logo and styles
###################################
wget https://raw.githubusercontent.com/fdmgit/virtualmin/main/logostyle.zip
unzip logostyle.zip
cp logo.png /etc/webmin/authentic-theme/
cp logo_welcome.png /etc/webmin/authentic-theme/
cp styles.css /etc/webmin/authentic-theme/
rm logo.png
rm logo_welcome.png
rm styles.css
rm logostyle.zip
cd /root
: <<'END'
wget https://raw.githubusercontent.com/fdmgit/virtualmin/main/settings.js
wget https://raw.githubusercontent.com/fdmgit/virtualmin/main/settings-root.js
cp settings.js /etc/webmin/authentic-theme/
cp settings-root.js /etc/webmin/authentic-theme/
###################################
#### left menu html
###################################
all_ip_addresses="$(hostname -I)";
ip_address_array=($all_ip_addresses);
local_host="$(hostname -s)";
local_host=${local_host^^};
leftmenu_user_html="<br /><kb><b><span style='font-size:20px;color:gold;'>""$local_host""</span></b></kb><br /><kb><span style='font-size:16px;color:gold;'>""${ip_address_array[0]}""</span></kb>";
leftmenu_user_html="settings_leftmenu_user_html='""$leftmenu_user_html""';";
sed -i "s|settings_leftmenu_user_html='';|$leftmenu_user_html|g" /etc/webmin/authentic-theme/settings.js
sed -i "s|settings_leftmenu_user_html='';|$leftmenu_user_html|g" /etc/webmin/authentic-theme/settings-root.js
cd /root
END
###################################
#### new fail2ban and jail
###################################
wget https://github.com/fail2ban/fail2ban/releases/download/1.0.2/fail2ban_1.0.2-1.upstream1_all.deb
echo y | dpkg -i fail2ban_1.0.2-1.upstream1_all.deb
wget https://raw.githubusercontent.com/fdmgit/virtualmin/main/jail.local
cd /etc/fail2ban
mv jail.local jail.local.orig
cp /root/jail.local jail.local
rm /root/jail.local
rm /root/fail2ban_1.0.2-1.upstream1_all.deb
cd /root
##############################
#### Update programs
##############################
apt update
apt upgrade -y
##############################
#### Update locate DB
##############################
updatedb
apt autoremove -y # clean installed apps
cd /root
rm instubp1arm.sh
rm instubp2arm.sh
rm load_inst_files_arm.sh
rm -R .spamassassin
reboot