forked from centminmod/centminmod
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcentmin.sh
executable file
·2795 lines (2370 loc) · 98.3 KB
/
centmin.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/sh
export PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin"
#####################################################
EMAIL='' # Server notification email address enter only 1 address
PUSHOVER_EMAIL='' # Signup pushover.net push email notifications to mobile & tablets
ZONEINFO=Etc/UTC # Set Timezone
NGINX_IPV='n' # option deprecated from 1.11.5+ IPV6 support
USEEDITOR='nano' # choice between nano or vim text editors for cmd shortcuts
CUSTOMSERVERNAME='y'
CUSTOMSERVERSTRING='nginx centminmod'
PHPFPMCONFDIR='/usr/local/nginx/conf/phpfpmd'
UNATTENDED='y' # please leave at 'y' for best compatibility as at .07 release
CMVERSION_CHECK='n'
#####################################################
DT=$(date +"%d%m%y-%H%M%S")
# for github support
branchname='123.09beta01'
SCRIPT_MAJORVER='1.2.3'
SCRIPT_MINORVER='09'
SCRIPT_INCREMENTVER='004'
SCRIPT_VERSION="${SCRIPT_MAJORVER}-eva2000.${SCRIPT_MINORVER}.${SCRIPT_INCREMENTVER}"
SCRIPT_DATE='31/03/2017'
SCRIPT_AUTHOR='eva2000 (centminmod.com)'
SCRIPT_MODIFICATION_AUTHOR='eva2000 (centminmod.com)'
SCRIPT_URL='http://centminmod.com'
COPYRIGHT="Copyright 2011-2016 CentminMod.com"
DISCLAIMER='This software is provided "as is" in the hope that it will be useful, but WITHOUT ANY WARRANTY, to the extent permitted by law; without even the implied warranty of MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.'
#####################################################
#
# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version. See the included license.txt for futher details.
#
# PLEASE MODIFY VALUES BELOW THIS LINE ++++++++++++++++++++++++++++++++++++++
# Note: Please enter y for yes or n for no.
#####################################################
shopt -s expand_aliases
for g in "" e f; do
alias ${g}grep="LC_ALL=C ${g}grep" # speed-up grep, egrep, fgrep
done
#####################################################
HN=$(uname -n)
# Pre-Checks to prevent screw ups
DIR_TMP='/svr-setup'
SCRIPT_DIR=$(readlink -f $(dirname ${BASH_SOURCE[0]}))
source "inc/memcheck.inc"
TMPFSLIMIT=2900000
if [ ! -d "$DIR_TMP" ]; then
if [[ "$TOTALMEM" -ge "$TMPFSLIMIT" ]]; then
TMPFSENABLED=1
RAMDISKTMPFS='y'
echo "setting up $DIR_TMP on tmpfs ramdisk for initial install"
mkdir -p "$DIR_TMP"
chmod 0750 "$DIR_TMP"
mount -t tmpfs -o size=2200M,mode=0755 tmpfs "$DIR_TMP"
df -hT
else
mkdir -p "$DIR_TMP"
chmod 0750 "$DIR_TMP"
fi
fi
if [[ -z "$(cat /etc/resolv.conf)" ]]; then
echo ""
echo "/etc/resolv.conf is empty. No nameserver resolvers detected !! "
echo "Please configure your /etc/resolv.conf correctly or you will not"
echo "be able to use the internet or download from your server."
echo "aborting script... please re-run centmin.sh"
echo ""
exit
fi
if [ ! -f /usr/bin/wget ]; then
echo "wget not found !! "
echo "installing wget"
yum -y -q install wget
echo "aborting script... please re-run centmin.sh"
exit
fi
if [ ! -f /usr/bin/lynx ]; then
echo "installing lynx..."
yum -y -q install lynx
fi
if [ ! -f /usr/bin/unzip ]; then
yum -y -q install unzip
fi
if [ ! -f /usr/bin/bc ]; then
echo "bc not found !! "
echo "installing bc"
yum -y -q install bc
echo "bc installed"
echo "aborting script... "
echo "please re-run centmin.sh again for install"
exit
fi
if [ ! -f /usr/bin/tee ]; then
#echo "tee not found !! "
#echo "installing tee"
yum -y -q install coreutils
fi
if [ -f /var/cpanel/cpanel.config ]; then
echo "WHM/Cpanel detected.. centmin mod NOT compatible"
echo "aborting script..."
exit
fi
if [ -f /etc/psa/.psa.shadow ]; then
echo "Plesk detected.. centmin mod NOT compatible"
echo "aborting script..."
exit
fi
if [ -f /etc/init.d/directadmin ]; then
echo "DirectAdmin detected.. centmin mod NOT compatible"
echo "aborting script..."
exit
fi
TESTEDCENTOSVER='7.9'
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
source "inc/centos_seven.inc"
seven_function
cmservice() {
servicename=$1
action=$2
if [[ "$CENTOS_SEVEN" != '7' || "${servicename}" = 'php-fpm' || "${servicename}" = 'nginx' || "${servicename}" = 'memcached' || "${servicename}" = 'nsd' || "${servicename}" = 'csf' || "${servicename}" = 'lfd' ]]; then
echo "service ${servicename} $action"
if [[ "$CMSDEBUG" = [nN] ]]; then
service "${servicename}" "$action"
fi
else
echo "systemctl $action ${servicename}.service"
if [[ "$CMSDEBUG" = [nN] ]]; then
systemctl "$action" "${servicename}.service"
fi
fi
}
cmchkconfig() {
servicename=$1
status=$2
if [[ "$CENTOS_SEVEN" != '7' || "${servicename}" = 'php-fpm' || "${servicename}" = 'nginx' || "${servicename}" = 'memcached' || "${servicename}" = 'nsd' || "${servicename}" = 'csf' || "${servicename}" = 'lfd' ]]; then
echo "chkconfig ${servicename} $status"
if [[ "$CMSDEBUG" = [nN] ]]; then
chkconfig "${servicename}" "$status"
fi
else
if [ "$status" = 'on' ]; then
status=enable
fi
if [ "$status" = 'off' ]; then
status=disable
fi
echo "systemctl $status ${servicename}.service"
if [[ "$CMSDEBUG" = [nN] ]]; then
systemctl "$status" "${servicename}.service"
fi
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
# configure .ini directory
CONFIGSCANBASE='/etc/centminmod'
CONFIGSCANDIR="${CONFIGSCANBASE}/php.d"
if [ ! -d "$CONFIGSCANBASE" ]; then
mkdir -p "$CONFIGSCANBASE"
fi
if [ ! -d "$CONFIGSCANDIR" ]; then
mkdir -p "$CONFIGSCANDIR"
if [ -d /root/centminmod/php.d/ ]; then
cp -a /root/centminmod/php.d/* "${CONFIGSCANDIR}/"
fi
fi
# MySQL non-tmpfs based tmpdir for MySQL temp files
if [ ! -d "/home/mysqltmp" ]; then
mkdir -p /home/mysqltmp
chmod 1777 /home/mysqltmp
CHOWNMYSQL=y
fi
#####################################################
# Centmin Mod Git Repo URL - primary repo
# https://github.com/centminmod/centminmod
CMGIT='https://github.com/centminmod/centminmod.git'
# Gitlab backup repo
# https://gitlab.com/centminmod/centminmod
#CMGIT='https://gitlab.com/centminmod/centminmod.git'
# With AUTO_GITUPDATE='y' if centmin mod code install
# directory has been setup with git environment via
# centmin.sh menu option 23 # submenu option 1, then
# allow centmin.sh to auto update # the centmin mod
# code at /usr/local/src/centminmod
# silently in background
#
# if you want to retain local centmin mod code changes
# made to files in /usr/local/src/centminmod for variables
# in centmin.sh, use persistent config file you create
# or append to at /etc/centminmod/custom_config.inc as
# outlined on official site at
# http://centminmod.com/upgrade.html#persistent
AUTO_GITUPDATE='n'
#####################################################
LOCALCENTMINMOD_MIRROR='https://centminmod.com'
#####################################################
# Timestamp Install
TS_INSTALL='y'
#####################################################
# Enable or disable menu mode
ENABLE_MENU='y'
#####################################################
# CentOS 7 specific
FIREWALLD_DISABLE='y'
DNF_ENABLE='y'
DNF_COPR='y'
#####################################################
# MariaDB Jemalloc
# doh forgot MariaDB already uses jemalloc by default
MARIADB_JEMALLOC='n'
#####################################################
# CCACHE Configuration
CCACHEINSTALL='y'
CCACHE_VER="3.3.4"
CCACHESIZE='2.2G'
#####################################################
# experimental use of subshells to download some
# tarballs in parallel for faster initial installs
PARALLEL_MODE=y
# compiler related
CLANG='y' # Nginx and LibreSSL
CLANG_FOUR='n' # Clang 4.0+ optional support https://community.centminmod.com/posts/44039/
CLANG_PHP='n' # PHP
CLANG_APC='n' # APC Cache
CLANG_MEMCACHED='n' # Memcached menu option 10 routine
GCCINTEL_PHP='y' # enable PHP-FPM GCC compiler with Intel cpu optimizations
PHP_PGO='n' # Profile Guided Optimization https://software.intel.com/en-us/blogs/2015/10/09/pgo-let-it-go-php
PHP_PGO_CENTOSSIX='n' # CentOS 6 may need GCC >4.4.7 fpr PGO so use devtoolset-4 GCC 5.3
DEVTOOLSETSIX='n' # Enable or disable devtoolset-6 GCC 6.2 support instead of devtoolset-4 GCC 5.3 support
NGINX_DEVTOOLSETGCC='n' # Use devtoolset-4 GCC 5.3 even for CentOS 7 nginx compiles
GENERAL_DEVTOOLSETGCC='n' # Use devtoolset-4 GCC 5.3 whereever possible/coded
CRYPTO_DEVTOOLSETGCC='n' # Use devtoolset-4 GCC 5.3 for libressl or openssl compiles
NGX_GSPLITDWARF='y' # for Nginx compile https://community.centminmod.com/posts/44072/
PHP_GSPLITDWARF='y' # for PHP compile https://community.centminmod.com/posts/44072/
NGX_LDGOLD='y' # for Nginx compile i.e. passing ld.gold linker -fuse-ld=bfd or -fuse-ld=gold https://community.centminmod.com/posts/44037/
# When set to =y, will disable those listed installed services
# by default. The service is still installed but disabled
# by default and can be re-enabled with commands:
# service servicename start; chkconfig servicename on
NSD_DISABLED='n' # when set to =y, NSD disabled by default with chkconfig off
MEMCACHED_DISABLED='n' # when set to =y, Memcached server disabled by default via chkconfig off
PHP_DISABLED='n' # when set to =y, PHP-FPM disabled by default with chkconfig off
MYSQLSERVICE_DISABLED='n' # when set to =y, MariaDB MySQL service disabled by default with chkconfig off
PUREFTPD_DISABLED='n' # when set to =y, Pure-ftpd service disabled by default with chkconfig off
# Nginx Dynamic Module Switches
NGXDYNAMIC_NJS='n'
NGXDYNAMIC_XSLT='n'
NGXDYNAMIC_PERL='n'
NGXDYNAMIC_IMAGEFILTER='y'
NGXDYNAMIC_GEOIP='n'
NGXDYNAMIC_STREAM='y'
NGXDYNAMIC_STREAMGEOIP='n' # nginx 1.11.3+ option http://hg.nginx.org/nginx/rev/558db057adaa
NGXDYNAMIC_STREAMREALIP='n' # nginx 1.11.4+ option http://hg.nginx.org/nginx/rev/9cac11efb205
NGXDYNAMIC_HEADERSMORE='n'
NGXDYNAMIC_SETMISC='n'
NGXDYNAMIC_ECHO='n'
NGXDYNAMIC_LUA='n' #
NGXDYNAMIC_SRCCACHE='n'
NGXDYNAMIC_DEVELKIT='n' #
NGXDYNAMIC_MEMC='n'
NGXDYNAMIC_REDISTWO='n'
NGXDYNAMIC_NGXPAGESPEED='n'
NGXDYNAMIC_BROTLI='y'
NGXDYNAMIC_FANCYINDEX='y'
NGXDYNAMIC_HIDELENGTH='y'
# set = y to put nginx, php and mariadb major version updates into 503
# maintenance mode https://community.centminmod.com/posts/26485/
NGINX_UPDATEMAINTENANCE='n'
PHP_UPDATEMAINTENANCE='n'
MARIADB_UPDATEMAINTENANCE='n'
# General Configuration
NGINXUPGRADESLEEP='3'
NSD_INSTALL='n' # Install NSD (DNS Server)
NSD_VERSION='3.2.18' # NSD Version
NTP_INSTALL='y' # Install Network time protocol daemon
NGINXPATCH='y' # Set to y to allow NGINXPATCH_DELAY seconds time before Nginx configure and patching Nginx
NGINXPATCH_DELAY='1' # Number of seconds to pause Nginx configure routine during Nginx upgrades
STRIPNGINX='y' # set 'y' to strip nginx binary to reduce size
NGXMODULE_ALTORDER='y' # nginx configure module ordering alternative order
NGINX_ZERODT='n' # nginx zero downtime reloading on nginx upgrades
NGINX_MAXERRBYTELIMIT='2048' # modify NGX_MAX_ERROR_STR hardcoded 2048 limit by editing value i.e. http://openresty-reference.readthedocs.io/en/latest/Lua_Nginx_API/#print
NGINX_INSTALL='y' # Install Nginx (Webserver)
NGINX_DEBUG='n' # Enable & reinstall Nginx debug log nginx.org/en/docs/debugging_log.html & wiki.nginx.org/Debugging
NGINX_HTTP2='y' # Nginx http/2 patch https://community.centminmod.com/threads/4127/
NGINX_ZLIBNG='n' # 64bit OS only for Nginx compiled against zlib-ng https://github.com/Dead2/zlib-ng
NGINX_MODSECURITY='n' # modsecurity module support https://github.com/SpiderLabs/ModSecurity/wiki/Reference-Manual#Installation_for_NGINX
NGINX_RDNS='n' # https://github.com/flant/nginx-http-rdns
NGINX_NJS='n' # nginScript https://www.nginx.com/blog/launching-nginscript-and-looking-ahead/
NGINX_GEOIP='y' # Nginx GEOIP module install
NGINX_GEOIPMEM='y' # Nginx caches GEOIP databases in memory (default), setting 'n' caches to disk instead
NGINX_SPDY='y' # Nginx SPDY support
NGINX_SPDYPATCHED='n' # Cloudflare HTTP/2 + SPDY patch https://github.com/cloudflare/sslconfig/blob/master/patches/nginx__http2_spdy.patch
NGINX_STUBSTATUS='y' # http://nginx.org/en/docs/http/ngx_http_stub_status_module.html required for nginx statistics
NGINX_SUB='y' # http://nginx.org/en/docs/http/ngx_http_sub_module.html
NGINX_ADDITION='y' # http://nginx.org/en/docs/http/ngx_http_addition_module.html
NGINX_IMAGEFILTER='y' # http://nginx.org/en/docs/http/ngx_http_image_filter_module.html
NGINX_PERL='n' # http://nginx.org/en/docs/http/ngx_http_perl_module.html
NGINX_XSLT='n' # http://nginx.org/en/docs/http/ngx_http_xslt_module.html
NGINX_LENGTHHIDE='n' # https://github.com/nulab/nginx-length-hiding-filter-module
NGINX_LENGTHHIDEGIT='y' # triggers only if NGINX_LENGTHHIDE='y'
NGINX_CACHEPURGE='y' # https://github.com/FRiCKLE/ngx_cache_purge/
NGINX_ACCESSKEY='n' #
NGINX_HTTPCONCAT='n' # https://github.com/alibaba/nginx-http-concat
NGINX_THREADS='y' # https://www.nginx.com/blog/thread-pools-boost-performance-9x/
NGINX_STREAM='y' # http://nginx.org/en/docs/stream/ngx_stream_core_module.html
NGINX_STREAMGEOIP='y' # nginx 1.11.3+ option http://hg.nginx.org/nginx/rev/558db057adaa
NGINX_STREAMREALIP='y' # nginx 1.11.4+ option http://hg.nginx.org/nginx/rev/9cac11efb205
NGINX_STREAMSSLPREREAD='y' # nginx 1.11.5+ option https://nginx.org/en/docs/stream/ngx_stream_ssl_preread_module.html
NGINX_RTMP='n' # Nginx RTMP Module support https://github.com/arut/nginx-rtmp-module
NGINX_FLV='n' # http://nginx.org/en/docs/http/ngx_http_flv_module.html
NGINX_MP4='n' # Nginx MP4 Module http://nginx.org/en/docs/http/ngx_http_mp4_module.html
NGINX_AUTHREQ='n' # http://nginx.org/en/docs/http/ngx_http_auth_request_module.html
NGINX_SECURELINK='y' # http://nginx.org/en/docs/http/ngx_http_secure_link_module.html
NGINX_FANCYINDEX='y' # https://github.com/aperezdc/ngx-fancyindex/releases
NGINX_FANCYINDEXVER='0.4.0' # https://github.com/aperezdc/ngx-fancyindex/releases
NGINX_VHOSTSTATS='n' # https://github.com/vozlt/nginx-module-vts
NGINX_LIBBROTLI='n' # https://github.com/google/ngx_brotli
NGINX_LIBBROTLISTATIC='n'
NGINX_PAGESPEED='n' # Install ngx_pagespeed
NGINX_PAGESPEEDGITMASTER='n' # Install ngx_pagespeed from official github master instead
NGXPGSPEED_VER='1.12.34.2-beta'
NGINX_PAGESPEEDPSOL_VER='1.12.34.2'
NGINX_PASSENGER='n' # Install Phusion Passenger requires installing addons/passenger.sh before hand
NGINX_WEBDAV='n' # Nginx WebDAV and nginx-dav-ext-module
NGINX_EXTWEBDAVVER='0.0.3' # nginx-dav-ext-module version
NGINX_LIBATOMIC='y' # Nginx configured with libatomic support
NGINX_HTTPREDIS='y' # Nginx redis http://wiki.nginx.org/HttpRedisModule
NGINX_HTTPREDISVER='0.3.7' # Nginx redis version
NGINX_PCREJIT='y' # Nginx configured with pcre & pcre-jit support
NGINX_PCREVER='8.40' # Version of PCRE used for pcre-jit support in Nginx
NGINX_ZLIBCUSTOM='y' # Use custom zlib instead of system version
NGINX_ZLIBVER='1.2.11' # http://www.zlib.net/
ORESTY_HEADERSMORE='y' # openresty headers more https://github.com/openresty/headers-more-nginx-module
ORESTY_HEADERSMOREGIT='n' # use git master instead of version specific
NGINX_HEADERSMORE='0.32'
NGINX_CACHEPURGEVER='2.3'
NGINX_STICKY='n' # nginx sticky module https://bitbucket.org/nginx-goodies/nginx-sticky-module-ng
NGINX_STICKYVER='master'
NGINX_UPSTREAMCHECK='n' # nginx upstream check https://github.com/yaoweibin/nginx_upstream_check_module
NGINX_UPSTREAMCHECKVER='0.3.0'
NGINX_OPENRESTY='y' # Agentzh's openresty Nginx modules
ORESTY_MEMCVER='0.17' # openresty memc module https://github.com/openresty/memc-nginx-module
ORESTY_SRCCACHEVER='0.31' # openresty subrequest cache module https://github.com/openresty/srcache-nginx-module
ORESTY_DEVELKITVER='0.3.0' # openresty ngx_devel_kit module https://github.com/simpl/ngx_devel_kit
ORESTY_SETMISCGIT='n' # use git master instead of version specific
ORESTY_SETMISCVER='0.31' # openresty set-misc-nginx module https://github.com/openresty/set-misc-nginx-module
ORESTY_ECHOGIT='n' # use git master instead of version specific
ORESTY_ECHOVER='0.60' # openresty set-misc-nginx module https://github.com/openresty/echo-nginx-module
ORESTY_REDISVER='0.13' # openresty redis2-nginx-module https://github.com/openresty/redis2-nginx-module
LUAJIT_GITINSTALL='y' # opt to install luajit 2.1 from dev branch http://repo.or.cz/w/luajit-2.0.git/shortlog/refs/heads/v2.1
LUAJIT_GITINSTALLVER='2.1' # branch version = v2.1 will override ORESTY_LUAGITVER if LUAJIT_GITINSTALL='y'
ORESTY_LUANGINX='n' # enable or disable or ORESTY_LUA* nginx modules below
ORESTY_LUANGINXVER='0.10.7' # openresty lua-nginx-module https://github.com/openresty/lua-nginx-module
ORESTY_LUAGITVER='2.0.4' # luagit http://luajit.org/
ORESTY_LUAMEMCACHEDVER='0.14' # openresty https://github.com/openresty/lua-resty-memcached
ORESTY_LUAMYSQLVER='0.17' # openresty https://github.com/openresty/lua-resty-mysql
ORESTY_LUAREDISVER='0.26' # openresty https://github.com/openresty/lua-resty-redis
ORESTY_LUADNSVER='0.18' # openresty https://github.com/openresty/lua-resty-dns
ORESTY_LUAUPLOADVER='0.10' # openresty https://github.com/openresty/lua-resty-upload
ORESTY_LUAWEBSOCKETVER='0.05' # openresty https://github.com/openresty/lua-resty-websocket
ORESTY_LUALOCKVER='0.04' # openresty https://github.com/openresty/lua-resty-lock
ORESTY_LUASTRINGVER='0.09' # openresty https://github.com/openresty/lua-resty-string
ORESTY_LUAREDISPARSERVER='0.10' # openresty https://github.com/openresty/lua-redis-parser
ORESTY_LUAUPSTREAMCHECKVER='0.04' # openresty https://github.com/openresty/lua-resty-upstream-healthcheck
ORESTY_LUALRUCACHEVER='0.04' # openresty https://github.com/openresty/lua-resty-lrucache
ORESTY_LUARESTYCOREVER='0.1.9' # openresty https://github.com/openresty/lua-resty-core
ORESTY_LUAUPSTREAMVER='0.06' # openresty https://github.com/openresty/lua-upstream-nginx-module
NGX_LUAUPSTREAM='n' # disable https://github.com/openresty/lua-upstream-nginx-module
ORESTY_LUALOGGERSOCKETVER='0.1' # cloudflare openresty https://github.com/cloudflare/lua-resty-logger-socket
ORESTY_LUACOOKIEVER='master' # cloudflare openresty https://github.com/cloudflare/lua-resty-cookie
ORESTY_LUAUPSTREAMCACHEVER='0.1.1' # cloudflare openresty https://github.com/cloudflare/lua-upstream-cache-nginx-module
NGX_LUAUPSTREAMCACHE='n' # disable https://github.com/cloudflare/lua-upstream-cache-nginx-module
LUACJSONVER='2.1.0.4' # https://github.com/openresty/lua-cjson
STRIPPHP='y' # set 'y' to strip PHP binary to reduce size
PHP_INSTALL='y' # Install PHP /w Fast Process Manager
PHP_CUSTOMSSL='n' # compile php-fpm against openssl 1.0.2+ or libressl 2.3+ whichever nginx uses
PHPMAKETEST=n # set to y to enable make test after PHP make for diagnostic purposes
AUTODETECPHP_OVERRIDE='n' # when enabled, php updates will always reinstall all php extensions even if minor php version
PHPGEOIP_ALWAYS='y' # GeoIP php extension is always reinstalled on php recompiles
PHPIMAGICK_ALWAYS='y' # imagick php extension is always reinstalled on php recompiles
PHPDEBUGMODE='n' # --enable-debug PHP compile flag
PHPFINFO='n' # Disable or Enable PHP File Info extension
PHPPCNTL='y' # Disable or Enable PHP Process Control extension
PHPINTL='y' # Disable or Enable PHP intl extension
PHPRECODE=n # Disable or Enable PHP Recode extension
PHPSNMP='y' # Disable or Enable PHP SNMP extension
PHPIMAGICK='y' # Disable or Enable PHP ImagicK extension
PHPMAILPARSE='y' # Disable or Enable PHP mailparse extension
PHPIONCUBE='n' # Disable or Enable Ioncube Loader via addons/ioncube.sh
PHPMSSQL='n' # Disable or Enable MSSQL server PHP extension
PHPMSSQL_ALWAYS='n' # mssql php extension always install on php recompiles
SHORTCUTS='y' # shortcuts
POSTGRESQL='n' # set to =y to install PostgreSQL 9.6 server, devel packages and pdo-pgsql PHP extension
########################################################
# Choice of installing MariaDB 5.2 via RPM or via MariaDB 5.2 CentOS YUM Repo
# If MDB_YUMREPOINSTALL=y and MDB_INSTALL=n then MDB_VERONLY version
# number won't have any effect in determining version of MariaDB 5.2.x to install.
# YUM Repo will install whatever is latest MariaDB 5.2.x version available via the YUM REPO
MDB_INSTALL='n' # Install via RPM MariaDB MySQL Server replacement (Not recommended for VPS with less than 256MB RAM!)
MDB_YUMREPOINSTALL='y' # Install MariaDB 5.5 via CentOS YUM Repo
# Define current MariaDB version
MDB_VERONLY='5.2.14'
MDB_BUILD='122'
MDB_VERSION="${MDB_VERONLY}-${MDB_BUILD}" # Use this version of MariaDB ${MDB_VERONLY}
# Define previous MariaDB version for proper upgrade
MDB_PREVERONLY='5.2.12'
MDB_PREBUILD='115'
MDB_PREVERSION="${MDB_PREVERONLY}-${MDB_PREBUILD}" # Use this version of MariaDB ${MDB_VERONLY}
########################################################
# Optionally, if you want to install MariaDB instead of standard MySQL you can do.
# Set MDB_INSTALL=y and MYSQL_INSTALL='n'
MYSQL_INSTALL='n' # Install official Oracle MySQL Server (MariaDB alternative recommended)
SENDMAIL_INSTALL='n' # Install Sendmail (and mailx) set to y and POSTFIX_INSTALL=n for sendmail
POSTFIX_INSTALL=y # Install Postfix (and mailx) set to n and SENDMAIL_INSTALL=y for sendmail
# Nginx
NGINX_VERSION='1.11.10' # Use this version of Nginx
NGINX_VHOSTSSL='y' # enable centmin.sh menu 2 prompt to create self signed SSL vhost 2nd vhost conf
NGINXBACKUP='y'
NGINXDIR='/usr/local/nginx'
NGINXCONFDIR="${NGINXDIR}/conf"
NGINXBACKUPDIR='/usr/local/nginxbackup'
##################################
## Nginx SSL options
# OpenSSL
NOSOURCEOPENSSL='y' # set to 'y' to disable OpenSSL source compile for system default YUM package setup
OPENSSL_VERSION='1.0.2k' # Use this version of OpenSSL http://openssl.org/
OPENSSL_VERSIONFALLBACK='1.0.2k' # fallback if OPENSSL_VERSION uses openssl 1.1.x branch
OPENSSL_CUSTOMPATH='/opt/openssl' # custom directory path for OpenSSL 1.0.2+
CLOUDFLARE_PATCHSSL='y' # set 'y' to implement Cloudflare's chacha20 patch https://github.com/cloudflare/sslconfig
NGINX_DYNAMICTLS='n' # set 'y' and recompile nginx https://blog.cloudflare.com/optimizing-tls-over-tcp-to-reduce-latency/
# LibreSSL
LIBRESSL_SWITCH='y' # if set to 'y' it overrides OpenSSL as the default static compiled option for Nginx server
LIBRESSL_VERSION='2.4.5' # Use this version of LibreSSL http://www.libressl.org/
# BoringSSL
# not working yet just prep work
BORINGSSL_SWITCH='n' # if set to 'y' it overrides OpenSSL as the default static compiled option for Nginx server
##################################
# Choose whether to compile Nginx --with-google_perftools_module
# no longer used in Centmin Mod v1.2.3-eva2000.01 and higher
GPERFTOOLS_SOURCEINSTALL='n'
LIBUNWIND_VERSION='1.2-rc1' # note google perftool specifically requies v0.99 and no other
GPERFTOOLS_VERSION='2.5' # Use this version of google-perftools
# Choose whether to compile PCRE from source. Note PHP 5.3.8 already includes PCRE
PCRE_SOURCEINSTALL='n'
PCRE_VERSION='8.40' # PCRE version
# PHP and Cache/Acceleration
IMAGICKPHP_VER='3.4.3' # PHP extension for imagick
MAILPARSEPHP_VER='2.1.6' # https://pecl.php.net/package/mailparse
MAILPARSEPHP_COMPATVER='3.0.1' # For PHP 7
MEMCACHED_INSTALL='y' # Install Memcached
LIBEVENT_VERSION='2.0.22' # Use this version of Libevent
MEMCACHED_VERSION='1.4.36' # Use this version of Memcached server
MEMCACHE_VERSION='3.0.8' # Use this version of Memcache
MEMCACHEDPHP_VER='2.2.0' # Memcached PHP extension not server
LIBMEMCACHED_YUM='y' # switch to YUM install instead of source compile
LIBMEMCACHED_VER='1.0.18' # libmemcached version for source compile
TWEMPERF_VER='0.1.1'
PHPREDIS='y' # redis PHP extension install
REDISPHP_VER='3.1.2' # redis PHP version for PHP <7.x
REDISPHPSEVEN_VER='3.1.2' # redis PHP version for PHP =>7.x
REDISPHP_GIT='n' # pull php 7 redis extension from git or pecl downloads
PHPMONGODB='n' # MongoDB PHP extension install
MONGODBPHP_VER='1.1.8' # MongoDB PHP version
MONGODB_SASL='n' # SASL not working yet leave = n
PDOPGSQL_PHPVER='9.6' # pdo-pgsql PHP extension version for postgresql
PHP_FTPEXT='y' # ftp PHP extension
PHP_MEMCACHE='y' # memcache PHP extension
PHP_MEMCACHED='y' # memcached PHP extension
FFMPEGVER='0.6.0'
SUHOSINVER='0.9.37.1'
PHP_OVERWRITECONF='y' # whether to show the php upgrade prompt to overwrite php-fpm.conf
PHP_VERSION='5.6.30' # Use this version of PHP
PHP_MIRRORURL='http://php.net'
PHPUPGRADE_MIRRORURL="$PHP_MIRRORURL"
XCACHE_VERSION='3.2.0' # Use this version of Xcache
APCCACHE_VERSION='3.1.13' # Use this version of APC Cache
IGBINARY_VERSION='1.2.1'
IGBINARY_INSTALL='y' # install or not igbinary support for APC and Memcached server
IGBINARYGIT='y'
ZOPCACHEDFT='y'
ZOPCACHECACHE_VERSION='7.0.5' # for PHP <=5.4 http://pecl.php.net/package/ZendOpcache
ZOPCACHE_OVERRIDE='n' # =y will override PHP 5.5, 5.6, 7.0 inbuilt Zend OpCache version
# Python
PYTHON_VERSION='2.7.10' # Use this version of Python
SIEGE_VERSION='4.0.2'
CURL_TIMEOUTS=' --max-time 5 --connect-timeout 5'
WGETOPT='-cnv --no-dns-cache -4'
AXEL_VER='2.6' # Axel source compile version https://github.com/eribertomota/axel/releases
###############################################################
# experimental Intel compiled optimisations
# when auto detect Intel based processors
INTELOPT='n'
# GCC optimization level choices: -O2 or -O3 or -Ofast (only for GCC via CLANG=n)
GCC_OPTLEVEL='-O3'
# experimental custom RPM compiled packages to replace source
# compiled versions for 64bit systems only
FPMRPM_LIBEVENT='n'
FPMRPM_MEMCACHED='n'
CENTALTREPO_DISABLE='y'
RPMFORGEREPO_DISABLE='n'
AXIVOREPO_DISABLE='y'
REMIREPO_DISABLE='n'
ATRPMSREPO_DISABLE='y'
# custom curl/libcurl RPM for 7.44 and higher
# enable with CUSTOM_CURLRPM='y'
# use at own risk as it can break the system
# info at http://mirror.city-fan.org/ftp/contrib/sysutils/Mirroring/
CUSTOM_CURLRPM='n'
CUSTOM_CURLRPMVER='7.47.1-2.0' # custom curl/libcurl version
CUSTOM_CURLLIBSSHVER='1.6.0-4.0' # libssh2 version
CUSTOM_CURLRPMCARESVER='1.10.0-6.0' # c-ares version
CUSTOM_CURLRPMSYSURL='http://mirror.city-fan.org/ftp/contrib/sysutils/Mirroring'
CUSTOM_CURLRPMLIBURL='http://mirror.city-fan.org/ftp/contrib/libraries'
# wget source compile version
WGET_VERSION='1.19.1'
###############################################################
# Settings for centmin.sh menu option 2 and option 22 for
# the details of the self-signed SSL certificate that is auto
# generated. The default values where vhostname variable is
# auto added based on what you input for your site name
#
# -subj "/C=US/ST=California/L=Los Angeles/O=${vhostname}/OU=${vhostname}/CN=${vhostname}"
#
# You can only customise the first 5 variables for
# C = Country 2 digit code
# ST = state
# L = Location as in city
# 0 = organisation
# OU = organisational unit
#
# if left blank # defaults to same as vhostname that is your domain
# if set it overrides that
SELFSIGNEDSSL_C='US'
SELFSIGNEDSSL_ST='California'
SELFSIGNEDSSL_L='Los Angeles'
SELFSIGNEDSSL_O=''
SELFSIGNEDSSL_OU=''
###############################################################
# centmin.sh menu option 22 specific options
WPPLUGINS_ALL='n' # do not install additional plugins
WPCLI_SUPERCACHEPLUGIN='n' # https://community.centminmod.com/threads/5102/
###############################################################
# php configured --with-mysql-sock=${PHP_MYSQLSOCKPATH}/mysql.sock
PHP_MYSQLSOCKPATH='/var/lib/mysql'
###############################################################
# Letsencrypt integration via addons/acmetool.sh auto detection
# in centmin.sh menu option 2, 22, and /usr/bin/nv nginx vhost
# generators. You can control whether or not to enable or disable
# integration detection in these menu options
LETSENCRYPT_DETECT='n'
###############################################################
MACHINE_TYPE=$(uname -m) # Used to detect if OS is 64bit or not.
if [ "${ARCH_OVERRIDE}" != '' ]
then
ARCH=${ARCH_OVERRIDE}
else
if [ "${MACHINE_TYPE}" == 'x86_64' ];
then
ARCH='x86_64'
MDB_ARCH='amd64'
else
ARCH='i386'
fi
fi
# ensure if ORESTY_LUANGINX is enabled, that the other required
# Openresty modules are enabled if folks forget to enable them
if [[ "$ORESTY_LUANGINX" = [yY] ]]; then
NGINX_OPENRESTY='y'
fi
if [[ "$CENTOS_SEVEN" = '7' ]]; then
AXEL_VER='2.12'
fi
# ensure clang alternative to gcc compiler is used only for 64bit OS
# if [[ "$(uname -m)" != 'x86_64' ]]; then
# CLANG='n'
# fi
# source "inc/mainmenu.inc"
# source "inc/mainmenu_cli.inc"
# source "inc/ramdisk.inc"
source "inc/tcp.inc"
source "inc/customrpms.inc"
source "inc/pureftpd.inc"
source "inc/htpasswdsh.inc"
source "inc/gcc.inc"
source "inc/entropy.inc"
source "inc/cpucount.inc"
source "inc/motd.inc"
source "inc/cpcheck.inc"
source "inc/memcheck.inc"
source "inc/lowmem.inc"
source "inc/ccache.inc"
source "inc/bookmark.inc"
source "inc/centminlogs.inc"
source "inc/yumskip.inc"
source "inc/questions.inc"
source "inc/downloads_centosfive.inc"
source "inc/downloads_centossix.inc"
source "inc/downloads_centosseven.inc"
source "inc/downloadlinks.inc"
source "inc/downloads.inc"
source "inc/yumpriorities.inc"
source "inc/yuminstall.inc"
source "inc/centoscheck.inc"
source "inc/axelsetup.inc"
source "inc/phpfpmdir.inc"
source "inc/nginx_backup.inc"
source "inc/nsd_submenu.inc"
source "inc/nsd_install.inc"
source "inc/nsdsetup.inc"
source "inc/nsd_reinstall.inc"
source "inc/nginx_logformat.inc"
source "inc/logrotate_nginx.inc"
source "inc/logrotate_phpfpm.inc"
source "inc/logrotate_mysql.inc"
source "inc/nginx_mimetype.inc"
source "inc/openssl_install.inc"
source "inc/brotli.inc"
source "inc/nginx_patch.inc"
source "inc/nginx_configure.inc"
# source "inc/nginx_configure_openresty.inc"
source "inc/geoip.inc"
source "inc/luajit.inc"
source "inc/nginx_install.inc"
source "inc/nginx_upgrade.inc"
source "inc/mailparse.inc"
source "inc/imagick_install.inc"
source "inc/memcached_install.inc"
source "inc/redis_submenu.inc"
source "inc/redis.inc"
source "inc/mongodb.inc"
source "inc/php_mssql.inc"
source "inc/mysql_proclimit.inc"
source "inc/mysqltmp.inc"
source "inc/setmycnf.inc"
source "inc/mariadb_install.inc"
source "inc/mysql_install.inc"
source "inc/mariadb_submenu.inc"
source "inc/postgresql.inc"
source "inc/zendopcache_tweaks.inc"
source "inc/php_extraopts.inc"
source "inc/php_configure.inc"
source "inc/phpng_download.inc"
source "inc/php_upgrade.inc"
source "inc/suhosin_setup.inc"
source "inc/nginx_pagespeed.inc"
source "inc/nginx_modules.inc"
source "inc/nginx_modules_openresty.inc"
source "inc/sshd.inc"
source "inc/openvz_stack.inc"
source "inc/siegeinstall.inc"
source "inc/python_install.inc"
source "inc/nginx_addvhost.inc"
source "inc/wpsetup.inc"
source "inc/mariadb_upgrade.inc"
source "inc/mariadb_upgrade53.inc"
source "inc/mariadb_upgrade55.inc"
source "inc/mariadb_upgrade10.inc"
source "inc/mariadb_upgrade101.inc"
source "inc/mariadb_upgrade102.inc"
source "inc/nginx_errorpage.inc"
source "inc/sendmail.inc"
source "inc/postfix.inc"
source "inc/compress.inc"
source "inc/diskalert.inc"
source "inc/phpsededit.inc"
source "inc/csfinstall.inc"
source "inc/csftweaks.inc"
source "inc/xcache_installask.inc"
source "inc/xcache_install.inc"
source "inc/xcache_reinstall.inc"
source "inc/igbinary.inc"
source "inc/apcprotect.inc"
source "inc/apcinstall.inc"
source "inc/apcreinstall.inc"
source "inc/zendopcache_55ini.inc"
source "inc/zendopcache_install.inc"
source "inc/zendopcache_upgrade.inc"
source "inc/zendopcache_reinstall.inc"
source "inc/zendopcache_submenu.inc"
source "inc/ffmpeginstall.inc"
source "inc/shortcuts_install.inc"
source "inc/memcacheadmin.inc"
source "inc/mysqlsecure.inc"
source "inc/pcre.inc"
source "inc/jemalloc.inc"
source "inc/zlib.inc"
source "inc/updater_submenu.inc"
source "inc/centminfinish.inc"
checkcentosver
mysqltmpdir
cpcheck
if [ ! -f /etc/centminmod-release ];then
echo "$SCRIPT_VERSION" > /etc/centminmod-release
else
if [[ "$SCRIPT_VERSION" != "$(cat /etc/centminmod-release)" ]]; then
echo "$SCRIPT_VERSION" > /etc/centminmod-release
fi
fi
if [ -f /etc/centminmod-versionlog ];then
if [[ "$SCRIPT_VERSION" != "$(cat /etc/centminmod-versionlog)" ]]; then
echo "$SCRIPT_VERSION #`date`" >> /etc/centminmod-versionlog
fi
else
echo "$SCRIPT_VERSION #`date`" >> /etc/centminmod-versionlog
fi
if [ ! -f /usr/bin/cminfo_updater ]; then
setupdate
/usr/bin/cminfo_updater
else
setupdate
/usr/bin/cminfo_updater
fi
if [ ! -x /usr/bin/cminfo ]; then
chmod 0700 /usr/bin/cminfo
fi
###############################################################
# The default is stable, you can change this to development if you wish
#ARCH_OVERRIDE='i386'
# Uncomment the above line if you are running a 32bit Paravirtulized Xen VPS
# on a 64bit host node.
# YOU SHOULD NOT NEED TO MODIFY ANYTHING BELOW THIS LINE +++++++++++++++++++
# JUST RUN chmod +x ./centmin.sh && ./centmin.sh
#
###############################################################
KEYPRESS_PARAM='-s -n1 -p' # Read a keypress without hitting ENTER.
# -s means do not echo input.
# -n means accept only N characters of input.
# -p means echo the following prompt before reading input
ASKCMD="read $KEYPRESS_PARAM "
# MACHINE_TYPE=`uname -m` # Used to detect if OS is 64bit or not.
CUR_DIR=$SCRIPT_DIR # Get current directory.
CM_INSTALLDIR=$CUR_DIR
# echo "centmin.sh \${CUR_DIR} & \${CM_INSTALLDIR}"
# echo ${CUR_DIR}
# echo ${CM_INSTALLDIR}
if [ -f "${CM_INSTALLDIR}/inc/custom_config.inc" ]; then
source "inc/custom_config.inc"
if [ -d "${CENTMINLOGDIR}" ]; then
cat "inc/custom_config.inc" > "${CENTMINLOGDIR}/inc-custom-config-settings_${DT}.log"
fi
fi
if [ -f "${CONFIGSCANBASE}/custom_config.inc" ]; then
# default is at /etc/centminmod/custom_config.inc
source "${CONFIGSCANBASE}/custom_config.inc"
if [ -d "${CENTMINLOGDIR}" ]; then
cat "${CONFIGSCANBASE}/custom_config.inc" > "${CENTMINLOGDIR}/etc-centminmod-custom-config-settings_${DT}.log"
fi
fi
if [ -f "${CM_INSTALLDIR}/inc/z_custom.inc" ]; then
source "${CM_INSTALLDIR}/inc/z_custom.inc"
if [ -d "${CENTMINLOGDIR}" ]; then
cat "${CM_INSTALLDIR}/inc/z_custom.inc" > "${CENTMINLOGDIR}/inc-zcustom-config-settings_${DT}.log"
fi
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
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
fi
if [ ! "$(grep -w 'exclude' /etc/dnf/dnf.conf)" ]; then
echo "exclude=*.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
# function checks if persistent config file has low mem variable enabled
# LOWMEM_INSTALL='y'
checkfor_lowmem
###############################################################
# FUNCTIONS
phpxz_detect
if [[ "$CENTOS_SEVEN" = '7' ]]; then
DOWNLOADAPP='axel'
WGETRETRY=''
AXELPHPTARGZ="-o php-${PHP_VERSION}.tar.${PHPEXTSION}"
AXELPHPUPGRADETARGZ="-o php-${phpver}.tar.${PHPEXTSION}"
elif [[ "$CENTOS_SIX" = '6' ]]; then
DOWNLOADAPP='axel'
WGETRETRY=''
AXELPHPTARGZ="-o php-${PHP_VERSION}.tar.${PHPEXTSION}"
AXELPHPUPGRADETARGZ="-o php-${phpver}.tar.${PHPEXTSION}"
else
DOWNLOADAPP="wget ${WGETOPT} --progress=bar"
WGETRETRY='--tries=3'
AXELPHPTARGZ=''
AXELPHPUPGRADETARGZ=''
fi
download_cmd() {
HTTPS_AXELCHECK=$(echo "$1" |awk -F '://' '{print $1}')
if [[ "$(curl -Isv $1 2>&1 | egrep 'ECDSA')" ]]; then
# axel doesn't natively support ECC 256bit ssl certs
# with ECDSA ciphers due to CentOS system OpenSSL 1.0.2e
echo "ECDSA SSL Cipher BASED HTTPS detected, switching from axel to wget"
DOWNLOADAPP="wget ${WGETOPT}"
elif [[ "$CENTOS_SIX" = '6' && "$HTTPS_AXELCHECK" = 'https' ]]; then
echo "CentOS 6 Axel fallback to wget for HTTPS download"
DOWNLOADAPP="wget ${WGETOPT}"
fi
$DOWNLOADAPP $1 $2 $3 $4
}
# if [ "${ARCH_OVERRIDE}" != '' ]
# then
# ARCH=${ARCH_OVERRIDE}
# else
# if [ ${MACHINE_TYPE} == 'x86_64' ];
# then
# ARCH='x86_64'
# MDB_ARCH='amd64'
# else
# ARCH='i386'
# fi
# fi
ASK () {
keystroke=''
while [[ "$keystroke" != [yYnN] ]]
do
$ASKCMD "$1" keystroke
echo "$keystroke";
done
key=$(echo $keystroke)
}
# 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'