forked from centminmod/centminmod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
installer-gitlab.sh
executable file
·1207 lines (1128 loc) · 44.8 KB
/
installer-gitlab.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
#######################################################
# centminmod.com cli installer
# To run installer.sh type:
# curl -4sL https://gist.github.com/centminmod/dbe765784e03bc4b0d40/raw/installer.sh | bash
#######################################################
export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"
DT=$(date +"%d%m%y-%H%M%S")
DNF_ENABLE='n'
DNF_COPR='y'
branchname=123.09beta01
DOWNLOAD="${branchname}.zip"
LOCALCENTMINMOD_MIRROR='https://centminmod.com'
INSTALLDIR='/usr/local/src'
DIR_TMP='/svr-setup'
#CUR_DIR="/usr/local/src/centminmod-${branchname}"
#CM_INSTALLDIR=$CUR_DIR
#SCRIPT_DIR=$(readlink -f $(dirname ${BASH_SOURCE[0]}))
#####################################################
# Centmin Mod Git Repo URL - primary repo
# https://github.com/centminmod/centminmod
GITINSTALLED='y'
#CMGIT='https://github.com/centminmod/centminmod.git'
# Gitlab backup repo
# https://gitlab.com/centminmod/centminmod
CMGIT='https://gitlab.com/centminmod/centminmod.git'
#####################################################
# wget renamed github
AXEL='n'
AXEL_VER='2.6'
AXEK_LINKFILE="axel-${AXEL_VER}.tar.gz"
AXEK_LINK="https://github.com/eribertomota/axel/archive/${AXEL_VER}.tar.gz"
AXEK_LINKLOCAL="${LOCALCENTMINMOD_MIRROR}/centminmodparts/axel/${AXEL_VER}.tar.gz"
#######################################################
ALTPCRE_VERSION='8.41'
ALTPCRELINKFILE="pcre-${ALTPCRE_VERSION}.tar.gz"
ALTPCRELINK="${LOCALCENTMINMOD_MIRROR}/centminmodparts/pcre/${ALTPCRELINKFILE}"
WGET_VERSION='1.19.1'
WGET_FILENAME="wget-${WGET_VERSION}.tar.gz"
WGET_LINK="https://centminmod.com/centminmodparts/wget/${WGET_FILENAME}"
###########################################################
# Setup Colours
black='\E[30;40m'
red='\E[31;40m'
green='\E[32;40m'
yellow='\E[33;40m'
blue='\E[34;40m'
magenta='\E[35;40m'
cyan='\E[36;40m'
white='\E[37;40m'
boldblack='\E[1;30;40m'
boldred='\E[1;31;40m'
boldgreen='\E[1;32;40m'
boldyellow='\E[1;33;40m'
boldblue='\E[1;34;40m'
boldmagenta='\E[1;35;40m'
boldcyan='\E[1;36;40m'
boldwhite='\E[1;37;40m'
Reset="tput sgr0" # Reset text attributes to normal
#+ without clearing screen.
cecho () # Coloured-echo.
# Argument $1 = message
# Argument $2 = color
{
message=$1
color=$2
echo -e "$color$message" ; $Reset
return
}
###########################################################
#
# set locale temporarily to english
# due to some non-english locale issues
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LANGUAGE=en_US.UTF-8
export LC_CTYPE=en_US.UTF-8
shopt -s expand_aliases
for g in "" e f; do
alias ${g}grep="LC_ALL=C ${g}grep" # speed-up grep, egrep, fgrep
done
CENTOSVER=$(awk '{ print $3 }' /etc/redhat-release)
if [ "$CENTOSVER" == 'release' ]; then
CENTOSVER=$(awk '{ print $4 }' /etc/redhat-release | cut -d . -f1,2)
if [[ "$(cat /etc/redhat-release | awk '{ print $4 }' | cut -d . -f1)" = '7' ]]; then
CENTOS_SEVEN='7'
fi
fi
if [[ "$(cat /etc/redhat-release | awk '{ print $3 }' | cut -d . -f1)" = '6' ]]; then
CENTOS_SIX='6'
fi
if [ "$CENTOSVER" == 'Enterprise' ]; then
CENTOSVER=$(cat /etc/redhat-release | awk '{ print $7 }')
OLS='y'
fi
if [[ -f /etc/system-release && "$(awk '{print $1,$2,$3}' /etc/system-release)" = 'Amazon Linux AMI' ]]; then
CENTOS_SIX='6'
fi
if [ -f /proc/user_beancounters ]; then
# CPUS='1'
# MAKETHREADS=" -j$CPUS"
# speed up make
CPUS=$(grep -c "processor" /proc/cpuinfo)
if [[ "$CPUS" -gt '8' ]]; then
CPUS=$(echo $(($CPUS+2)))
else
CPUS=$(echo $(($CPUS+1)))
fi
MAKETHREADS=" -j$CPUS"
else
# speed up make
CPUS=$(grep -c "processor" /proc/cpuinfo)
if [[ "$CPUS" -gt '8' ]]; then
CPUS=$(echo $(($CPUS+4)))
elif [[ "$CPUS" -eq '8' ]]; then
CPUS=$(echo $(($CPUS+2)))
else
CPUS=$(echo $(($CPUS+1)))
fi
MAKETHREADS=" -j$CPUS"
fi
if [[ "$CENTOS_SEVEN" = '7' ]]; then
AXEL_VER='2.12'
AXEK_LINKFILE="axel-${AXEL_VER}.tar.gz"
AXEK_LINK="https://github.com/eribertomota/axel/archive/${AXEL_VER}.tar.gz"
AXEK_LINKLOCAL="${LOCALCENTMINMOD_MIRROR}/centminmodparts/axel/${AXEL_VER}.tar.gz"
fi
if [ -f /etc/centminmod/custom_config.inc ]; then
source /etc/centminmod/custom_config.inc
fi
if [[ "$(uname -m)" = 'x86_64' ]]; then
if [ ! "$(grep -w 'exclude' /etc/yum.conf)" ]; then
ex -s /etc/yum.conf << EOF
:/plugins=1/
:a
exclude=*.i386 *.i586 *.i686
.
:w
:q
EOF
fi
fi
if [[ "$CENTOS_SEVEN" = '7' && "$DNF_ENABLE" = [yY] ]]; then
if [[ $(rpm -q epel-release >/dev/null 2>&1; echo $?) != '0' ]]; then
yum -y -q install epel-release
yum clean all
fi
if [[ "$DNF_COPR" = [yY] ]]; then
cat > "/etc/yum.repos.d/dnf-centos.repo" <<EOF
[dnf-centos]
name=Copr repo for dnf-centos owned by @rpm-software-management
baseurl=https://copr-be.cloud.fedoraproject.org/results/@rpm-software-management/dnf-centos/epel-7-\$basearch/
skip_if_unavailable=True
gpgcheck=1
gpgkey=https://copr-be.cloud.fedoraproject.org/results/@rpm-software-management/dnf-centos/pubkey.gpg
enabled=1
enabled_metadata=1
EOF
fi
if [[ ! -f /usr/bin/dnf ]]; then
yum -y -q install dnf
dnf clean all
fi
if [ ! "$(grep -w 'exclude' /etc/dnf/dnf.conf)" ]; then
echo "excludepkgs=*.i386 *.i586 *.i686" >> /etc/dnf/dnf.conf
fi
if [ ! "$(grep -w 'fastestmirror=true' /etc/dnf/dnf.conf)" ]; then
echo "fastestmirror=true" >> /etc/dnf/dnf.conf
fi
if [ -f /etc/yum.repos.d/rpmforge.repo ]; then
sed -i 's|enabled .*|enabled = 0|g' /etc/yum.repos.d/rpmforge.repo
DISABLEREPO_DNF=' --disablerepo=rpmforge'
YUMDNFBIN="dnf${DISABLEREPO_DNF}"
else
DISABLEREPO_DNF=""
YUMDNFBIN='dnf'
fi
else
YUMDNFBIN='yum'
if [ -f /etc/yum.repos.d/rpmforge.repo ]; then
DISABLEREPO_DNF=' --disablerepo=rpmforge'
else
DISABLEREPO_DNF=""
fi
fi
if [ ! -f /usr/bin/sar ]; then
time $YUMDNFBIN -y -q install sysstat${DISABLEREPO_DNF}
if [[ "$(uname -m)" = 'x86_64' ]]; then
SARCALL='/usr/lib64/sa/sa1'
else
SARCALL='/usr/lib/sa/sa1'
fi
if [[ "$CENTOS_SEVEN" != '7' ]]; then
sed -i 's|10|5|g' /etc/cron.d/sysstat
if [ -d /etc/cron.d ]; then
echo '* * * * * root /usr/lib64/sa/sa1 1 1' > /etc/cron.d/cmsar
fi
service sysstat restart
chkconfig sysstat on
else
sed -i 's|10|5|g' /etc/cron.d/sysstat
if [ -d /etc/cron.d ]; then
echo '* * * * * root /usr/lib64/sa/sa1 1 1' > /etc/cron.d/cmsar
fi
systemctl restart sysstat.service
systemctl enable sysstat.service
fi
elif [ -f /usr/bin/sar ]; then
if [[ "$(uname -m)" = 'x86_64' ]]; then
SARCALL='/usr/lib64/sa/sa1'
else
SARCALL='/usr/lib/sa/sa1'
fi
if [[ "$CENTOS_SEVEN" != '7' ]]; then
sed -i 's|10|5|g' /etc/cron.d/sysstat
if [ -d /etc/cron.d ]; then
echo '* * * * * root /usr/lib64/sa/sa1 1 1' > /etc/cron.d/cmsar
fi
service sysstat restart
chkconfig sysstat on
else
sed -i 's|10|5|g' /etc/cron.d/sysstat
if [ -d /etc/cron.d ]; then
echo '* * * * * root /usr/lib64/sa/sa1 1 1' > /etc/cron.d/cmsar
fi
systemctl restart sysstat.service
systemctl enable sysstat.service
fi
fi
if [ -f /proc/user_beancounters ]; then
echo "OpenVZ system detected, NTP not installed"
else
if [ ! -f /usr/sbin/ntpd ]; then
echo "*************************************************"
echo "* Installing NTP (and syncing time)"
echo "*************************************************"
echo "The date/time before was:"
date
echo
time $YUMDNFBIN -y install ntp${DISABLEREPO_DNF}
chkconfig ntpd on
if [ -f /etc/ntp.conf ]; then
if [[ -z "$(grep 'logfile' /etc/ntp.conf)" ]]; then
echo "logfile /var/log/ntpd.log" >> /etc/ntp.conf
ls -lahrt /var/log | grep 'ntpd.log'
fi
echo "current ntp servers"
NTPSERVERS=$(awk '/server / {print $2}' /etc/ntp.conf | grep ntp.org | sort -r)
for s in $NTPSERVERS; do
if [ -f /usr/bin/nc ]; then
echo -ne "\n$s test connectivity: "
if [[ "$(echo | nc -u -w1 $s 53 >/dev/null 2>&1 ;echo $?)" = '0' ]]; then
echo " ok"
else
echo " error"
fi
fi
ntpdate -q $s | tail -1
if [[ -f /etc/ntp/step-tickers && -z "$(grep $s /etc/ntp/step-tickers )" ]]; then
echo "$s" >> /etc/ntp/step-tickers
fi
done
if [ -f /etc/ntp/step-tickers ]; then
echo -e "\nsetup /etc/ntp/step-tickers server list\n"
cat /etc/ntp/step-tickers
fi
service ntpd restart >/dev/null 2>&1
echo -e "\ncheck ntpd peers list"
ntpdc -p
fi
echo "The date/time is now:"
date
fi
fi
# only run for CentOS 6.x
if [[ "$CENTOS_SEVEN" != '7' ]]; then
echo ""
echo "Check for existing mysql-server packages"
OLDMYSQLSERVER=`rpm -qa | grep 'mysql-server' | head -n1`
if [[ ! -z "$OLDMYSQLSERVER" ]]; then
echo "rpm -e --nodeps $OLDMYSQLSERVER"
rpm -e --nodeps $OLDMYSQLSERVER
fi
fi # CENTOS_SEVEN != 7
# only run for CentOS 7.x
if [[ "$CENTOS_SEVEN" = '7' ]]; then
echo ""
echo "Check for existing mariadb packages"
OLDMYSQLSERVER=`rpm -qa | grep 'mariadb-server' | head -n1`
if [[ ! -z "$OLDMYSQLSERVER" ]]; then
echo "rpm -e --nodeps $OLDMYSQLSERVER"
rpm -e --nodeps $OLDMYSQLSERVER
fi
echo ""
echo "Check for existing mariadb-libs package"
OLDMYSQL_LIBS=`rpm -qa | grep 'mariadb-libs' | head -n1`
if [[ ! -z "$OLDMYSQL_LIBS" ]]; then
# echo "rpm -e --nodeps $OLDMYSQL_LIBS"
# rpm -e --nodeps $OLDMYSQL_LIBS
echo "yum -y remove mariadb-libs"
yum -y remove mariadb-libs
fi
echo ""
# Should not exist on CentOS 7 systems
echo "Check for existing MySQL-shared-compat"
OLDMYSQL_SHAREDCOMPAT=`rpm -qa | grep 'MySQL-shared-compat' | head -n1`
if [[ ! -z "$OLDMYSQL_SHAREDCOMPAT" ]]; then
echo "yum -y remove MySQL-shared-compat"
yum -y remove MySQL-shared-compat
fi
fi # CENTOS_SEVEN != 7
sar_call() {
$SARCALL 1 1
}
systemstats() {
if [ -d /root/centminlogs ]; then
sar -u > /root/centminlogs/sar-u-installstats.log
sar -q > /root/centminlogs/sar-q-installstats.log
sar -r > /root/centminlogs/sar-r-installstats.log
if [ ! -f /proc/user_beancounters ]; then
sar -d > /root/centminlogs/sar-d-installstats.log
fi
sar -b > /root/centminlogs/sar-b-installstats.log
if [[ "$(hostname -f 2>&1 | grep -w 'Unknown host')" ]]; then
SERVERHOSTNAME=$(hostname)
else
SERVERHOSTNAME=$(hostname -f)
fi
sed -i "s|$SERVERHOSTNAME|hostname|" /root/centminlogs/sar-u-installstats.log
sed -i "s|$SERVERHOSTNAME|hostname|" /root/centminlogs/sar-q-installstats.log
sed -i "s|$SERVERHOSTNAME|hostname|" /root/centminlogs/sar-r-installstats.log
if [ ! -f /proc/user_beancounters ]; then
sed -i "s|$SERVERHOSTNAME|hostname|" /root/centminlogs/sar-d-installstats.log
fi
sed -i "s|$SERVERHOSTNAME|hostname|" /root/centminlogs/sar-b-installstats.log
if [[ "$CENTOS_SEVEN" = '7' ]]; then
if [[ "$(uname -m)" = 'x86_64' ]]; then
if [ -f /var/cache/yum/x86_64/7/timedhosts.txt ]; then
sort -k2 /var/cache/yum/x86_64/7/timedhosts.txt > /root/centminlogs/yum-timedhosts.txt
fi
fi
else
if [[ "$(uname -m)" = 'x86_64' ]]; then
if [ -f /var/cache/yum/timedhosts.txt ]; then
sort -k2 /var/cache/yum/timedhosts.txt > /root/centminlogs/yum-timedhosts.txt
fi
else
if [ -f /var/cache/yum/i386/6/timedhosts.txt ]; then
sort -k2 /var/cache/yum/i386/6/timedhosts.txt > /root/centminlogs/yum-timedhosts.txt
fi
fi
fi
fi
if [ -f /etc/cron.d/cmsar ]; then
rm -rf /etc/cron.d/cmsar
fi
}
scl_install() {
# if gcc version is less than 4.7 (407) install scl collection yum repo
if [[ "$CENTOS_SIX" = '6' ]]; then
# if devtoolset exists, enable it first before checking gcc versions
if [[ "$DEVTOOLSETSIX" = [yY] ]]; then
if [[ -f /opt/rh/devtoolset-6/root/usr/bin/gcc && -f /opt/rh/devtoolset-6/root/usr/bin/g++ ]]; then
source /opt/rh/devtoolset-6/enable
fi
else
if [[ -f /opt/rh/devtoolset-4/root/usr/bin/gcc && -f /opt/rh/devtoolset-4/root/usr/bin/g++ ]]; then
source /opt/rh/devtoolset-4/enable
fi
fi
if [[ "$(gcc --version | head -n1 | awk '{print $3}' | cut -d . -f1,2 | sed "s|\.|0|")" -lt '407' ]]; then
echo "install centos-release-scl for newer gcc and g++ versions"
if [[ -z "$(rpm -qa | grep rpmforge)" ]]; then
time $YUMDNFBIN -y -q install centos-release-scl
sar_call
else
time $YUMDNFBIN -y -q install centos-release-scl --disablerepo=rpmforge
sar_call
fi
if [[ "$DEVTOOLSETSIX" = [yY] ]]; then
if [[ -z "$(rpm -qa | grep rpmforge)" ]]; then
time $YUMDNFBIN -y -q install devtoolset-6-gcc devtoolset-6-gcc-c++ devtoolset-6-binutils
sar_call
else
time $YUMDNFBIN -y -q install devtoolset-6-gcc devtoolset-6-gcc-c++ devtoolset-6-binutils --disablerepo=rpmforge
sar_call
fi
echo
/opt/rh/devtoolset-6/root/usr/bin/gcc --version
/opt/rh/devtoolset-6/root/usr/bin/g++ --version
else
if [[ -z "$(rpm -qa | grep rpmforge)" ]]; then
time $YUMDNFBIN -y -q install devtoolset-4-gcc devtoolset-4-gcc-c++ devtoolset-4-binutils
sar_call
else
time $YUMDNFBIN -y -q install devtoolset-4-gcc devtoolset-4-gcc-c++ devtoolset-4-binutils --disablerepo=rpmforge
sar_call
fi
echo
/opt/rh/devtoolset-4/root/usr/bin/gcc --version
/opt/rh/devtoolset-4/root/usr/bin/g++ --version
fi
fi
elif [[ "$CENTOS_SEVEN" = '7' ]]; then
if [[ -z "$(rpm -qa | grep rpmforge)" ]]; then
time $YUMDNFBIN -y -q install centos-release-scl
sar_call
else
time $YUMDNFBIN -y -q install centos-release-scl --disablerepo=rpmforge
sar_call
fi
if [[ "$DEVTOOLSETSIX" = [yY] ]]; then
if [[ -z "$(rpm -qa | grep rpmforge)" ]]; then
time $YUMDNFBIN -y -q install devtoolset-6-gcc devtoolset-6-gcc-c++ devtoolset-6-binutils
sar_call
else
time $YUMDNFBIN -y -q install devtoolset-6-gcc devtoolset-6-gcc-c++ devtoolset-6-binutils --disablerepo=rpmforge
sar_call
fi
echo
/opt/rh/devtoolset-6/root/usr/bin/gcc --version
/opt/rh/devtoolset-6/root/usr/bin/g++ --version
else
if [[ -z "$(rpm -qa | grep rpmforge)" ]]; then
time $YUMDNFBIN -y -q install devtoolset-4-gcc devtoolset-4-gcc-c++ devtoolset-4-binutils
sar_call
else
time $YUMDNFBIN -y -q install devtoolset-4-gcc devtoolset-4-gcc-c++ devtoolset-4-binutils --disablerepo=rpmforge
sar_call
fi
echo
/opt/rh/devtoolset-4/root/usr/bin/gcc --version
/opt/rh/devtoolset-4/root/usr/bin/g++ --version
fi
fi # centos 6 only needed
}
gccdevtools() {
if [[ ! -f /opt/rh/devtoolset-4/root/usr/bin/gcc || ! -f /opt/rh/devtoolset-4/root/usr/bin/g++ || ! -f /opt/rh/devtoolset-6/root/usr/bin/gcc || ! -f /opt/rh/devtoolset-6/root/usr/bin/g++ ]] && [[ "$CENTOS_SIX" = '6' ]]; then
scl_install
unset CC
unset CXX
if [[ "$DEVTOOLSETSIX" = [yY] ]]; then
export CC="/opt/rh/devtoolset-6/root/usr/bin/gcc"
export CXX="/opt/rh/devtoolset-6/root/usr/bin/g++"
else
export CC="/opt/rh/devtoolset-4/root/usr/bin/gcc"
export CXX="/opt/rh/devtoolset-4/root/usr/bin/g++"
fi
elif [[ "$DEVTOOLSETSIX" = [yY] && -f /opt/rh/devtoolset-6/root/usr/bin/gcc && -f /opt/rh/devtoolset-6/root/usr/bin/g++ ]] && [[ "$(gcc --version | head -n1 | awk '{print $3}' | cut -d . -f1,2 | sed "s|\.|0|")" -lt '407' ]]; then
unset CC
unset CXX
export CC="/opt/rh/devtoolset-6/root/usr/bin/gcc"
export CXX="/opt/rh/devtoolset-6/root/usr/bin/g++"
elif [[ -f /opt/rh/devtoolset-4/root/usr/bin/gcc && -f /opt/rh/devtoolset-4/root/usr/bin/g++ ]] && [[ "$(gcc --version | head -n1 | awk '{print $3}' | cut -d . -f1,2 | sed "s|\.|0|")" -lt '407' ]]; then
unset CC
unset CXX
export CC="/opt/rh/devtoolset-4/root/usr/bin/gcc"
export CXX="/opt/rh/devtoolset-4/root/usr/bin/g++"
fi
}
source_pcreinstall() {
if [[ "$(/usr/local/bin/pcre-config --version 2>&1 | grep -q ${ALTPCRE_VERSION} >/dev/null 2>&1; echo $?)" != '0' ]]; then
cd "$DIR_TMP"
cecho "Download $ALTPCRELINKFILE ..." $boldyellow
if [ -s "$ALTPCRELINKFILE" ]; then
cecho "$ALTPCRELINKFILE Archive found, skipping download..." $boldgreen
else
wget -c4 --progress=bar "$ALTPCRELINK" --tries=3
ERROR=$?
if [[ "$ERROR" != '0' ]]; then
cecho "Error: $ALTPCRELINKFILE download failed." $boldgreen
exit #$ERROR
else
cecho "Download done." $boldyellow
fi
fi
tar xzf "$ALTPCRELINKFILE"
ERROR=$?
if [[ "$ERROR" != '0' ]]; then
cecho "Error: $ALTPCRELINKFILE extraction failed." $boldgreen
exit #$ERROR
else
cecho "$ALTPCRELINKFILE valid file." $boldyellow
echo ""
fi
cd "pcre-${ALTPCRE_VERSION}"
./configure --enable-utf8 --enable-unicode-properties --enable-pcre16 --enable-pcre32 --enable-pcregrep-libz --enable-pcregrep-libbz2 --enable-pcretest-libreadline --enable-jit
sar_call
make${MAKETHREADS}
sar_call
make install
sar_call
/usr/local/bin/pcre-config --version
fi
}
source_wgetinstall() {
if [[ "$(/usr/local/bin/wget -V | head -n1 | awk '{print $3}' | grep -q ${WGET_VERSION} >/dev/null 2>&1; echo $?)" != '0' ]]; then
cd "$DIR_TMP"
cecho "Download $WGET_FILENAME ..." $boldyellow
if [ -s "$WGET_FILENAME" ]; then
cecho "$WGET_FILENAME Archive found, skipping download..." $boldgreen
else
wget -c4 --progress=bar "$WGET_LINK" -O "$WGET_FILENAME" --tries=3
ERROR=$?
if [[ "$ERROR" != '0' ]]; then
cecho "Error: $WGET_FILENAME download failed." $boldgreen
exit #$ERROR
else
cecho "Download done." $boldyellow
fi
fi
tar xzf "$WGET_FILENAME"
ERROR=$?
if [[ "$ERROR" != '0' ]]; then
cecho "Error: $WGET_FILENAME extraction failed." $boldgreen
exit #$ERROR
else
cecho "$WGET_FILENAME valid file." $boldyellow
echo ""
fi
cd "wget-${WGET_VERSION}"
gccdevtools
make clean
if [[ "$(uname -m)" = 'x86_64' ]]; then
export CFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic"
export PCRE_CFLAGS="-I /usr/local/include"
export PCRE_LIBS="-L /usr/local/lib -lpcre"
else
export CFLAGS="-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m32 -mtune=generic"
export PCRE_CFLAGS="-I /usr/local/include"
export PCRE_LIBS="-L /usr/local/lib -lpcre"
if [ -f /root/.wgetrc ]; then
\cp -fp /root/.wgetrc /root/.wgetrc-bak
echo "ca_certificate=/etc/pki/tls/certs/ca-bundle.crt" > /root/.wgetrc
else
echo "ca_certificate=/etc/pki/tls/certs/ca-bundle.crt" > /root/.wgetrc
fi
fi
# ./configure --with-ssl=openssl PCRE_CFLAGS="-I /usr/local/include" PCRE_LIBS="-L /usr/local/lib -lpcre"
./configure --with-ssl=openssl
sar_call
make${MAKETHREADS}
sar_call
make install
sar_call
echo "/usr/local/lib/" > /etc/ld.so.conf.d/wget.conf
ldconfig
if [[ ! "$(grep '^alias wget' /root/.bashrc)" ]]; then
echo "alias wget='/usr/local/bin/wget'" >> /root/.bashrc
fi
. /root/.bashrc
echo
cecho "--------------------------------------------------------" $boldgreen
echo "ldconfig -p | grep libpcre.so.1"
ldconfig -p | grep libpcre.so.1
echo
echo "ldd $(which wget)"
ldd $(which wget)
cecho "--------------------------------------------------------" $boldgreen
cecho "wget -V" $boldyellow
wget -V
cecho "--------------------------------------------------------" $boldgreen
cecho "wget ${WGET_VERSION} installed at /usr/local/bin/wget" $boldyellow
cecho "--------------------------------------------------------" $boldgreen
unset CFLAGS
echo
fi
}
fileperm_fixes() {
if [ -f /usr/lib/udev/rules.d/60-net.rules ]; then
if [[ "$(lsattr /usr/lib/udev/rules.d/60-net.rules | cut -c5)" = 'i' ]]; then
# fix for some centos 7 vps templates on vps hosts setting chattr +i on
# /usr/lib/udev/rules.d/60-net.rules preventing yum updates for initscripts
# yum packages
chattr -i /usr/lib/udev/rules.d/60-net.rules
fi
fi
}
libc_fix() {
# https://community.centminmod.com/posts/52555/
if [[ "$CENTOS_SEVEN" -eq '7' && ! -f /etc/yum/pluginconf.d/versionlock.conf && "$(rpm -qa libc-client)" = 'libc-client-2007f-16.el7.x86_64' ]]; then
yum -y install yum-plugin-versionlock uw-imap-devel
yum versionlock libc-client uw-imap-devel
elif [[ "$CENTOS_SEVEN" -eq '7' && ! -f /etc/yum/pluginconf.d/versionlock.conf && "$(rpm -qa libc-client)" != 'libc-client-2007f-16.el7.x86_64' ]]; then
INIT_DIR=$(echo $PWD)
cd /svr-setup
wget https://centminmod.com/centminmodparts/uw-imap/libc-client-2007f-16.el7.x86_64.rpm
wget https://centminmod.com/centminmodparts/uw-imap/uw-imap-devel-2007f-16.el7.x86_64.rpm
yum -y remove libc-client
yum -y localinstall libc-client-2007f-16.el7.x86_64.rpm uw-imap-devel-2007f-16.el7.x86_64.rpm
yum -y install yum-plugin-versionlock
yum versionlock libc-client uw-imap-devel uw-imap-devel
cd "$INIT_DIR"
elif [[ "$CENTOS_SEVEN" -eq '7' && -f /etc/yum/pluginconf.d/versionlock.conf && "$(rpm -qa libc-client)" != 'libc-client-2007f-16.el7.x86_64' ]]; then
INIT_DIR=$(echo $PWD)
cd /svr-setup
wget https://centminmod.com/centminmodparts/uw-imap/libc-client-2007f-16.el7.x86_64.rpm
wget https://centminmod.com/centminmodparts/uw-imap/uw-imap-devel-2007f-16.el7.x86_64.rpm
yum versionlock delete libc-client uw-imap-devel
yum -y remove libc-client
yum -y localinstall libc-client-2007f-16.el7.x86_64.rpm uw-imap-devel-2007f-16.el7.x86_64.rpm
yum versionlock libc-client uw-imap-devel uw-imap-devel
cd "$INIT_DIR"
fi
}
opt_tcp() {
#######################################################
# check if custom open file descriptor limits already exist
LIMITSCONFCHECK=`grep '* hard nofile 262144' /etc/security/limits.conf`
if [[ -z $LIMITSCONFCHECK ]]; then
# Set VPS hard/soft limits
echo "* soft nofile 262144" >>/etc/security/limits.conf
echo "* hard nofile 262144" >>/etc/security/limits.conf
# https://community.centminmod.com/posts/52406/
if [[ "$CENTOS_SEVEN" = '7' && ! -f /etc/rc.d/rc.local ]]; then
cat > /usr/lib/systemd/system/rc-local.service <<EOF
# This unit gets pulled automatically into multi-user.target by
# systemd-rc-local-generator if /etc/rc.d/rc.local is executable.
[Unit]
Description=/etc/rc.d/rc.local Compatibility
ConditionFileIsExecutable=/etc/rc.d/rc.local
After=network.target
[Service]
Type=forking
ExecStart=/etc/rc.d/rc.local start
TimeoutSec=0
RemainAfterExit=yes
EOF
cat > /etc/rc.d/rc.local <<EOF
#!/bin/bash
# THIS FILE IS ADDED FOR COMPATIBILITY PURPOSES
#
# It is highly advisable to create own systemd services or udev rules
# to run scripts during boot instead of using this file.
#
# In contrast to previous versions due to parallel execution during boot
# this script will NOT be run after all other services.
#
# Please note that you must run 'chmod +x /etc/rc.d/rc.local' to ensure
# that this script will be executed during boot.
touch /var/lock/subsys/local
EOF
# remove non-standard centos 7 service file if detected
if [ -f /etc/systemd/system/rc-local.service ]; then
echo "cat /etc/systemd/system/rc-local.service"
cat /etc/systemd/system/rc-local.service
echo
rm -rf /etc/systemd/system/rc-local.service
rm -rf /var/lock/subsys/local
systemctl daemon-reload
systemctl stop rc-local.service
fi
chmod +x /etc/rc.d/rc.local
pushd /etc; ln -s rc.d/rc.local /etc/rc.local; popd
systemctl daemon-reload
systemctl start rc-local.service
systemctl status rc-local.service
fi
ulimit -n 262144
echo "ulimit -n 262144" >> /etc/rc.local
fi # check if custom open file descriptor limits already exist
if [[ "$CENTOS_SEVEN" = '7' ]]; then
# centos 7
if [[ -f /etc/security/limits.d/20-nproc.conf ]]; then
cat > "/etc/security/limits.d/20-nproc.conf" <<EOF
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
* soft nproc 8192
* hard nproc 8192
nginx soft nproc 32278
nginx hard nproc 32278
root soft nproc unlimited
EOF
fi
else
# centos 6
if [[ -f /etc/security/limits.d/90-nproc.conf ]]; then
cat > "/etc/security/limits.d/90-nproc.conf" <<EOF
# Default limit for number of user's processes to prevent
# accidental fork bombs.
# See rhbz #432903 for reasoning.
* soft nproc 8192
* hard nproc 8192
nginx soft nproc 32278
nginx hard nproc 32278
root soft nproc unlimited
EOF
fi # raise user process limits
fi
if [[ ! -f /proc/user_beancounters ]]; then
if [[ "$CENTOS_SEVEN" = '7' ]]; then
if [ -d /etc/sysctl.d ]; then
# centos 7
touch /etc/sysctl.d/101-sysctl.conf
if [[ "$(grep 'centminmod added' /etc/sysctl.d/101-sysctl.conf >/dev/null 2>&1; echo $?)" != '0' ]]; then
# raise hashsize for conntrack entries
echo 65536 > /sys/module/nf_conntrack/parameters/hashsize
if [[ "$(grep 'hashsize' /etc/rc.local >/dev/null 2>&1; echo $?)" != '0' ]]; then
echo "echo 65536 > /sys/module/nf_conntrack/parameters/hashsize" >> /etc/rc.local
fi
cat >> "/etc/sysctl.d/101-sysctl.conf" <<EOF
# centminmod added
fs.nr_open=12000000
fs.file-max=9000000
net.core.wmem_max=16777216
net.core.rmem_max=16777216
net.ipv4.tcp_rmem=8192 87380 16777216
net.ipv4.tcp_wmem=8192 65536 16777216
net.core.netdev_max_backlog=8192
net.core.somaxconn=8151
net.core.optmem_max=8192
net.ipv4.tcp_fin_timeout=10
net.ipv4.tcp_keepalive_intvl=30
net.ipv4.tcp_keepalive_probes=3
net.ipv4.tcp_keepalive_time=240
net.ipv4.tcp_max_syn_backlog=8192
net.ipv4.tcp_sack=1
net.ipv4.tcp_syn_retries=3
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_tw_reuse = 0
net.ipv4.tcp_max_tw_buckets = 1440000
vm.swappiness=10
vm.min_free_kbytes=65536
net.ipv4.ip_local_port_range=1024 65535
net.ipv4.tcp_slow_start_after_idle=0
net.ipv4.tcp_limit_output_bytes=65536
net.ipv4.tcp_rfc1337=1
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.all.log_martians = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.all.secure_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.default.log_martians = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.secure_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_ignore_bogus_error_responses = 1
net.netfilter.nf_conntrack_helper=0
net.nf_conntrack_max = 524288
net.netfilter.nf_conntrack_tcp_timeout_established = 28800
net.netfilter.nf_conntrack_generic_timeout = 60
net.ipv4.tcp_challenge_ack_limit = 999999999
EOF
/sbin/sysctl --system
fi
fi
else
# centos 6
if [[ "$(grep 'centminmod added' /etc/sysctl.conf >/dev/null 2>&1; echo $?)" != '0' ]]; then
# raise hashsize for conntrack entries
echo 65536 > /sys/module/nf_conntrack/parameters/hashsize
if [[ "$(grep 'hashsize' /etc/rc.local >/dev/null 2>&1; echo $?)" != '0' ]]; then
echo "echo 65536 > /sys/module/nf_conntrack/parameters/hashsize" >> /etc/rc.local
fi
cat >> "/etc/sysctl.conf" <<EOF
# centminmod added
fs.nr_open=12000000
fs.file-max=9000000
net.core.wmem_max=16777216
net.core.rmem_max=16777216
net.ipv4.tcp_rmem=8192 87380 16777216
net.ipv4.tcp_wmem=8192 65536 16777216
net.core.netdev_max_backlog=8192
net.core.somaxconn=8151
net.core.optmem_max=8192
net.ipv4.tcp_fin_timeout=10
net.ipv4.tcp_keepalive_intvl=30
net.ipv4.tcp_keepalive_probes=3
net.ipv4.tcp_keepalive_time=240
net.ipv4.tcp_max_syn_backlog=8192
net.ipv4.tcp_sack=1
net.ipv4.tcp_syn_retries=3
net.ipv4.tcp_synack_retries = 2
net.ipv4.tcp_tw_recycle = 0
net.ipv4.tcp_tw_reuse = 0
net.ipv4.tcp_max_tw_buckets = 1440000
vm.swappiness=10
vm.min_free_kbytes=65536
net.ipv4.ip_local_port_range=1024 65535
net.ipv4.tcp_slow_start_after_idle=0
net.ipv4.tcp_rfc1337=1
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.all.log_martians = 1
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.all.secure_redirects = 0
net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.default.log_martians = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.secure_redirects = 0
net.ipv4.conf.default.send_redirects = 0
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.icmp_ignore_bogus_error_responses = 1
net.netfilter.nf_conntrack_helper=0
net.nf_conntrack_max = 524288
net.netfilter.nf_conntrack_tcp_timeout_established = 28800
net.netfilter.nf_conntrack_generic_timeout = 60
net.ipv4.tcp_challenge_ack_limit = 999999999
EOF
sysctl -p
fi
fi # centos 6 or 7
fi
}
if [ ! -d "$DIR_TMP" ]; then
mkdir -p $DIR_TMP
fi
DEF=${1:-novalue}
yum clean all
opt_tcp
if [[ ! -f /usr/bin/git || ! -f /usr/bin/bc || ! -f /usr/bin/wget || ! -f /bin/nano || ! -f /usr/bin/unzip || ! -f /usr/bin/applydeltarpm ]]; then
firstyuminstallstarttime=$(TZ=UTC date +%s.%N)
echo
echo "installing yum packages..."
echo
# do not install yum fastmirror plugin if not enough detected system memory available
# for yum fastmirror operation
if [[ "$(awk '/MemTotal/ {print $2}' /proc/meminfo)" -ge '1018000' && "$CENTOS_SEVEN" = '7' ]]; then
time $YUMDNFBIN -y install yum-plugin-fastestmirror yum-plugin-security
sar_call
elif [[ "$(awk '/MemTotal/ {print $2}' /proc/meminfo)" -ge '263000' ]]; then
time $YUMDNFBIN -y install yum-plugin-fastestmirror yum-plugin-security
sar_call
fi
if [[ -f /etc/machine-info && "$(grep -qi 'OVH bhs' /etc/machine-info; echo $?)" -eq '0' ]]; then
# detected OVH BHS based server so disable slower babylon network mirror
# https://community.centminmod.com/posts/47320/
if [ -f /etc/yum/pluginconf.d/fastestmirror.conf ]; then
echo "exclude=ca.mirror.babylon.network" >> /etc/yum/pluginconf.d/fastestmirror.conf
cat /etc/yum/pluginconf.d/fastestmirror.conf
fi
# if [[ -f /etc/dnf/dnf.conf && "$(grep -qw 'exclude' /etc/dnf/dnf.conf; echo $?)" -eq '0' ]]; then
# echo "exclude=ca.mirror.babylon.network" >> /etc/dnf/dnf.conf
# fi
if [[ "$CENTOS_SEVEN" = '7' ]]; then
if [[ "$(uname -m)" = 'x86_64' ]]; then
if [ -f /var/cache/yum/x86_64/7/timedhosts.txt ]; then
sed -i 's|centos.bhs.mirrors.ovh.net .*|centos.bhs.mirrors.ovh.net 0.000115046005249|' /var/cache/yum/x86_64/7/timedhosts.txt
fi
fi
else
if [[ "$(uname -m)" = 'x86_64' ]]; then
if [ -f /var/cache/yum/timedhosts.txt ]; then
sed -i 's|centos.bhs.mirrors.ovh.net .*|centos.bhs.mirrors.ovh.net 0.000115046005249|' /var/cache/yum/timedhosts.txt
fi
else
if [ -f /var/cache/yum/i386/6/timedhosts.txt ]; then
sed -i 's|centos.bhs.mirrors.ovh.net .*|centos.bhs.mirrors.ovh.net 0.000110046005249|' /var/cache/yum/i386/6/timedhosts.txt
fi
fi
fi
fi
if [[ "$CENTOS_SEVEN" = '7' ]]; then
if [[ $(rpm -q nmap-ncat >/dev/null 2>&1; echo $?) != '0' ]]; then
time $YUMDNFBIN -y install nmap-ncat${DISABLEREPO_DNF}
sar_call
fi
else
if [[ $(rpm -q nc >/dev/null 2>&1; echo $?) != '0' ]]; then
time $YUMDNFBIN -y install nc libgcj
sar_call
fi
fi
# ensure ipset doesn't get caught in autoremove list
# https://community.centminmod.com/posts/48144/
if [ -f /proc/user_beancounters ]; then
USER_PKGS=""
else
USER_PKGS=" ipset ipset-devel"
fi
time $YUMDNFBIN -y install virt-what gawk unzip bc wget lynx screen deltarpm ca-certificates yum-utils bash mlocate subversion rsyslog dos2unix boost-program-options net-tools imake bind-utils libatomic_ops-devel time coreutils autoconf cronie crontabs cronie-anacron gcc gcc-c++ automake libtool make libXext-devel unzip patch sysstat openssh flex bison file libtool-ltdl-devel krb5-devel libXpm-devel nano gmp-devel aspell-devel numactl lsof pkgconfig gdbm-devel tk-devel bluez-libs-devel iptables* rrdtool diffutils which perl-Test-Simple perl-ExtUtils-Embed perl-ExtUtils-MakeMaker perl-Time-HiRes perl-libwww-perl perl-Crypt-SSLeay perl-Net-SSLeay cyrus-imapd cyrus-sasl-md5 cyrus-sasl-plain strace cmake git net-snmp-libs net-snmp-utils iotop libvpx libvpx-devel t1lib t1lib-devel expect expect-devel readline readline-devel libedit libedit-devel openssl openssl-devel curl curl-devel openldap openldap-devel zlib zlib-devel gd gd-devel pcre pcre-devel gettext gettext-devel libidn libidn-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel glib2 glib2-devel bzip2 bzip2-devel ncurses ncurses-devel e2fsprogs e2fsprogs-devel libc-client libc-client-devel cyrus-sasl cyrus-sasl-devel pam pam-devel libaio libaio-devel libevent libevent-devel recode recode-devel libtidy libtidy-devel net-snmp net-snmp-devel enchant enchant-devel lua lua-devel mailx perl-LWP-Protocol-https OpenEXR-devel OpenEXR-libs atk cups-libs fftw-libs-double fribidi gdk-pixbuf2 ghostscript-devel ghostscript-fonts gl-manpages graphviz gtk2 hicolor-icon-theme ilmbase ilmbase-devel jasper-devel jasper-libs jbigkit-devel jbigkit-libs lcms2 lcms2-devel libICE-devel libSM-devel libXaw libXcomposite libXcursor libXdamage-devel libXfixes-devel libXfont libXi libXinerama libXmu libXrandr libXt-devel libXxf86vm-devel libdrm-devel libfontenc librsvg2 libtiff libtiff-devel libwebp libwebp-devel libwmf-lite mesa-libGL-devel mesa-libGLU mesa-libGLU-devel poppler-data urw-fonts xorg-x11-font-utils${USER_PKGS}${DISABLEREPO_DNF}
sar_call
# allows curl install to skip checking for already installed yum packages
# later on in initial curl installations
touch /tmp/curlinstaller-yum
time $YUMDNFBIN -y install epel-release${DISABLEREPO_DNF}
sar_call
if [[ "$CENTOS_SEVEN" = '7' ]]; then
time $YUMDNFBIN -y install clang clang-devel jemalloc jemalloc-devel libmcrypt libmcrypt-devel libraqm figlet moreutils nghttp2 libnghttp2 libnghttp2-devel pngquant optipng jpegoptim pwgen pigz pbzip2 xz pxz lz4 glances bash-completion mlocate re2c kernel-headers kernel-devel${DISABLEREPO_DNF} --enablerepo=epel
libc_fix
sar_call
else
time $YUMDNFBIN -y install clang clang-devel jemalloc jemalloc-devel libmcrypt libmcrypt-devel libraqm figlet moreutils nghttp2 libnghttp2 libnghttp2-devel pngquant optipng jpegoptim pwgen pigz pbzip2 xz pxz lz4 libJudy glances bash-completion mlocate re2c kernel-headers kernel-devel cmake28 uw-imap-devel${DISABLEREPO_DNF} --enablerepo=epel
sar_call
fi
if [ -f /etc/yum.repos.d/rpmforge.repo ]; then
time $YUMDNFBIN -y install GeoIP GeoIP-devel --disablerepo=rpmforge
sar_call
else
time $YUMDNFBIN -y install GeoIP GeoIP-devel
sar_call
fi
if [[ "$CENTOS_SIX" = '6' ]]; then
time $YUMDNFBIN -y install centos-release-cr
sar_call
sed -i 's/enabled=1/enabled=0/g' /etc/yum.repos.d/CentOS-CR.repo
# echo "priority=1" >> /etc/yum.repos.d/CentOS-CR.repo
fi
touch ${INSTALLDIR}/curlinstall_yum.txt
firstyuminstallendtime=$(TZ=UTC date +%s.%N)
fi
if [ -f /etc/selinux/config ]; then
sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config && setenforce 0
sed -i 's/SELINUX=permissive/SELINUX=disabled/g' /etc/selinux/config && setenforce 0
fi
yumupdater() {
yum clean all
time $YUMDNFBIN -y update
#time $YUMDNFBIN -y install expect imake bind-utils readline readline-devel libedit libedit-devel libatomic_ops-devel time yum-downloadonly coreutils autoconf cronie crontabs cronie-anacron gcc gcc-c++ automake openssl openssl-devel curl curl-devel openldap openldap-devel libtool make libXext-devel unzip patch sysstat zlib zlib-devel libc-client-devel openssh gd gd-devel pcre pcre-devel flex bison file gettext gettext-devel e2fsprogs-devel libtool-libs libtool-ltdl-devel libidn libidn-devel krb5-devel libjpeg libjpeg-devel libpng libpng-devel freetype freetype-devel libxml2 libxml2-devel libXpm-devel glib2 glib2-devel bzip2 bzip2-devel vim-minimal nano ncurses ncurses-devel e2fsprogs gmp-devel pspell-devel aspell-devel numactl lsof pkgconfig gdbm-devel tk-devel bluez-libs-devel iptables* rrdtool diffutils libc-client libc-client-devel which ImageMagick ImageMagick-devel ImageMagick-c++ ImageMagick-c++-devel perl-ExtUtils-MakeMaker perl-Time-HiRes cyrus-sasl cyrus-sasl-devel strace pam pam-devel cmake libaio libaio-devel libevent libevent-devel git
}
install_axel() {
cd $DIR_TMP
echo "Download $AXEK_LINKFILE ..."
if [ -s $AXEK_LINKFILE ]; then
echo "Axel ${AXEL_VER} Archive found, skipping download..."
else
wget -O $AXEK_LINKFILE $AXEK_LINKLOCAL
ERROR=$?
if [[ "$ERROR" != '0' ]]; then
echo "Error: $AXEK_LINKFILE download failed."
exit #$ERROR
else
echo "Download $AXEK_LINKFILE done."
fi
fi
if [[ "$(tar -tzf axel-${AXEL_VER}.tar.gz >/dev/null; echo $?)" != '0' ]]; then
rm -rf /svr-setup/axel-${AXEL_VER}.*
echo "re-try download form local mirror..."
wget -O $AXEK_LINKFILE $AXEK_LINKLOCAL
fi
tar xzf $AXEK_LINKFILE
ERROR=$?
if [[ "$ERROR" != '0' ]]; then
echo "Error: $AXEK_LINKFILE extraction failed."
exit #$ERROR