-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebinstall.sh
executable file
·2068 lines (1844 loc) · 64.7 KB
/
webinstall.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
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
#!/bin/bash
# TekBase - Server Control Panel
# Copyright since 2005 TekLab
# Christian Frankenstein
# Website: teklab.de
# teklab.net
# Email: [email protected]
# Discord: https://discord.gg/K49XAPv
# You can start webinstall.sh fully automatically with the command:
# ./webinstall.sh 2 1 1 2 "Debian" "9" "10000" "w2a384cj3d80smcz2x245ki49sg0i"
##############################
# Command Line Variables #
##############################
# 1 = "german" otherwise "english"
langsel=$1
# 1 = Webserver + TekBASE + Teamspeak 3 + Dedicated installation
# 2 = Webserver + TekBASE + Dedicated installation
# 3 = Webserver + TekBASE"
# 4 = Webserver + Teamspeak 3 + Dedicated installation
# 5 = Webserver + Dedicated installation
# 6 = Webserver only Ioncube, Pecl SSH, Geoip, Qstat and FTP
# 7 = Semi-automatic web server installation with requests
# 8 = Teamspeak 3 + Dedicated installation
# 9 = Dedicated installation
modsel=$2
# 1 = No further yes/no queries
yessel=$3
# 1 = SuSE
# 2 = Debian / Ubuntu
# 3 = CentOS / Fedora / Red Hat
os_install=$4
# "CentOS", "Debian", "Fedora", "Red Hat", "SuSE", "Ubuntu"
os_name=$5
# Only the major version (e.g. 18 not 18.04)
os_version=$6
# 32 or 64Bit
os_typ=$(uname -m)
# If you are a reseller then enter your reseller ID and Key, otherwise this parameters are empty
# !currently not available!
# resellerid=$7
# resellerkey=$8
installhome=$(pwd)
##############################
# Colored Message #
##############################
function color {
if [ "$1" = "c" ]; then
txt_color=6
fi
if [ "$1" = "g" ]; then
txt_color=2
fi
if [ "$1" = "r" ]; then
txt_color=1
fi
if [ "$1" = "y" ]; then
txt_color=3
fi
if [ "$2" = "n" ]; then
echo -n "$(tput setaf $txt_color)$3"
else
echo "$(tput setaf $txt_color)$3"
fi
tput sgr0
}
##############################
# Generate Password #
##############################
function gen_passwd {
PWCHARS=$1
[ "$PWCHARS" = "" ] && PWCHARS=16
tr -dc A-Za-z0-9_ < /dev/urandom | head -c ${PWCHARS} | xargs
}
##############################
# Generate Logs #
##############################
function gen_logs {
log_text=$1
if [ "$log_text" = "" ]; then
echo "##############################" >> /home/tekbase.log
echo "# TekBASE installation #" >> /home/tekbase.log
echo "##############################" >> /home/tekbase.log
echo "[$(date +"%Y_%m-%H_%M_%S")] - start" >> /home/tekbase.log
else
if [ "$2" != "" ]; then
pkg_check=$(dpkg-query -W --showformat='${Status}\n' $2|grep "install ok installed")
if [ "$check" == "install ok installed" ]; then
log_text="The Package ${2} is installed."
else
log_text="The Package ${2} could not be installed."
fi
fi
echo "[$(date +"%Y_%m-%H_%M_%S")] - ${log_text}" >> /home/tekbase.log
fi
}
##############################
# Loading Spinner #
##############################
function loading {
SPINNER=("-" "\\" "|" "/")
for sequence in $(seq 1 $1); do
for I in "${SPINNER[@]}"; do
echo -ne "\b$I"
sleep 0.1
done
done
}
##############################
# Create Directory #
##############################
function make_dir {
if [ "$1" != "" -a ! -d $1 ]; then
mkdir -p $1
fi
}
##############################
# Check Apache #
##############################
function chk_apache {
apache_inst=0
if [ "$1" != "3" ]; then
checka=$(which apache 2>&-)
checkb=$(which apache2 2>&-)
checkc=$(find /usr/include -name apache2)
checkd=$(find /usr/include -name apache)
if [ "$checka" != "" -o "$checkb" != "" -o "$checkc" != "" -o "$checkd" != "" ]; then
apache_inst=1
fi
else
checka=$(which httpd | grep -i "/httpd" 2>&-)
if [ "$checka" != "" ]; then
apache_inst=1
fi
fi
}
##############################
# Check Netstat #
##############################
function chk_netstat {
netstat_inst=0
check=$(which netstat 2>&-)
if [ -n "$check" ]; then
netstat_inst=1
fi
}
##############################
# Check OS #
##############################
function chk_os {
os_install=""
os_name=""
os_version=""
check=$(cat /etc/*-release | grep -i 'CentOS')
if [ -n "$check" ]; then
os_install=3
os_name="CentOS"
os_version=$(cat /etc/*-release | grep -i 'VERSION_ID' | awk -F "\"" '{print $2}')
fi
check=$(cat /etc/*-release | grep -i 'Debian')
if [ -n "$check" -a "$os_install" = "" ]; then
os_install=2
os_name="Debian"
os_version=$(cat /etc/*-release | grep -i 'VERSION_ID' | awk -F "\"" '{print $2}')
fi
check=$(cat /etc/*-release | grep -i 'Fedora')
if [ -n "$check" -a "$os_install" = "" ]; then
os_install=3
os_name="Fedora"
os_version=$(cat /etc/*-release | grep -i 'VERSION_ID' | awk -F "=" '{print $2}')
fi
check=$(cat /etc/*-release | grep -i 'Red Hat')
if [ -n "$check" -a "$os_install" = "" ]; then
os_install=3
os_name="Red Hat"
os_version=$(cat /etc/*-release | grep -i 'VERSION_ID' | awk -F "\"" '{print $2}')
fi
check=$(cat /etc/*-release | grep -i 'SUSE')
if [ -n "$check" -a "$os_install" = "" ]; then
os_install=1
os_name="SuSE"
os_version=$(cat /etc/*-release | grep -i 'VERSION_ID' | awk -F "\"" '{print $2}' | awk -F "." '{print $1}')
fi
check=$(cat /etc/*-release | grep -i 'Ubuntu')
if [ -n "$check" -a "$os_install" = "" ] || [ -n "$check" -a "$os_name" = "Debian" ]; then
os_install=2
os_name="Ubuntu"
os_version=$(cat /etc/*-release | grep -i 'VERSION_ID' | awk -F "\"" '{print $2}' | awk -F "." '{print $1}')
fi
}
##############################
# Check MySQL #
##############################
function chk_mysql {
mysql_inst=0
if [ "$1" != "3" ]; then
checka=$(which mysql 2>&-)
else
checka=$(which mysql | grep -i "/mysql" 2>&-)
fi
if [ "$checka" != "" ]; then
mysql_inst=1
fi
}
##############################
# Check PHP #
##############################
function chk_php {
php_inst=0
checka=$(php -m | grep -i "gd")
if [ "$1" != "3" ]; then
checkb=$(which php 2>&-)
else
checkb=$(which php | grep -i "/php" 2>&-)
fi
if [ "$checka" != "" -a "$checkb" != "" ]; then
php_inst=1
fi
}
##############################
# Check Web Panel #
##############################
function chk_panel {
web_panel="0"
if [ -f /etc/init.d/psa ]; then
web_panel="Plesk"
elif [ -f /usr/local/vesta/bin/v-change-user-password ]; then
web_panel="VestaCP"
elif [ -d /var/www/froxlor ]; then
web_panel="Froxlor"
elif [ -d /etc/imscp ]; then
web_panel="i-MSCP"
elif [ -d /usr/local/ispconfig ]; then
web_panel="ISPConfig"
elif [ -d /var/cpanel ]; then
web_panel="cPanel"
elif [ -d /usr/local/directadmin ]; then
web_panel="DirectAdmin"
fi
}
##############################
# Select Yes / No #
##############################
function select_yesno {
clear
echo -e "$1"
echo ""
if [ "$langsel" = "1" ]; then
echo "(1) Ja - Weiter"
echo "(2) Nein - Beenden"
else
echo "(1) Yes - Continue"
echo "(2) No - Exit"
fi
echo ""
if [ "$langsel" = "1" ]; then
if [ "$yesno" = "" ]; then
echo -n "Bitte geben Sie ihre Auswahl an: "
else
color r n "Bitte geben Sie entweder 1 oder 2 ein: "
fi
else
if [ "$yesno" = "" ]; then
echo -n "Please enter your selection: "
else
color r n "Please enter either 1 or 2: "
fi
fi
read -n 1 yesno
for i in $yesno; do
case "$i" in
'1')
clear
;;
'2')
clear
exit 0
;;
*)
yesno=99
clear
select_yesno "$1"
;;
esac
done
}
##############################
# Select Lanuage #
##############################
function select_lang {
clear
echo "TekBASE Webserver Installer"
echo ""
echo "(1) German"
echo "(2) English"
echo "(3) Exit"
echo ""
if [ "$langsel" = "" ]; then
echo "Bitte waehlen Sie ihre Sprache."
echo -n "Please select your language: "
else
color r x "Bitte geben Sie entweder 1,2 oder 3 ein!"
color r n "Please enter only 1,2 or 3: "
fi
read -n 1 langsel
for i in $langsel; do
case "$i" in
'1')
clear
;;
'2')
clear
;;
'3')
clear
exit 0
;;
*)
langsel=99
clear
select_lang
;;
esac
done
}
##############################
# Select Mode #
##############################
function select_mode {
clear
if [ "$langsel" = "1" ]; then
echo "Installation Auswahl"
echo ""
echo "Waehlen Sie 1 oder 2. Dies ist perfekt fuer Anfaenger geeignet,"
echo "welche nur einen Rootserver nutzen."
echo ""
echo "(1) Webserver + TekBASE + Teamspeak 3 + Rootserver Einrichtung"
echo "(2) Webserver + TekBASE + Rootserver Einrichtung"
echo "(3) Webserver + TekBASE"
echo "(4) Webserver + Teamspeak 3 + Rootserver Einrichtung"
echo "(5) Webserver + Rootserver Einrichtung"
echo "(6) Webserver nur Ioncube, Pecl SSH, Geoip, Qstat und FTP"
echo "(7) Semi-automatische Webserver Installation mit Abfrage"
echo ""
echo "(8) Teamspeak 3 + Rootserver Einrichtung"
echo "(9) Rootserver Einrichtung"
echo "(0) Exit"
else
echo "Installation selection"
echo ""
echo "Choose 1 or 2. This is perfect for beginners who use only one"
echo "dedicated server."
echo ""
echo "(1) Webserver + TekBASE + Teamspeak 3 + Dedicated installation"
echo "(2) Webserver + TekBASE + Dedicated installation"
echo "(3) Webserver + TekBASE"
echo "(4) Webserver + Teamspeak 3 + Dedicated installation"
echo "(5) Webserver + Dedicated installation"
echo "(6) Webserver only Ioncube, Pecl SSH, Geoip, Qstat and FTP"
echo "(7) Semi-automatic web server installation with requests"
echo ""
echo "(8) Teamspeak 3 + Dedicated installation"
echo "(9) Dedicated installation"
echo "(0) Exit"
fi
echo ""
if [ "$langsel" = "1" ]; then
if [ "$modsel" = "" ]; then
echo -n "Bitte geben Sie ihre Auswahl an: "
else
color r n "Bitte geben Sie entweder 1,2,3,4,5,6,7,8,9 oder 0 ein: "
fi
else
if [ "$modsel" = "" ]; then
echo -n "Please enter your selection: "
else
color r n "Please enter either 1,2,3,4,5,6,7,8,9 or 0: "
fi
fi
read -n 1 modsel
for i in $modsel; do
case "$i" in
'1')
clear
;;
'2')
clear
;;
'3')
clear
;;
'4')
clear
;;
'5')
clear
;;
'6')
clear
;;
'7')
clear
;;
'8')
clear
;;
'9')
clear
;;
'0')
clear
exit 0
;;
*)
modsel=99
clear
select_mode
;;
esac
done
}
##############################
# Select URL #
##############################
function select_url {
clear
if [ "$langsel" = "1" ]; then
echo "Domains Auswahl"
echo ""
else
echo "Domain selection"
echo ""
fi
cd $1
urlcounter=1
for siteurl in $(find * -maxdepth 0 -type d)
do
if [ "$(grep -E '^(([a-zA-Z](-?[a-zA-Z0-9])*)\.)*[a-zA-Z](-?[a-zA-Z0-9])+\.[a-zA-Z]{2,}$' <<< $siteurl)" != "" ]; then
echo "($urlcounter) $siteurl"
let urlcounter=$urlcounter+1
fi
if [ "$urlcounter" -gt 9 ]; then
break
fi
done
echo ""
echo "(0) Exit"
echo ""
if [ "$langsel" = "1" ]; then
if [ "$urlsel" = "" ]; then
echo -n "Bitte geben Sie ihre Auswahl an: "
else
color r n "Bitte geben Sie entweder 1, ... oder 0 ein: "
fi
else
if [ "$urlsel" = "" ]; then
echo -n "Please enter your selection: "
else
color r n "Please enter either 1, ... or 0: "
fi
fi
read -n 1 urlsel
for i in $urlsel; do
case "$i" in
'1')
clear
;;
'2')
clear
;;
'3')
clear
;;
'4')
clear
;;
'5')
clear
;;
'6')
clear
;;
'7')
clear
;;
'8')
clear
;;
'9')
clear
;;
'0')
clear
exit 0
;;
*)
urlsel=99
clear
select_url
;;
esac
done
let urlcounter=$urlcounter-1
if [ "$urlsel" -gt "$urlcounter" ]; then
select_url
fi
urlcounter=1
for siteurl in $(find * -maxdepth 0 -type d)
do
if [ "$(grep -E '^(([a-zA-Z](-?[a-zA-Z0-9])*)\.)*[a-zA-Z](-?[a-zA-Z0-9])+\.[a-zA-Z]{2,}$' <<< $siteurl)" != "" ]; then
if [ "$urlcounter" = "$urlsel" ]; then
site_url=$siteurl
break
else
let urlcounter=$urlcounter+1
fi
fi
done
}
##############################
# Select SSH Keys #
##############################
function select_sshkeys {
clear
if [ "$langsel" = "1" ]; then
echo "SSH Key Auswahl"
echo ""
echo "Sollen eigene SSH Keys generiert werden? Dies wird für den"
echo "ersten beziehungsweise einzigen Server empfohlen."
echo ""
echo "(1) Ja"
echo "(2) Nein"
echo "(3) Exit"
else
echo "SSH Key selection"
echo ""
echo "Should own SSH keys be generated? This is recommended for the"
echo "first or only server."
echo ""
echo "(1) Yes"
echo "(2) No"
echo "(3) Exit"
fi
echo ""
if [ "$langsel" = "1" ]; then
if [ "$sshsel" = "" ]; then
echo -n "Bitte geben Sie ihre Auswahl an: "
else
color r n "Bitte geben Sie entweder 1,2 oder 3 ein: "
fi
else
if [ "$sshsel" = "" ]; then
echo -n "Please enter your selection: "
else
color r n "Please enter either 1,2 or 3: "
fi
fi
read -n 1 sshsel
for i in $sshsel; do
case "$i" in
'1')
clear
;;
'2')
clear
;;
'3')
clear
exit 0
;;
*)
sshsel=99
clear
select_sshkeys
;;
esac
done
}
##############################
# Choose Lang #
##############################
if [ ! -n "$langsel" ]; then
select_lang
fi
gen_logs "" ""
##############################
# Test OS #
##############################
if [ ! -n "$os_install" -a ! -n "$os_name" -a ! -n "$os_version" ]; then
chk_os
fi
if [ ! -n "$os_install" -o ! -n "$os_name" -o ! -n "$os_version" ]; then
clear
if [ "$langsel" = "1" ]; then
color r x "Es wird nur CentOS, Debian, Fedora, Red Hat, SuSE und Ubuntu unterstuetzt."
else
color r x "Only CentOS, Debian, Fedora, Red Hat, SuSE and Ubuntu are supported."
fi
exit 0
fi
if [ ! -n "$yessel" ]; then
yesno=""
if [ "$langsel" = "1" ]; then
select_yesno "Ihr System: $os_name $os_version - $os_typ. Ist dies korrekt?"
else
select_yesno "Your system: $os_name $os_version - $os_typ. Is this correct?"
fi
gen_logs "System: $os_name $os_version - $os_typ" ""
fi
##############################
# Test Root #
##############################
if [ "$(id -u)" != "0" ]; then
su -
fi
if [ "$(id -u)" != "0" ]; then
clear
if [ "$langsel" = "1" ]; then
color r x "Sie benoetigen root Rechte."
else
color r x "You need root privileges."
fi
gen_logs "You need root privileges. Install script was stopped." ""
exit 0
fi
##############################
# Get IP, Hostname #
##############################
local_ip=$(ip route get 8.8.8.8 | awk '{print $NF; exit}')
if [ "$local_ip" = "" ]; then
host_name=$(hostname -fhost_name | awk '{print tolower($0)}')
else
host_name=$(getent hosts $local_ip | awk '{print tolower($2)}' | head -n 1)
fi
if [ "$host_name" = "" ] || [ "$host_name" = "0" ]; then
host_name="$local_ip";
fi
gen_logs "Hostname and IP - $host_name, $local_ip" ""
##############################
# Choose Mode #
##############################
if [ ! -n "$modsel" ]; then
select_mode
fi
chk_netstat
echo "" > /home/tekbase_status.txt
##############################
# Install Libs And Progs #
##############################
if [ ! -n "$yessel" ]; then
yesno=""
if [ "$langsel" = "1" ]; then
select_yesno "Es wird jetzt autoconf, automake, build-essential, curl, expect, gcc, hddtemp,\ndmidecode, lm-sensors, m4, make, net-tools, openjdk, openssl-dev, patch, pwgen,\nscreen, smartmontools, sqlite, sudo, sysstat, unzip und wget installiert."
else
select_yesno "Autoconf, automake, build-essential, curl, expect gcc, hddtemp, dmidecode,\nlm-sensors, m4, make, net-tools, openjdk, openssl-dev, patch, pwgen, screen,\nsmartmontools, sqlite, sudo, sysstat, unzip and wget is now installed."
fi
fi
case "$os_install" in
'1')
clear
if [ "$modsel" != "7" ]; then
chkyes="--non-interactive install"
zypper --non-interactive update
else
chkyes="install"
zypper update
fi
for i in autoconf automake m4 make screen sudo curl wget sqlite sqlite3 expect gcc libssh2-1-devel libopenssl-devel libmp3lame-devel libxml2-devel libxslt-devel libshout-dev libvorbis-devel hddtemp dmidecode lm-sensors net-tools sysstat smartmontools patch pwgen unzip java-1_8_0-openjdk git; do
zypper $chkyes $i
gen_logs "-" "${i}"
done
zypper $chkyes -t pattern devel_basis
;;
'2')
clear
if [ "$modsel" != "7" ]; then
chkyes="-y"
apt-get update && apt-get upgrade -y && apt-get dist-upgrade -y
else
chkyes=""
apt-get update && apt-get upgrade && apt-get dist-upgrade
fi
for i in autoconf automake build-essential m4 make debconf-utils screen sudo curl wget sqlite sqlite3 expect gcc libssh2-1-dev libssl-dev libmp3lame-dev libxml2-dev libshout-dev libvorbis-dev hddtemp dmidecode lm-sensors net-tools sysstat smartmontools patch pwgen unzip git; do
apt-get install $i $chkyes
gen_logs "-" "${i}"
done
if [ "$os_version" -lt "14" -a "$os_name" = "Ubuntu" ] || [ "$os_version" -lt "8" -a "$os_name" = "Debian" ]; then
apt-get install openjdk-7-jre ia32-libs $chkyes
else
apt-get install openjdk-8-jre libcurl3-gnutls:i386 $chkyes
fi
;;
'3')
clear
if [ "$modsel" != "7" ]; then
chkyes="-y"
yum update && yum upgrade -y
else
chkyes=""
yum update && yum upgrade
fi
yum -y install epel-release
yum repolist
for i in autoconf automake m4 make screen sudo curl wget sqlite expect gcc openssl-devel hddtemp dmidecode lm-sensors net-tools sysstat smartmontools patch pwgen unzip java-1.8.0-openjdk git; do
yum install $i $chkyes
gen_logs "-" "${i}"
done
yum groupinstall 'Development Tools' $chkyes
;;
esac
sensors-detect --auto
service kmod start
##############################
# Install Apache, Php, MySQL #
##############################
if [ $modsel -lt 8 ]; then
chk_apache $os_install
if [ "$apache_inst" = "0" ]; then
if [ ! -n "$yessel" ]; then
yesno=""
if [ "$langsel" = "1" ]; then
select_yesno "Apache Webserver nicht gefunden. Dieser wird jetzt installiert."
else
select_yesno "Apache web server not found. This will now be installed."
fi
fi
if [ "$os_install" = "1" ]; then
if [ "$modsel" != "7" ]; then
zypper --non-interactive install apache2
else
zypper install apache2
fi
fi
if [ "$os_install" = "2" ]; then
if [ "$modsel" != "7" ]; then
export DEBIAN_FRONTEND=noninteractive
apt-get install apache2 -y
else
apt-get install apache2
fi
fi
if [ "$os_install" = "3" ]; then
if [ "$modsel" != "7" ]; then
yum install httpd -y
else
yum install httpd
fi
fi
chk_apache $os_install
if [ "$apache_inst" = "0" ]; then
clear
if [ "$langsel" = "1" ]; then
color r x "Der Apache Webserver konnte nicht installiert werden."
color r x "Bitte nehmen Sie die Installation selbst vor."
else
color r x "The Apache web server could not be installed."
color r x "Please install it yourself."
fi
echo "Check apache: error" >> /home/tekbase_status.txt
gen_logs "*** The Apache web server could not be installed." ""
exit 0
fi
echo "Check apache: ok" >> /home/tekbase_status.txt
gen_logs "*** The Apache web server is installed." ""
else
echo "Check apache: ok" >> /home/tekbase_status.txt
fi
if [ ! -n "$yessel" ]; then
yesno=""
if [ "$langsel" = "1" ]; then
select_yesno "Es wird jetzt php, php-common, php-cli, php-curl, php-gd, php-geoip, php-json,\nphp-mail, php-mbstring, php-mysql, php-ssh2, php-xml und php-zip\ninstalliert."
else
select_yesno "Php, php-common, php-cli, php-curl, php-gd, php-geoip, php-json, php-mail,\nphp-mbstring, php-mysql, php-ssh2, php-xml and php-zip is now\ninstalled."
fi
fi
if [ "$os_install" = "1" ]; then
if [ "$os_version" -lt "42" ]; then
for i in apache2-mod-php5 php5 php5-common php5-cli php5-curl php5-devel php5-gd php5-geoip php5-json php5-mail php5-mbstring php5-mysql php5-ssh2 php5-xml php5-zip; do
zypper $chkyes $i
gen_logs "-" "${i}"
done
else
for i in apache2-mod-php7 php7 php7-common php7-cli php7-curl php7-devel php7-gd php7-geoip php7-json php7-mail php7-mbstring php7-mysql php7-ssh2 php7-xml php7-zip; do
zypper $chkyes $i
gen_logs "-" "${i}"
done
fi
fi
if [ "$os_install" = "2" ]; then
if [ "$os_version" -lt "16" -a "$os_name" = "Ubuntu" ] || [ "$os_version" -lt "9" -a "$os_name" = "Debian" ]; then
for i in libapache2-mod-php5 php5 php5-common php5-cli php5-curl php5-dev php5-gd php5-geoip php5-json php5-mail php5-mbstring php5-mysql php5-ssh2 php5-xml php5-zip; do
apt-get install $i $chkyes
gen_logs "-" "${i}"
done
else
for i in libapache2-mod-php php php-common php-cli php-curl php-dev php-gd php-geoip php-json php-mail php-mbstring php-mysql php-ssh2 php-xml php-zip; do
apt-get install $i $chkyes
gen_logs "-" "${i}"
done
fi
fi
if [ "$os_install" = "3" ]; then
for i in php php-common php-cli php-devel php-gd php-json php-mbstring php-mysql php-pecl-ssh2 php-xml php-pecl-zip; do
yum install $i $chkyes
gen_logs "-" "${i}"
done
fi
chk_php $os_install
if [ "$php_inst" = "0" ]; then
clear
if [ "$langsel" = "1" ]; then
color r x "PHP und die Extensions konnten nicht vollstaendig installiert werden."
color r x "Bitte nehmen Sie die Installation selbst vor."
else
color r x "PHP and the extensions could not be installed completely."
color r x "Please install it yourself."
fi
echo "Check php: error" >> /home/tekbase_status.txt
gen_logs "*** PHP could not be installed." ""
exit 0
fi
echo "Check php: ok" >> /home/tekbase_status.txt
gen_logs "*** PHP is installed." ""
chk_mysql $os_install
if [ "$mysql_inst" = "0" ]; then
if [ ! -n "$yessel" ]; then
yesno=""
if [ "$langsel" = "1" ]; then
select_yesno "MySQL/MariaDB Server nicht gefunden. Dieser wird jetzt installiert."
else
select_yesno "MySQL/MariaDB server not found. This will now be installed."
fi
fi
if [ "$os_install" = "1" ]; then
zypper $chkyes mariadb mariadb-tools
service mysql restart
fi
if [ "$os_install" = "2" ]; then
if [ "$modsel" != "7" ]; then
export DEBIAN_FRONTEND=noninteractive
fi
mysqlpwd=$(gen_passwd 8)
echo "MySQL root password: $mysqlpwd" > /home/tekbase_mysql.txt
if [ "$os_version" -lt "16" -a "$os_name" = "Ubuntu" ] || [ "$os_version" -lt "9" -a "$os_name" = "Debian" ]; then
mysqlpwd=$(gen_passwd 8)
if [ "$modsel" != "7" ]; then
debconf-set-selections <<< "mysql-server mysql-server/root_password password $mysqlpwd"
debconf-set-selections <<< "mysql-server mysql-server/root_password_again password $mysqlpwd"
fi
apt-get install mysql-server mysql-client mysql-common $chkyes
else
if [ "$modsel" != "7" ]; then
debconf-set-selections <<< "mariadb-server mysql-server/root_password password $mysqlpwd"
debconf-set-selections <<< "mariadb-server mysql-server/root_password_again password $mysqlpwd"
fi
apt-get install mariadb-server mariadb-client $chkyes
fi
service mysql restart
fi
if [ "$os_install" = "3" ]; then
yum install mariadb mariadb-server $chkyes
service mariadb restart
fi
chk_mysql $os_install
if [ "$mysql_inst" = "0" ]; then
clear
if [ "$langsel" = "1" ]; then
color r x "Der MySQL/MariaDB Server konnte nicht installiert werden."
color r x "Bitte nehmen Sie die Installation selbst vor."
else
color r x "The MySQL/MariaDB server could not be installed."
color r x "Please install it yourself."
fi
echo "Check mysql: error" >> /home/tekbase_status.txt
exit 0
fi
echo "Check mysql: ok" >> /home/tekbase_status.txt
else
mysqlpwd=""
echo "Check mysql: ok" >> /home/tekbase_status.txt
fi
fi
##############################
# Check Php Version And Path #
##############################
if [ $modsel -lt 8 ]; then
service apache2 restart
php_ioncube=$(php -m | grep -i "ioncube")
# php_geoip=$(php -m | grep -i "geoip")
php_ssh=$(php -m | grep -i "ssh2")
# php_gd=$(php -m | grep -i "gd")
php_version=$(php -r "echo PHP_MAJOR_VERSION.'.'.PHP_MINOR_VERSION;")
php_inidir=$(php -r "echo PHP_CONFIG_FILE_PATH;")
php_extdir=$(php -r "echo PHP_EXTENSION_DIR;")
php_exinidir=$(php -r "echo PHP_CONFIG_FILE_SCAN_DIR;")
php_dir=$(dirname "$php_inidir");