forked from anjasamar/DirectAdminPanel-V1.62.4
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.sh
1888 lines (1627 loc) · 51.7 KB
/
setup.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
###############################################################################
# setup.sh
# DirectAdmin setup.sh file is the first file to download when doing a
# DirectAdmin Install. It will ask you for relevant information and will
# download all required files. If you are unable to run this script with
# ./setup.sh then you probably need to set it's permissions. You can do this
# by typing the following:
#
# chmod 755 setup.sh
#
# after this has been done, you can type ./setup.sh to run the script.
#
###############################################################################
echo "*****************************************************";
echo "*";
echo "* DirectAdmin V1.64.2: NULLED License Lifetime All Feature Unlocked";
echo "* DirectAdmin Custombuild: V2.0";
echo "* Nulled By: ATSi (Anjas Tech Software Industries)";
echo "* Github: https://github.com/anjasamar";
echo "* Indonesia Developer Enthusiasm 2024";
echo "*";
echo "*****************************************************";
sleep 20;
OS=`uname`;
#For FreeBSD 11
if [ ! -e /usr/bin/perl ] && [ -e /usr/local/bin/perl ]; then
ln -s /usr/local/bin/perl /usr/bin/perl
fi
if [ ! -e /usr/bin/perl ]; then
if [ "$1" = "auto" ]; then
if [ "${OS}" = "FreeBSD" ]; then
pkg install -y perl5 wget
elif [ -e /etc/debian_version ]; then
apt-get -y install perl wget
else
yum -y install perl wget
fi
fi
if [ ! -e /usr/bin/perl ]; then
echo "Cannot find perl. Please run pre-install commands:";
echo " http://help.directadmin.com/item.php?id=354";
exit 1;
fi
fi
#For FreeBSD 11
if [ ! -e /usr/bin/perl ] && [ -e /usr/local/bin/perl ]; then
ln -s /usr/local/bin/perl /usr/bin/perl
fi
random_pass() {
PASS_LEN=`perl -le 'print int(rand(6))+9'`
START_LEN=`perl -le 'print int(rand(8))+1'`
END_LEN=$(expr ${PASS_LEN} - ${START_LEN})
SPECIAL_CHAR=`perl -le 'print map { (qw{@ ^ _ - /})[rand 6] } 1'`;
NUMERIC_CHAR=`perl -le 'print int(rand(10))'`;
PASS_START=`perl -le "print map+(A..Z,a..z,0..9)[rand 62],0..$START_LEN"`;
PASS_END=`perl -le "print map+(A..Z,a..z,0..9)[rand 62],0..$END_LEN"`;
PASS=${PASS_START}${SPECIAL_CHAR}${NUMERIC_CHAR}${PASS_END}
echo $PASS
}
ADMIN_USER=admin
DB_USER=da_admin
#ADMIN_PASS=`perl -le'print map+(A..Z,a..z,0..9)[rand 62],0..9'`;
ADMIN_PASS=`random_pass`
#RAND_LEN=`perl -le'print 16+int(rand(9))'`
#DB_ROOT_PASS=`perl -le"print map+(A..Z,a..z,0..9)[rand 62],0..$RAND_LEN"`;
DB_ROOT_PASS=`random_pass`
DOWNLOAD_BETA=true
if [ "$1" = "beta" ] || [ "$2" = "beta" ]; then
DOWNLOAD_BETA=true
fi
FTP_HOST=free-da.vsicloud.com
if [ "$OS" = "FreeBSD" ]; then
WGET_PATH=/usr/local/bin/wget
else
WGET_PATH=/usr/bin/wget
fi
WGET_OPTION="";
COUNT=`$WGET_PATH --help | grep -c no-check-certificate`
if [ "$COUNT" -ne 0 ]; then
WGET_OPTION="--no-check-certificate";
fi
#WGET_10=`$WGET_PATH -V 2>/dev/null | head -n1 | grep -c 1.10`
#WGET_OPTION="";
#if [ $WGET_10 -eq 1 ]; then
# WGET_OPTION="--no-check-certificate";
#fi
SYSTEMD=no
SYSTEMDDIR=/etc/systemd/system
if [ -d ${SYSTEMDDIR} ]; then
if [ -e /bin/systemctl ] || [ -e /usr/bin/systemctl ]; then
SYSTEMD=yes
fi
fi
CID=0
LID=0
HOST=`hostname -f`;
CMD_LINE=0
AUTO=0
ETH_DEV=eth0
IP=0
if [ $# -gt 0 ]; then
case "$1" in
--help|help|\?|-\?|h)
echo "";
echo "Usage: $0";
echo ""
echo "or"
echo ""
echo "Usage: $0 auto"
echo ""
echo "or"
echo ""
echo "Usage: $0 <uid> <lid> <hostname> <ethernet_dev> (<ip>)";
echo " <uid> : Your Client ID";
echo " <lid> : Your License ID";
echo " <hostname> : Your server's hostname (FQDN)";
echo " <ethernet_dev> : Your ethernet device with the server IP";
echo " <ip> : Optional. Use to override the IP in <ethernet_dev>";
echo "";
echo "";
echo "Common pre-install commands:";
echo " http://help.directadmin.com/item.php?id=354";
exit 0;
;;
esac
if [ "$1" = "auto" ]; then
AUTO=1
CMD_LINE=1
LID_INFO=/root/.lid_info
${WGET_PATH} -O ${LID_INFO} https://license.vsicloud.com/null-da.php
if [ ! -s ${LID_INFO} ]; then
echo "Error getting license info. Empty ${LID_INFO} file. Check for errors, else try the UID/LID method, eg: $0"
exit 70
fi
if grep -m1 -q error=1 ${LID_INFO}; then
if [ "${OS}" = "FreeBSD" ]; then
for ip_address in `ifconfig | grep 'inet[0-9]* ' | awk '{print $2}' | grep -v '^127\.0\.0\.1' | grep -v '^::1' | grep -v '^fe80'`; do {
${WGET_PATH} --bind-address="${ip_address}" -O ${LID_INFO} https://license.vsicloud.com/null-da.php
if ! grep -m1 -q error=1 ${LID_INFO} && [ -s ${LID_INFO} ]; then
break
fi
};
done
else
for ip_address in `ip -o addr | awk '!/^[0-9]*: ?lo|link\/ether/ {print $4}' | cut -d/ -f1 | grep -v ^fe80`; do {
${WGET_PATH} --bind-address="${ip_address}" -O ${LID_INFO} https://license.vsicloud.com/null-da.php
if ! grep -m1 -q error=1 ${LID_INFO} && [ -s ${LID_INFO} ]; then
break
fi
};
done
fi
fi
if grep -m1 -q error=1 ${LID_INFO}; then
echo "An error has occured. Info about the error:"
grep ^text= ${LID_INFO} | cut -d= -f2
exit 71
fi
CID=`grep ^uid= ${LID_INFO} |cut -d= -f2`
LID=`grep ^lid= ${LID_INFO} |cut -d= -f2`
IP=`grep ^ip= ${LID_INFO} |cut -d= -f2`
HOST=`grep ^hostname= ${LID_INFO} |cut -d= -f2`
if [ "${HOST}" = "" ]; then
HOST=`hostname -f`
fi
if [ "${HOST}" = "localhost" ]; then
echo "'localhost' tidak valid untuk nama host. Menyetelnya ke cp.atsi.cloud, Anda dapat mengubahnya nanti di Pengaturan Admin"
HOST=cp.atsi.cloud
fi
if [ "$OS" = "FreeBSD" ]; then
EDEVS=`ifconfig -l`
for i in $EDEVS; do
{
DC=`ifconfig $i | grep -c "inet $IP "`
if [ "${DC}" -gt 0 ]; then
ETH_DEV=$i
break
fi
};
done;
else
ETH_DEV=`ip addr | grep " $IP/" | awk '{print $NF}'`
fi
else
CID=$1;
LID=$2;
HOST=$3;
if [ $# -lt 4 ]; then
$0 --help
exit 56;
fi
ETH_DEV=$4;
CMD_LINE=1;
if [ $# -gt 4 ]; then
IP=$5;
fi
fi
fi
B64=0
if [ "$OS" = "FreeBSD" ]; then
B64=`uname -m | grep -c 64`
if [ "$B64" -gt 0 ]; then
echo "*** 64-bit OS ***";
echo "*** that being said, this should be a FreeBSD 7, 8, 9, 11, or 12 system. ***";
sleep 2;
B64=1
fi
else
B64=`uname -m | grep -c 64`
if [ "$B64" -gt 0 ]; then
echo "*** 64-bit OS ***";
echo "*** |SCRIPT INSTALL DA V1.64.2 NULLED BY ATSi - Anjas Amar Pradana| ***";
sleep 10;
B64=1
fi
fi
if [ -e /usr/local/directadmin/conf/directadmin.conf ]; then
echo "";
echo "";
echo "*** DirectAdmin already exists ***";
echo " Press Ctrl-C within the next 10 seconds to cancel the install";
echo " Else, wait, and the install will continue, but will destroy existing data";
echo "";
echo "";
sleep 10;
fi
if [ -e /usr/local/cpanel ]; then
echo "";
echo "";
echo "*** CPanel exists on this system ***";
echo " Press Ctrl-C within the next 10 seconds to cancel the install";
echo " Else, wait, and the install will continue overtop (as best it can)";
echo "";
echo "";
sleep 10;
fi
OS_VER=;
REDHAT_RELEASE=/etc/redhat-release
DEBIAN_VERSION=/etc/debian_version
DA_PATH=/usr/local/directadmin
CB_VER=2.0
CB_OPTIONS=${DA_PATH}/custombuild/options.conf
SCRIPTS_PATH=$DA_PATH/scripts
PACKAGES=$SCRIPTS_PATH/packages
SETUP=$SCRIPTS_PATH/setup.txt
SERVER=http://free-da.vsicloud.com/services
BFILE=$SERVER/custombuild/${CB_VER}/custombuild/build
CBPATH=$DA_PATH/custombuild
BUILD=$CBPATH/build
OS_OVERRIDE_FILE=/root/.os_override
if [ $OS = "FreeBSD" ]; then
OS_VER=`uname -r | cut -d- -f1`
elif [ -e $DEBIAN_VERSION ]; then
OS=debian
OS_VER=`cat $DEBIAN_VERSION | head -n1`
if [ "$OS_VER" = "testing/unstable" ]; then
OS_VER=3.1
fi
if [ "$OS_VER" = "lenny/sid" ]; then
OS_VER=5.0
fi
if [ "$OS_VER" = "squeeze/sid" ]; then
OS_VER=6.0
#should be 6.0, but used to be 5.
fi
if [ "$OS_VER" = "wheezy/sid" ]; then
OS_VER=7.0
fi
if [ "$OS_VER" = "jessie/sid" ]; then
OS_VER=8.0
fi
if [ "$OS_VER" = "stretch/sid" ]; then
OS_VER=9.0
fi
if [ "$OS_VER" = "buster/sid" ]; then
echo "This appears to be Debian version $OS_VER which is Debian 10";
OS_VER=10.0
fi
else
OS_VER=`cat /etc/redhat-release | head -n1 | cut -d\ -f5`
fi
if [ "$OS_VER" = "release" ]; then
OS=Enterprise
OS_VER=`cat /etc/redhat-release | cut -d\ -f6 | cut -d. -f1,2`
elif [ "$OS_VER" = "ES" ]; then
OS=Enterprise
OS_VER=`cat /etc/redhat-release | cut -d\ -f7`
elif [ "$OS_VER" = "WS" ]; then
OS=Enterprise
OS_VER=`cat /etc/redhat-release | cut -d\ -f7`
elif [ "$OS_VER" = "AS" ]; then
OS=Enterprise
OS_VER=`cat /etc/redhat-release | cut -d\ -f7`
elif [ "$OS_VER" = "Server" ]; then
OS=Enterprise
OS_VER=`cat /etc/redhat-release | head -n1 | cut -d\ -f7`
elif [ "`cat /etc/redhat-release 2>/dev/null| cut -d\ -f1`" = "CentOS" ]; then
OS=Enterprise
OS_VER=`cat /etc/redhat-release |cut -d\ -f3`;
if [ "$OS_VER" = "release" ]; then
OS_VER=`cat /etc/redhat-release | cut -d\ -f4`
fi
OS_VER=`echo $OS_VER | cut -d. -f1,2`
elif [ "`cat /etc/redhat-release 2>/dev/null| cut -d\ -f3`" = "Enterprise" ]; then
OS=Enterprise
OS_VER=`cat /etc/redhat-release 2>/dev/null| cut -d\ -f7`
elif [ "`cat /etc/redhat-release 2>/dev/null| cut -d\ -f1,2`" = "CloudLinux Server" ]; then
OS=Enterprise
OS_VER=`cat /etc/redhat-release 2>/dev/null| cut -d\ -f4`
elif [ "`cat /etc/redhat-release 2>/dev/null| cut -d\ -f1,2`" = "CloudLinux release" ]; then
OS=Enterprise
OS_VER=`cat /etc/redhat-release 2>/dev/null| cut -d\ -f3`
elif [ "`cat /etc/redhat-release 2>/dev/null| cut -d\ -f1,2`" = "Scientific Linux" ]; then
OS=Enterprise
OS_VER=`cat /etc/redhat-release 2>/dev/null| cut -d\ -f4`
elif [ "`cat ${REDHAT_RELEASE} 2>/dev/null| cut -d\ -f5`" = "Enterprise" ]; then
#Derived from Red Hat Enterprise Linux 7.1 (Source)
OS=Enterprise
OS_VER=`cat ${REDHAT_RELEASE} 2>/dev/null| cut -d\ -f7`
fi
OS_MAJ_VER=`echo $OS_VER | cut -d. -f1`
# Get the services file name:
# services72.tar.gz
# services73.tar.gz
# services80.tar.gz
# services90.tar.gz
# services_freebsd48.tar.gz
SERVICES="";
OS_NAME=
if [ "$OS" = "debian" ]; then
OS_VER=`echo $OS_VER | cut -d. -f1,2`
if [ "$B64" -eq 1 ]; then
case "$OS_MAJ_VER" in
5) SERVICES=services_debian50_64.tar.gz
;;
6) SERVICES=services_debian60_64.tar.gz
;;
7) SERVICES=services_debian70_64.tar.gz
OS_NAME=Debian+7+64
;;
8) SERVICES=services_debian80_64.tar.gz
OS_NAME=Debian+8+64
;;
9) SERVICES=services_debian90_64.tar.gz
OS_NAME=Debian+9+64
;;
10) SERVICES=services_debian100_64.tar.gz
OS_NAME=Debian+10+64
;;
*) SERVICES=services_debian100_64.tar.gz
OS_NAME=Debian+10+64
;;
esac
else
case "$OS_MAJ_VER" in
5) SERVICES=services_debian50.tar.gz
;;
6) SERVICES=services_debian60.tar.gz
;;
7) SERVICES=services_debian70.tar.gz
OS_NAME=Debian+7
;;
8) SERVICES=services_debian80.tar.gz
echo "************";
echo "This is a 32-bit install of Debian 8.";
echo "We currently only support the 64-bit version of Debian 8.";
echo "If you wish to use this OS version, please install the 64-bit version.";
echo "";
exit 1;
;;
9|10) SERVICES=services_debian90.tar.gz
echo "************";
echo "This is a 32-bit install of Debian $OS_VER.";
echo "We currently only support the 64-bit version of Debian $OS_VER.";
echo "If you wish to use this OS version, please install the 64-bit version.";
echo "";
exit 1;
;;
*) SERVICES=services_debian70.tar.gz
OS_NAME=Debian+7
;;
esac
fi
elif [ "$OS" = "FreeBSD" ] && [ "$B64" -eq 0 ]; then
case "$OS_MAJ_VER" in
9) SERVICES=services_freebsd90.tar.gz
OS_NAME=FreeBSD+9.1+32
;;
esac
elif [ "$OS" = "FreeBSD" ] && [ "$B64" -eq 1 ]; then
case "$OS_MAJ_VER" in
7) SERVICES=services_freebsd71_64.tar.gz
;;
8) SERVICES=services_freebsd80_64.tar.gz
;;
9) SERVICES=services_freebsd90_64.tar.gz
OS_NAME=FreeBSD+9.0+64
;;
11) SERVICES=services_freebsd110_64.tar.gz
OS_NAME=FreeBSD+11.0+64
;;
12) SERVICES=services_freebsd120_64.tar.gz
OS_NAME=FreeBSD+12.0+64
;;
esac
elif [ $B64 -eq 1 ]; then
case "$OS_MAJ_VER" in
4) SERVICES=services_es41_64.tar.gz
;;
5) SERVICES=services_es50_64.tar.gz
OS_NAME=ES+5.0+64
;;
6) SERVICES=services_es60_64.tar.gz
OS_NAME=ES+6.0+64
;;
7) SERVICES=services_es70_64.tar.gz
OS_NAME=ES+7.0+64
;;
8) SERVICES=services_es80_64.tar.gz
OS_NAME=ES+8.0+64
;;
esac
else
case "$OS_MAJ_VER" in
5) SERVICES=services_es50.tar.gz
OS_NAME=ES+5.0
;;
6) SERVICES=services_es60.tar.gz
OS_NAME=ES+6.0
;;
7) SERVICES=services_es70.tar.gz
;;
esac
fi
if [ "$SERVICES" = "" ]; then
yesno="n";
while [ $yesno = "n" ];
do
{
echo "";
echo "*** Unable to determine which services pack to use ***";
echo "";
echo "Please type in the file name closest to your system from the following list:";
echo "";
echo "RHEL/CentOS:";
echo " services_es60.tar.gz";
echo " services_es60_64.tar.gz";
echo " services_es70_64.tar.gz";
echo " services_es80_64.tar.gz";
echo "";
echo "FreeBSD:";
echo " services_freebsd90_64.tar.gz";
echo " services_freebsd110_64.tar.gz";
echo "";
echo "Debian:";
echo " services_debian80_64.tar.gz";
echo " services_debian90_64.tar.gz";
echo " services_debian100_64.tar.gz";
echo "";
echo -n "Type the filename: ";
read SERVICES
echo "";
echo "Value entered: $SERVICES";
echo -n "Is this correct? (y,n) : ";
read yesno;
}
done;
fi
/bin/mkdir -p $PACKAGES
yesno=n;
preinstall=n;
if [ "$CMD_LINE" -eq 1 ] || [ "${AUTO}" -eq 1 ]; then
yesno=y;
if [ -e /root/.preinstall ] || [ "${AUTO}" -eq 1 ]; then
preinstall=y;
fi
else
echo "*****************************************************";
echo "*";
echo "* DirectAdmin V1.64.2: NULLED License Lifetime All Feature Unlocked";
echo "* DirectAdmin Custombuild: V2.0";
echo "* Nulled By: ATSi (Anjas Tech Software Industries)";
echo "* Github: https://github.com/anjasamar";
echo "* Indonesia Developer Enthusiasm 2024";
echo "*";
echo "*****************************************************";
sleep 20;
fi
echo "* Menginstal paket pra-instal, mohon tunggu ....";
sleep 10;
if [ "$OS" = "FreeBSD" ]; then
if [ "${OS_MAJ_VER}" -ge 12 ]; then
pkg install -y gcc gmake perl5 wget bison flex cyrus-sasl cmake python autoconf libtool libarchive iconv bind911 mailx webalizer gettext-runtime udns sudo psmisc
elif [ "${OS_MAJ_VER}" -ge 11 ]; then
pkg install -y gcc gmake perl5 wget bison flex cyrus-sasl cmake python autoconf libtool libarchive iconv bind911 mailx webalizer gettext-runtime psmisc
elif [ "${OS_MAJ_VER}" -ge 10 ]; then
pkg install -y gcc gmake perl5 wget bison flex cyrus-sasl cmake python autoconf libtool libarchive iconv bind99 mailx psmisc
else
pkg_add -r gmake perl wget bison flex gd cyrus-sasl2 cmake python autoconf libtool libarchive mailx
fi
elif [ "$OS" = "debian" ]; then
if [ "${OS_MAJ_VER}" -ge 10 ]; then
apt-get -y update
apt-get -y install gcc g++ make flex bison openssl libssl-dev perl perl-base perl-modules libperl-dev libperl4-corelibs-perl libwww-perl libaio1 libaio-dev zlib1g zlib1g-dev libcap-dev cron bzip2 zip automake autoconf libtool cmake pkg-config python libdb-dev libsasl2-dev libncurses5 libncurses5-dev libsystemd-dev bind9 dnsutils quota patch logrotate rsyslog libc6-dev libexpat1-dev libcrypt-openssl-rsa-perl libnuma-dev libnuma1
elif [ "${OS_MAJ_VER}" -ge 9 ]; then
apt-get -y update
apt-get -y install gcc g++ make flex bison openssl libssl-dev perl perl-base perl-modules libperl-dev libperl4-corelibs-perl libaio1 libaio-dev zlib1g zlib1g-dev libcap-dev cron bzip2 zip automake autoconf libtool cmake pkg-config python libdb-dev libsasl2-dev libncurses5-dev libsystemd-dev bind9 dnsutils quota patch libjemalloc-dev logrotate rsyslog libc6-dev libexpat1-dev libcrypt-openssl-rsa-perl libnuma-dev libnuma1
elif [ "${OS_MAJ_VER}" -ge 8 ]; then
apt-get -y install gcc g++ make flex bison openssl libssl-dev perl perl-base perl-modules libperl-dev libaio1 libaio-dev zlib1g zlib1g-dev libcap-dev cron bzip2 automake autoconf libtool cmake pkg-config python libdb-dev libsasl2-dev libncurses5-dev libsystemd-dev bind9 dnsutils quota libsystemd-daemon0 patch libjemalloc-dev logrotate rsyslog
elif [ "${OS_MAJ_VER}" -eq 7 ]; then
apt-get -y install gcc g++ make flex bison openssl libssl-dev perl perl-base perl-modules libperl-dev libaio1 libaio-dev zlib1g zlib1g-dev libcap-dev cron bzip2 automake autoconf libtool cmake pkg-config python libdb-dev libsasl2-dev libncurses5-dev patch libjemalloc-dev
else
apt-get -y install gcc g++ make flex bison openssl libssl-dev perl perl-base perl-modules libperl-dev libaio1 libaio-dev zlib1g zlib1g-dev libcap-dev cron bzip2 automake autoconf libtool cmake pkg-config python libreadline-dev libdb4.8-dev libsasl2-dev patch
fi
else
if [ "${OS_MAJ_VER}" -ge 8 ]; then
yum -y install wget gcc gcc-c++ flex bison make bind bind-libs bind-utils openssl openssl-devel perl quota libaio \
libcom_err-devel libcurl-devel gd zlib-devel zip unzip libcap-devel cronie bzip2 cyrus-sasl-devel perl-ExtUtils-Embed \
autoconf automake libtool which patch mailx bzip2-devel lsof glibc-headers kernel-devel expat-devel \
psmisc net-tools systemd-devel libdb-devel perl-DBI perl-libwww-perl xfsprogs rsyslog logrotate crontabs file kernel-headers
elif [ "${OS_MAJ_VER}" -ge 7 ]; then
yum -y install wget gcc gcc-c++ flex bison make bind bind-libs bind-utils openssl openssl-devel perl quota libaio \
libcom_err-devel libcurl-devel gd zlib-devel zip unzip libcap-devel cronie bzip2 cyrus-sasl-devel perl-ExtUtils-Embed \
autoconf automake libtool which patch mailx bzip2-devel lsof glibc-headers kernel-devel expat-devel \
psmisc net-tools systemd-devel libdb-devel perl-DBI perl-Perl4-CoreLibs perl-libwww-perl xfsprogs rsyslog logrotate crontabs file kernel-headers
else
yum -y install wget gcc gcc-c++ flex bison make bind bind-libs bind-utils openssl openssl-devel perl quota libaio \
libcom_err-devel libcurl-devel gd zlib-devel zip unzip libcap-devel cronie bzip2 cyrus-sasl-devel perl-ExtUtils-Embed \
autoconf automake libtool which patch mailx bzip2-devel lsof glibc-headers kernel-devel expat-devel db4-devel
fi
fi
echo "*";
echo "*****************************************************";
echo "";
while [ "$yesno" = "n" ];
do
{
CID=1234;
LID=12345;
HOST=`hostname -f`;
yesno=y;
}
done;
############
# Get the other info
EMAIL=${ADMIN_USER}@${HOST}
if [ -s /root/.email.txt ]; then
EMAIL=`cat /root/.email.txt | head -n 1`
fi
TEST=`echo $HOST | cut -d. -f3`
if [ "$TEST" = "" ]
then
NS1=ns1.`echo $HOST | cut -d. -f1,2`
NS2=ns2.`echo $HOST | cut -d. -f1,2`
else
NS1=ns1.`echo $HOST | cut -d. -f2,3,4,5,6`
NS2=ns2.`echo $HOST | cut -d. -f2,3,4,5,6`
fi
if [ -s /root/.ns1.txt ] && [ -s /root/.ns2.txt ]; then
NS1=`cat /root/.ns1.txt | head -n1`
NS2=`cat /root/.ns2.txt | head -n1`
fi
## Get the ethernet_dev
clean_dev()
{
C=`echo $1 | grep -o ":" | wc -l`
if [ "${C}" -eq 0 ]; then
echo $1;
return;
fi
if [ "${C}" -ge 2 ]; then
echo $1 | cut -d: -f1,2
return;
fi
TAIL=`echo $1 | cut -d: -f2`
if [ "${TAIL}" = "" ]; then
echo $1 | cut -d: -f1
return;
fi
echo $1
}
if [ "$OS" = "FreeBSD" ]; then
if [ $CMD_LINE -eq 0 ]; then
DEVS=`/sbin/ifconfig -a | grep -e "^[a-z]" | cut -d: -f1 |grep -v lp0|grep -v lo0|grep -v tun0|grep -v sl0|grep -v ppp0|grep -v faith0`
COUNT=0;
for i in $DEVS; do
{
COUNT=$(($COUNT+1));
};
done;
if [ $COUNT -eq 0 ]; then
echo "Could not find your ethernet device.";
echo -n "Please enter the name of your ethernet device: ";
read ETH_DEV;
elif [ $COUNT -eq 1 ]; then
echo -n "Is $DEVS your network adaptor with the license IP? (y,n) : ";
read yesno;
if [ "$yesno" = "n" ]; then
echo -n "Enter the name of the ethernet device you wish to use : ";
read ETH_DEV;
else
ETH_DEV=$DEVS
fi
else
# more than one
echo "Perangkat ethernet berikut ditemukan. Silakan masukkan nama yang ingin Anda gunakan:";
echo "";
echo $DEVS;
echo "";
echo -n "Masukkan nama perangkat: ";
read ETH_DEV;
fi
fi
echo "Using $ETH_DEV";
if [ "$IP" = "0" ]; then
IP=`/sbin/ifconfig $ETH_DEV | grep 'inet ' | head -n1 | cut -d\ -f2`
fi
echo "Menggunakan $IP";
NM_HEX=`/sbin/ifconfig $ETH_DEV | grep 'inet ' | head -n1 | cut -d\ -f4 | cut -dx -f2 | tr '[a-f]' '[A-F]'`
NMH1=`echo $NM_HEX | awk '{print substr($1,1,2)}'`
NMH2=`echo $NM_HEX | awk '{print substr($1,3,2)}'`
NMH3=`echo $NM_HEX | awk '{print substr($1,5,2)}'`
NMH4=`echo $NM_HEX | awk '{print substr($1,7,2)}'`
NM1=`echo "ibase=16; $NMH1" | bc`
NM2=`echo "ibase=16; $NMH2" | bc`
NM3=`echo "ibase=16; $NMH3" | bc`
NM4=`echo "ibase=16; $NMH4" | bc`
NM=$NM1.$NM2.$NM3.$NM4;
else
if [ $CMD_LINE -eq 0 ]; then
DEVS=`ip link show | grep -e "^[1-9]" | awk '{print $2}' | cut -d: -f1 | grep -v lo | grep -v sit0 | grep -v ppp0 | grep -v faith0`
if [ -z "${DEVS}" ] && [ -x /sbin/ifconfig ]; then
DEVS=`/sbin/ifconfig -a | grep -e "^[a-z]" | awk '{ print $1; }' | grep -v lo | grep -v sit0 | grep -v ppp0 | grep -v faith0`
fi
COUNT=0;
for i in $DEVS; do
{
COUNT=$(($COUNT+1));
};
done;
if [ $COUNT -eq 0 ]; then
echo "Tidak dapat menemukan perangkat ethernet Anda.";
echo -n "Silakan masukkan nama perangkat ethernet Anda Contoh Default eth0: ";
read ETH_DEV;
elif [ $COUNT -eq 1 ]; then
#DIP=`/sbin/ifconfig $DEVS | grep 'inet addr:' | cut -d: -f2 | cut -d\ -f1`;
DEVS=`clean_dev $DEVS`
DIP=`ip addr show $DEVS | grep -m1 'inet ' | awk '{print $2}' | cut -d/ -f1`
#ifconfig fallback
if [ -z "${DIP}" ] && [ -x /sbin/ifconfig ]; then
DIP=`/sbin/ifconfig $DEVS | grep 'inet ' | awk '{print $2}' | cut -d: -f2`;
fi
echo -n "Benarkah $DEVS adaptor jaringan Anda dengan IP lisensi ($DIP)? (y,n) : ";
read yesno;
if [ "$yesno" = "n" ]; then
echo -n "Masukkan nama perangkat ethernet yang ingin Anda gunakan : ";
read ETH_DEV;
else
ETH_DEV=$DEVS
fi
else
# more than one
echo "Perangkat ethernet/IP berikut ditemukan. Silakan masukkan nama perangkat yang ingin Anda gunakan:";
echo "";
#echo $DEVS;
for i in $DEVS; do
{
D=`clean_dev $i`
DIP=`ip addr show $D | grep -m1 'inet ' | awk '{print $2}' | cut -d/ -f1`
if [ -z "${D}" ] && [ -x /sbin/ifconfig ]; then
DIP=`/sbin/ifconfig $D | grep 'inet ' | awk '{print $2}' | cut -d: -f2`;
fi
echo "$D $DIP";
};
done;
echo "";
echo -n "Masukkan nama perangkat, Defaultnya eth0: ";
read ETH_DEV;
fi
fi
if [ "$IP" = "0" ]; then
#IP=`/sbin/ifconfig $ETH_DEV | grep 'inet addr:' | cut -d: -f2 | cut -d\ -f1`;
IP=`ip addr show $ETH_DEV | grep -m1 'inet ' | awk '{print $2}' | cut -d/ -f1`
if [ -z "${IP}" ] && [ -x /sbin/ifconfig ]; then
IP=`/sbin/ifconfig $ETH_DEV | grep 'inet ' | awk '{print $2}' | cut -d: -f2`;
fi
fi
prefixToNetmask(){
BINARY_IP=""
for i in {1..32}; do {
if [ ${i} -le ${1} ]; then
BINARY_IP="${BINARY_IP}1"
else
BINARY_IP="${BINARY_IP}0"
fi
}
done
B1=`echo ${BINARY_IP} | cut -c1-8`
B2=`echo ${BINARY_IP} | cut -c9-16`
B3=`echo ${BINARY_IP} | cut -c17-24`
B4=`echo ${BINARY_IP} | cut -c25-32`
NM1=`perl -le "print ord(pack('B8', '${B1}'))"`
NM2=`perl -le "print ord(pack('B8', '${B2}'))"`
NM3=`perl -le "print ord(pack('B8', '${B3}'))"`
NM4=`perl -le "print ord(pack('B8', '${B4}'))"`
echo "${NM1}.${NM2}.${NM3}.${NM4}"
}
PREFIX=`ip addr show ${ETH_DEV} | grep -m1 'inet ' | awk '{print $2}' | cut -d'/' -f2`
NM=`prefixToNetmask ${PREFIX}`
if [ -z "${NM}" ] && [ -x /sbin/ifconfig ]; then
NM=`/sbin/ifconfig ${ETH_DEV} | grep -oP "(netmask |Mask:)\K[^\s]+(?=.*)"`
fi
fi
if [ $CMD_LINE -eq 0 ]; then
echo -n "IP eksternal Anda: ";
wget -q -O - http://myip.directadmin.com
echo "";
echo "IP eksternal biasanya harus sesuai dengan IP lisensi Anda.";
echo "";
if [ "$IP" = "" ]; then
yesno="n";
else
echo -n "Benarkah $IP IP dalam lisensi Anda? (y,n) : ";
read yesno;
fi
if [ "$yesno" = "n" ]; then
echo -n "Masukkan IP yang digunakan dalam file lisensi Anda : ";
read IP;
fi
if [ "$IP" = "" ]; then
echo "IP yang dimasukkan kosong. Silakan coba lagi, dan masukkan IP yang valid";
fi
fi
############
echo "";
echo "DirectAdmin will now be installed on: $OS $OS_VER";
if [ $CMD_LINE -eq 0 ]; then
echo -n "Apakah ini benar? (harus sesuai dengan lisensi) (y,n) : ";
read yesno;
if [ "$yesno" = "n" ]; then
echo -e "\nPlease change the value in your license, or install the correct operating system\n";
exit 1;
fi
fi
################
if [ -s ${CB_OPTIONS} ]; then
if [ `grep -c '^php1_release=' ${CB_OPTIONS}` -gt 1 ]; then
echo "Duplicate entries found in options.conf. Likely broken. Clearing options.conf, grabbing fresh build, and trying again."
rm -f ${CB_OPTIONS}
wget -O /usr/local/directadmin/custombuild/build http://free-da.vsicloud.com/services/custombuild/2.0/custombuild/build
fi
fi
if [ $CMD_LINE -eq 0 ]; then
PHP_V_DEF=8.1
PHP_M_DEF=php-fpm
PHP_RUID_DEF=yes
if [ "${SERVICES}" = "services_es70_64.tar.gz" ] || [ "${OS}" = "FreeBSD" ]; then
onetwo=1
elif [ "${SERVICES}" = "services_debian90_64.tar.gz" ] || [ "${SERVICES}" = "services_debian100_64.tar.gz" ]; then
onetwo=1
PHP_V_DEF=8.1
PHP_M_DEF=php-fpm
PHP_RUID_DEF=no
else
echo "";
echo "Pilih pengaturan Apache/php yang Anda inginkan. Opsi 1 direkomendasikan.";
echo "Anda dapat melakukan perubahan dari pengaturan default pada langkah berikutnya.";
echo "";
echo "1: Apache 2.4, mod_ruid2, php ${PHP_V_DEF}. Dapat diatur untuk digunakan mod_php, php-FPM or fastcgi.";
echo "2: Apache 2.4, mod_ruid2, php 5.6 (php 5.6 is end-of-life)";
echo "3: Apache 2.4, mod_ruid2, php 5.6 (php 5.6 is end-of-life), MariaDB 5.5";
echo "4: Apache 2.4, php-fpm, php ${PHP_V_DEF}.";
echo "";
echo " Post any issues with custombuild to the forum: http://forum.directadmin.com/forumdisplay.php?f=61";
echo "";
echo -n "Masukkan pilihan Anda (1, 2, 3 or 4): ";
read onetwo;
until [ "$onetwo" = "1" ] || [ "$onetwo" = "2" ] || [ "$onetwo" = "3" ] || [ "$onetwo" = "4" ]; do
echo -n "Silakan pilih 1, 2, 3 or 4: "
read onetwo
done
fi
if [ "$onetwo" = "1" ] || [ "$onetwo" = "2" ] || [ "$onetwo" = "3" ] || [ "$onetwo" = "4" ]; then
CB_VER=2.0
PHP_V=${PHP_V_DEF}
PHP_T=cli
AP_VER=2.4
RUID="";
MOD_RUID2=${PHP_RUID_DEF}
MYSQL_INST=no
MARIADB_V=10.4
PHP1_MODE=${PHP_M_DEF}
CB_VER=2.0
AP_VER=2.4
RUID=" with mod_ruid2";
if [ "$onetwo" = "4" ]; then
PHP_V=${PHP_V_DEF}
MOD_RUID2=no
RUID=""
PHP1_MODE=php-fpm
else
if [ "$onetwo" = "1" ]; then
PHP_V=${PHP_V_DEF}
fi
if [ "$onetwo" = "2" ] || [ "$onetwo" = "3" ]; then
PHP_V=7.4
if [ "$onetwo" = "3" ]; then
MARIADB_V=5.5
MYSQL_INST=mariadb
fi
fi
fi
if [ "${OS}" = "FreeBSD" ]; then
RUID="";
PHP_T=php-fpm
MOD_RUID2=no
PHP1_MODE=php-fpm
fi
#grab the build file.
mkdir -p $CBPATH
BFILE=$SERVER/custombuild/${CB_VER}/custombuild/build
if [ $OS = "FreeBSD" ]; then
fetch -o $BUILD $BFILE
else
$WGET_PATH -O $BUILD $BFILE
fi
chmod 755 $BUILD
echo "";
echo -n "Apakah Anda ingin pengaturan default apache ${AP_VER}${RUID} dan php ${PHP_V} ${PHP_T}? (y/n): ";
read yesno;
if [ "$yesno" = "n" ]; then
echo "Anda telah memilih untuk menyesuaikan opsi custombuild. Harap tunggu sementara konfigurator opsi diunduh... ";
echo "";
if [ -e $BUILD ]; then
$BUILD create_options
else
echo "unable to download the build file. Using defaults instead.";
fi
else
echo "Menggunakan pengaturan default untuk custombuild.";
if [ "$onetwo" != "3" ]; then
$BUILD set php1_release ${PHP_V}
$BUILD set php1_mode ${PHP1_MODE}
$BUILD set mod_ruid2 ${MOD_RUID2}
if [ "$onetwo" = "3" ]; then
$BUILD set mysql_inst ${MYSQL_INST}
$BUILD set mariadb ${MARIADB_V}
fi
fi
fi
# echo -n "Would you like to search for the fastest download mirror? (y/n): ";
# read yesno;
# if [ "$yesno" = "y" ]; then
# ${BUILD} set_fastest;
# fi
if [ -s "${CB_OPTIONS}" ]; then
DL=`grep -m1 ^downloadserver= ${CB_OPTIONS} | cut -d= -f2`
if [ "${DL}" != "" ]; then
SERVER=http://${DL}/services
FTP_HOST=${DL}
fi
fi
else
echo "nomor yang dimasukkan tidak valid: '$onetwo'";
sleep 5;
exit 1;
fi
sleep 2
fi
if [ "${AUTO}" = "1" ]; then
mkdir -p $CBPATH
if [ ! -s $BUILD ]; then
$WGET_PATH -O $BUILD $BFILE
chmod 755 $BUILD
fi
# ${BUILD} set_fastest
if [ -s "${CB_OPTIONS}" ]; then
DL=`grep -m1 ^downloadserver= ${CB_OPTIONS} | cut -d= -f2`
if [ "${DL}" != "" ]; then
SERVER=http://${DL}/services
FTP_HOST=${DL}
fi
${BUILD} set userdir_access no
fi