forked from TommyTran732/Pterodactyl-Script
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
2174 lines (2071 loc) · 89.7 KB
/
install.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
output(){
echo -e '\e[36m'$1'\e[0m';
}
warn(){
echo -e '\e[31m'$1'\e[0m';
}
preflight(){
output "Pterodactyl Installation & Upgrade Script"
output "Copyright © 2020 Thien Tran <[email protected]>."
output "Please join my Telegram for community support: https://t.me/revenact"
output ""
output "Please note that this script is meant to be installed on a fresh OS. Installing it on a non-fresh OS may cause problems."
output "Automatic operating system detection initialized..."
os_check
if [ "$EUID" -ne 0 ]; then
output "Please run as root."
exit 3
fi
output "Automatic architecture detection initialized..."
MACHINE_TYPE=`uname -m`
if [ ${MACHINE_TYPE} == 'x86_64' ]; then
output "64-bit server detected! Good to go."
output ""
else
output "Unsupported architecture detected! Please switch to 64-bit (x86_64)."
exit 4
fi
output "Automatic virtualization detection initialized..."
if [ "$lsb_dist" = "ubuntu" ]; then
apt-get update --fix-missing
apt-get -y install software-properties-common
add-apt-repository -y universe
apt-get -y install virt-what curl
elif [ "$lsb_dist" = "debian" ]; then
apt update --fix-missing
apt-get -y install software-properties-common virt-what wget curl dnsutils
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
yum -y install virt-what wget bind-utils
fi
virt_serv=$(echo $(virt-what))
if [ "$virt_serv" = "" ]; then
output "Virtualization: Bare Metal detected."
elif [ "$virt_serv" = "openvz lxc" ]; then
output "Virtualization: OpenVZ 7 detected."
elif [ "$virt_serv" = "xen xen-hvm" ]; then
output "Virtualization: Xen-HVM detected."
elif [ "$virt_serv" = "xen xen-hvm aws" ]; then
output "Virtualization: Xen-HVM on AWS detected."
warn "When creating allocations for this node, please use the internal IP as Google Cloud uses NAT routing."
warn "Resuming in 10 seconds..."
sleep 10
else
output "Virtualization: $virt_serv detected."
fi
output ""
if [ "$virt_serv" != "" ] && [ "$virt_serv" != "kvm" ] && [ "$virt_serv" != "vmware" ] && [ "$virt_serv" != "hyperv" ] && [ "$virt_serv" != "openvz lxc" ] && [ "$virt_serv" != "xen xen-hvm" ] && [ "$virt_serv" != "xen xen-hvm aws" ]; then
warn "Unsupported type of virtualization detected. Please consult with your hosting provider whether your server can run Docker or not. Proceed at your own risk."
warn "No support would be given if your server breaks at any point in the future."
warn "Proceed?\n[1] Yes.\n[2] No."
read choice
case $choice in
1) output "Proceeding..."
;;
2) output "Cancelling installation..."
exit 5
;;
esac
output ""
fi
output "Kernel detection initialized..."
if echo $(uname -r) | grep -q xxxx; then
output "OVH kernel detected. This script will not work. Please reinstall your server using a generic/distribution kernel."
output "When you are reinstalling your server, click on 'custom installation' and click on 'use distribution' kernel after that."
output "You might also want to do custom partitioning, remove the /home partition and give / all the remaining space."
output "Please do not hesitate to contact us if you need help regarding this issue."
exit 6
elif echo $(uname -r) | grep -q pve; then
output "Proxmox LXE kernel detected. You have chosen to continue in the last step, therefore we are proceeding at your own risk."
output "Proceeding with a risky operation..."
elif echo $(uname -r) | grep -q stab; then
if echo $(uname -r) | grep -q 2.6; then
output "OpenVZ 6 detected. This server will definitely not work with Docker, regardless of what your provider might say. Exiting to avoid further damages."
exit 6
fi
elif echo $(uname -r) | grep -q gcp; then
output "Google Cloud Platform detected."
warn "Please make sure you have a static IP setup, otherwise the system will not work after a reboot."
warn "Please also make sure the GCP firewall allows the ports needed for the server to function normally."
warn "When creating allocations for this node, please use the internal IP as Google Cloud uses NAT routing."
warn "Resuming in 10 seconds..."
sleep 10
else
output "Did not detect any bad kernel. Moving forward..."
output ""
fi
}
os_check(){
if [ -r /etc/os-release ]; then
lsb_dist="$(. /etc/os-release && echo "$ID")"
dist_version="$(. /etc/os-release && echo "$VERSION_ID")"
if [ $lsb_dist = "rhel" ]; then
dist_version="$(echo $dist_version | awk -F. '{print $1}')"
fi
else
exit 1
fi
if [ "$lsb_dist" = "ubuntu" ]; then
if [ "$dist_version" != "20.04" ] && [ "$dist_version" != "18.04" ] && [ "$dist_version" != "16.04" ]; then
output "Unsupported Ubuntu version. Only Ubuntu 20.04, 18.04 and 16.04 are supported."
exit 2
fi
elif [ "$lsb_dist" = "debian" ]; then
if [ "$dist_version" != "10" ] &&[ "$dist_version" != "9" ]; then
output "Unsupported Debian version. Only Debian 10 and 9 are supported."
exit 2
fi
elif [ "$lsb_dist" = "fedora" ]; then
if [ "$dist_version" != "32" ] && [ "$dist_version" != "31" ]; then
output "Unsupported Fedora version. Only Fedora 32 and 31 are supported."
exit 2
fi
elif [ "$lsb_dist" = "centos" ]; then
if [ "$dist_version" != "8" ] && [ "$dist_version" != "7" ]; then
output "Unsupported CentOS version. Only CentOS 8 and 7 are supported."
exit 2
fi
elif [ "$lsb_dist" = "rhel" ]; then
if [ $dist_version != "8" ]; then
output "Unsupported RHEL version. Only RHEL 8 is supported."
exit 2
fi
elif [ "$lsb_dist" != "ubuntu" ] && [ "$lsb_dist" != "debian" ] && [ "$lsb_dist" != "centos" ]; then
output "Unsupported operating system."
output ""
output "Supported OS:"
output "Ubuntu: 20.04, 18.04, 16.04"
output "Debian: 10, 9"
output "Fedora: 32, 31"
output "CentOS: 8, 7"
output "RHEL: 8"
exit 2
fi
}
install_options(){
output "Please select your installation option:"
output "[1] Install the panel (1.0.3)."
output "[2] Install the panel (0.7.19)."
output "[3] Install the wings."
output "[4] Install the daemon."
output "[5] Install the (1.0.3) panel and wings."
output "[6] Install the (0.7.19) panel and daemon."
output "[7] Install the standalone SFTP server."
output "[8] Upgrade (1.0) panel to (1.0.3)."
output "[9] Upgrade (0.7.x) panel to (1.0.3)."
output "[10] Upgrade (0.7.x) panel to (0.7.19)."
output "[11] Upgrade (0.6.x) daemon to (0.6.13)."
output "[12] Migrating daemon to wings."
output "[13] Upgrade the panel to 1.0.3 and Migrate to wings"
output "[14] Upgrade the panel to 0.7.19 and daemon to (0.6.13)"
output "[15] Upgrade the standalone SFTP server to (1.0.5)."
output "[16] Make Pterodactyl compatible with the mobile app (only use this after you have installed the panel - check out https://pterodactyl.cloud for more information)."
output "[17] Update mobile compatibility."
output "[18] Install or update to phpMyAdmin (5.0.4) (only use this after you have installed the panel)."
output "[19] Install a standalone database host (only for use on daemon-only installations)."
output "[20] Change Pterodactyl theme (0.7.19 Only)."
output "[21] Emergency MariaDB root password reset."
output "[22] Emergency database host information reset."
read choice
case $choice in
1 ) installoption=1
output "You have selected 1.0.3 panel installation only."
;;
2 ) installoption=2
output "You have selected 0.7.19 panel installation only."
;;
3 ) installoption=3
output "You have selected wings installation only."
;;
4 ) installoption=4
output "You have selected daemon installation only."
;;
5 ) installoption=5
output "You have selected 1.0.3 panel and wings installation."
;;
6 ) installoption=6
output "You have selected 0.7.19 panel and daemon installation."
;;
7 ) installoption=7
output "You have selected to install the standalone SFTP server."
;;
8 ) installoption=8
output "You have selected to upgrade the panel to 1.0.3."
;;
9 ) installoption=9
output "You have selected to upgrade the panel to 1.0.3."
;;
10 ) installoption=10
output "You have selected to upgrade the panel to 0.7.19."
;;
11 ) installoption=11
output "You have selected to upgrade the daemon to 0.6.13."
;;
12 ) installoption=12
output "You have selected to migrate daemon to wings."
;;
13 ) installoption=13
output "You have selected to upgrade both the panel to 1.0.3 and migrating to wings."
;;
14 ) installoption=14
output "You have selected to upgrade both the panel to 0.7.19 and daemon to 0.6.13."
;;
15 ) installoption=15
output "You have selected to upgrade the standalone SFTP."
;;
16 ) installoption=16
output "You have activated mobile app compatibility."
;;
17 ) installoption=17
output "You have selected to update the mobile app compatibility."
;;
18 ) installoption=18
output "You have selected to install or update phpMyAdmin."
;;
19 ) installoption=19
output "You have selected to install a Database host."
;;
20 ) installoption=20
output "You have selected to change Pterodactyl's 0.7.19 only."
;;
21 ) installoption=21
output "You have selected MariaDB root password reset."
;;
22 ) installoption=22
output "You have selected Database Host information reset."
;;
* ) output "You did not enter a valid selection."
install_options
esac
}
webserver_options() {
output "Please select which web server you would like to use:\n[1] Nginx (recommended).\n[2] Apache2/httpd."
read choice
case $choice in
1 ) webserver=1
output "You have selected Nginx."
output ""
;;
2 ) webserver=2
output "You have selected Apache2/httpd."
output ""
;;
* ) output "You did not enter a valid selection."
webserver_options
esac
}
theme_options() {
output "Would you like to install one of Fonix's themes?"
warn "AS OF NOW, FONIX HAS NOT UPDATED HIS THEME TO 0.7.19 TO FIX THE XSS EXPLOIT IN PTERODACTYL <=0.7.18 YET. DO NOT USE THESE IN PRODUCTION. I HIGHLY RECOMMEND THAT YOU SELECT [1]."
output "[1] No."
output "[2] Super Pink and Fluffy."
output "[3] Tango Twist."
output "[4] Blue Brick."
output "[5] Minecraft Madness."
output "[6] Lime Stitch."
output "[7] Red Ape."
output "[8] BlackEnd Space."
output "[9] Nothing But Graphite."
output ""
output "You can find out about Fonix's themes here: https://github.com/TheFonix/Pterodactyl-Themes"
read choice
case $choice in
1 ) themeoption=1
output "You have selected to install the vanilla Pterodactyl theme."
output ""
;;
2 ) themeoption=2
output "You have selected to install Fonix's Super Pink and Fluffy theme."
output ""
;;
3 ) themeoption=3
output "You have selected to install Fonix's Tango Twist theme."
output ""
;;
4 ) themeoption=4
output "You have selected to install Fonix's Blue Brick theme."
output ""
;;
5 ) themeoption=5
output "You have selected to install Fonix's Minecraft Madness theme."
output ""
;;
6 ) themeoption=6
output "You have selected to install Fonix's Lime Stitch theme."
output ""
;;
7 ) themeoption=7
output "You have selected to install Fonix's Red Ape theme."
output ""
;;
8 ) themeoption=8
output "You have selected to install Fonix's BlackEnd Space theme."
output ""
;;
9 ) themeoption=9
output "You have selected to install Fonix's Nothing But Graphite theme."
output ""
;;
* ) output "You did not enter a valid selection."
theme_options
esac
}
required_infos() {
output "Please enter the desired user email address:"
read email
dns_check
}
dns_check(){
output "Please enter your FQDN (panel.domain.tld):"
read FQDN
output "Resolving DNS..."
SERVER_IP=$(curl -s http://checkip.amazonaws.com)
DOMAIN_RECORD=$(dig +short ${FQDN})
if [ "${SERVER_IP}" != "${DOMAIN_RECORD}" ]; then
output ""
output "The entered domain does not resolve to the primary public IP of this server."
output "Please make an A record pointing to your server's IP. For example, if you make an A record called 'panel' pointing to your server's IP, your FQDN is panel.domain.tld"
output "If you are using Cloudflare, please disable the orange cloud."
output "If you do not have a domain, you can get a free one at https://freenom.com"
dns_check
else
output "Domain resolved correctly. Good to go..."
fi
}
theme() {
output "Theme installation initialized..."
cd /var/www/pterodactyl
if [ "$themeoption" = "1" ]; then
output "Keeping Pterodactyl's vanilla theme."
elif [ "$themeoption" = "2" ]; then
curl https://raw.githubusercontent.com/TheFonix/Pterodactyl-Themes/master/MasterThemes/PinkAnFluffy/build.sh | sh
elif [ "$themeoption" = "3" ]; then
curl https://raw.githubusercontent.com/TheFonix/Pterodactyl-Themes/master/MasterThemes/TangoTwist/build.sh | sh
elif [ "$themeoption" = "4" ]; then
curl https://raw.githubusercontent.com/TheFonix/Pterodactyl-Themes/master/MasterThemes/BlueBrick/build.sh | sh
elif [ "$themeoption" = "5" ]; then
curl https://raw.githubusercontent.com/TheFonix/Pterodactyl-Themes/master/MasterThemes/MinecraftMadness/build.sh | sh
elif [ "$themeoption" = "6" ]; then
curl https://raw.githubusercontent.com/TheFonix/Pterodactyl-Themes/master/MasterThemes/LimeStitch/build.sh | sh
elif [ "$themeoption" = "7" ]; then
curl https://raw.githubusercontent.com/TheFonix/Pterodactyl-Themes/master/MasterThemes/RedApe/build.sh | sh
elif [ "$themeoption" = "8" ]; then
curl https://raw.githubusercontent.com/TheFonix/Pterodactyl-Themes/master/MasterThemes/BlackEndSpace/build.sh | sh
elif [ "$themeoption" = "9" ]; then
curl https://raw.githubusercontent.com/TheFonix/Pterodactyl-Themes/master/MasterThemes/NothingButGraphite/build.sh | sh
fi
php artisan view:clear
php artisan cache:clear
}
repositories_setup(){
output "Configuring your repositories..."
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
apt-get -y install sudo
apt-get -y install software-properties-common curl apt-transport-https ca-certificates gnupg
dpkg --remove-architecture i386
echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4
apt-get -y update
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
if [ "$lsb_dist" = "ubuntu" ]; then
LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
add-apt-repository -y ppa:chris-lea/redis-server
if [ "$dist_version" != "20.04" ]; then
add-apt-repository -y ppa:certbot/certbot
add-apt-repository -y ppa:nginx/development
fi
apt -y install tuned dnsutils
tuned-adm profile latency-performance
elif [ "$lsb_dist" = "debian" ]; then
apt-get -y install ca-certificates apt-transport-https
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
if [ "$dist_version" = "10" ]; then
apt -y install dirmngr
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
apt -y install tuned
tuned-adm profile latency-performance
elif [ "$dist_version" = "9" ]; then
apt -y install dirmngr
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
fi
fi
apt-get -y update
apt-get -y upgrade
apt-get -y autoremove
apt-get -y autoclean
apt-get -y install curl
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ]; then
if [ "$lsb_dist" = "fedora" ] ; then
if [ "$dist_version" = "32" ]; then
dnf -y install http://rpms.remirepo.net/fedora/remi-release-32.rpm
elif [ "$dist_version" = "31" ]; then
dnf -y install http://rpms.remirepo.net/fedora/remi-release-31.rpm
fi
dnf -y install dnf-plugins-core python2 libsemanage-devel
dnf config-manager --set-enabled remi
dnf -y module enable php:remi-7.4
dnf -y module enable nginx:mainline/common
dnf -y module enable mariadb:14/server
elif [ "$lsb_dist" = "centos" ] && [ "$dist_version" = "8" ]; then
dnf -y install epel-release boost-program-options
dnf -y install http://rpms.remirepo.net/enterprise/remi-release-8.rpm
dnf config-manager --set-enabled remi
dnf -y module enable php:remi-7.4
dnf -y module enable nginx:mainline/common
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
dnf config-manager --set-enabled mariadb
elif [ "$lsb_dist" = "centos" ] && [ "$dist_version" = "7" ]; then
bash -c 'cat > /etc/yum.repos.d/nginx.repo' <<-'EOF'
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
EOF
bash -c 'cat > /etc/yum.repos.d/mariadb.repo' <<-'EOF'
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.5/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF
yum -y install epel-release
yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum -y install policycoreutils-python yum-utils libsemanage-devel
yum-config-manager --enable remi
yum-config-manager --enable remi-php74
yum-config-manager --enable nginx-mainline
yum-config-manager --enable mariadb
elif [ "$lsb_dist" = "rhel" ] && [ "$dist_version" = "8" ]; then
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf -y install boost-program-options
dnf -y install http://rpms.remirepo.net/enterprise/remi-release-8.rpm
dnf config-manager --set-enabled remi
dnf -y module enable php:remi-7.4
dnf -y module enable nginx:mainline/common
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
dnf config-manager --set-enabled mariadb
fi
yum -y install yum-utils tuned
tuned-adm profile latency-performance
yum -y upgrade
yum -y autoremove
yum -y clean packages
yum -y install curl bind-utils cronie
fi
}
repositories_setup_0.7.19(){
output "Configuring your repositories..."
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
apt-get -y install sudo
apt-get -y install software-properties-common dnsutils gpg-agent
dpkg --remove-architecture i386
echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4
apt-get -y update
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
if [ "$lsb_dist" = "ubuntu" ]; then
LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
add-apt-repository -y ppa:chris-lea/redis-server
if [ "$dist_version" != "20.04" ]; then
add-apt-repository -y ppa:certbot/certbot
add-apt-repository -y ppa:nginx/development
fi
apt -y install tuned dnsutils
tuned-adm profile latency-performance
elif [ "$lsb_dist" = "debian" ]; then
apt-get -y install ca-certificates apt-transport-https
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
if [ "$dist_version" = "10" ]; then
apt -y install dirmngr
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
apt -y install tuned
tuned-adm profile latency-performance
elif [ "$dist_version" = "9" ]; then
apt -y install dirmngr
wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
sudo apt-key adv --fetch-keys 'https://mariadb.org/mariadb_release_signing_key.asc'
fi
fi
apt-get -y update
apt-get -y upgrade
apt-get -y autoremove
apt-get -y autoclean
apt-get -y install curl
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ]; then
if [ "$lsb_dist" = "fedora" ] ; then
if [ "$dist_version" = "32" ]; then
dnf -y install http://rpms.remirepo.net/fedora/remi-release-32.rpm
elif [ "$dist_version" = "31" ]; then
dnf -y install http://rpms.remirepo.net/fedora/remi-release-31.rpm
fi
dnf -y install dnf-plugins-core python2 libsemanage-devel
dnf config-manager --set-enabled remi
dnf -y module enable php:remi-7.3
dnf -y module enable nginx:mainline/common
dnf -y module enable mariadb:14/server
elif [ "$lsb_dist" = "centos" ] && [ "$dist_version" = "8" ]; then
dnf -y install epel-release boost-program-options
dnf -y install http://rpms.remirepo.net/enterprise/remi-release-8.rpm
dnf config-manager --set-enabled remi
dnf -y module enable php:remi-7.3
dnf -y module enable nginx:mainline/common
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
dnf config-manager --set-enabled mariadb
elif [ "$lsb_dist" = "centos" ] && [ "$dist_version" = "7" ]; then
bash -c 'cat > /etc/yum.repos.d/nginx.repo' <<-'EOF'
[nginx-mainline]
name=nginx mainline repo
baseurl=http://nginx.org/packages/mainline/centos/$releasever/$basearch/
gpgcheck=1
enabled=0
gpgkey=https://nginx.org/keys/nginx_signing.key
module_hotfixes=true
EOF
bash -c 'cat > /etc/yum.repos.d/mariadb.repo' <<-'EOF'
[mariadb]
name = MariaDB
baseurl = http://yum.mariadb.org/10.5/centos7-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF
yum -y install epel-release
yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum -y install policycoreutils-python yum-utils libsemanage-devel
yum-config-manager --enable remi
yum-config-manager --enable remi-php73
yum-config-manager --enable nginx-mainline
yum-config-manager --enable mariadb
elif [ "$lsb_dist" = "rhel" ] && [ "$dist_version" = "8" ]; then
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf -y install boost-program-options
dnf -y install http://rpms.remirepo.net/enterprise/remi-release-8.rpm
dnf config-manager --set-enabled remi
dnf -y module enable php:remi-7.3
dnf -y module enable nginx:mainline/common
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
dnf config-manager --set-enabled mariadb
fi
yum -y install yum-utils tuned
tuned-adm profile latency-performance
yum -y upgrade
yum -y autoremove
yum -y clean packages
yum -y install curl bind-utils cronie
fi
}
install_dependencies(){
output "Installing dependencies..."
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
if [ "$webserver" = "1" ]; then
apt -y install php7.4 php7.4-{cli,gd,mysql,pdo,mbstring,tokenizer,bcmath,xml,fpm,curl,zip} nginx tar unzip git redis-server nginx git wget expect
elif [ "$webserver" = "2" ]; then
apt -y install php7.4 php7.4-{cli,gd,mysql,pdo,mbstring,tokenizer,bcmath,xml,fpm,curl,zip} curl tar unzip git redis-server apache2 libapache2-mod-php7.4 redis-server git wget expect
fi
sh -c "DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated mariadb-server"
elif [ "$lsb_dist" = "centos" ] && [ "$dist_version" = "7" ]; then
if [ "$webserver" = "1" ]; then
yum -y install php php-common php-fpm php-cli php-json php-mysqlnd php-mcrypt php-gd php-mbstring php-pdo php-zip php-bcmath php-dom php-opcache MariaDB-server redis nginx git policycoreutils-python-utils unzip wget expect tar
elif [ "$webserver" = "2" ]; then
yum -y install php php-common php-fpm php-cli php-json php-mysqlnd php-mcrypt php-gd php-mbstring php-pdo php-zip php-bcmath php-dom php-opcache MariaDB-server redis httpd git policycoreutils-python-utils mod_ssl unzip wget expect tar
fi
else
if [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
if [ "$dist_version" = "8" ]; then
dnf -y install MariaDB-server MariaDB-client --disablerepo=AppStream
fi
else
dnf -y install MariaDB-server
fi
dnf -y module install php:remi-7.4
if [ "$webserver" = "1" ]; then
dnf -y install redis nginx git policycoreutils-python-utils unzip wget expect jq php-mysql php-zip php-bcmath tar
elif [ "$webserver" = "2" ]; then
dnf -y install redis httpd git policycoreutils-python-utils mod_ssl unzip wget expect jq php-mysql php-zip php-mcmath tar
fi
fi
output "Enabling Services..."
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
systemctl enable redis-server
service redis-server start
systemctl enable php7.4-fpm
service php7.4-fpm start
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
systemctl enable redis
service redis start
systemctl enable php-fpm
service php-fpm start
fi
systemctl enable cron
systemctl enable mariadb
if [ "$webserver" = "1" ]; then
systemctl enable nginx
service nginx start
elif [ "$webserver" = "2" ]; then
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
systemctl enable apache2
service apache2 start
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
systemctl enable httpd
service httpd start
fi
fi
service mysql start
}
install_dependencies_0.7.19(){
output "Installing dependencies..."
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
if [ "$webserver" = "1" ]; then
apt-get -y install php7.3 php7.3-cli php7.3-gd php7.3-mysql php7.3-pdo php7.3-mbstring php7.3-tokenizer php7.3-bcmath php7.3-xml php7.3-fpm php7.3-curl php7.3-zip curl tar unzip git redis-server nginx git wget expect
elif [ "$webserver" = "2" ]; then
apt-get -y install php7.3 php7.3-cli php7.3-gd php7.3-mysql php7.3-pdo php7.3-mbstring php7.3-tokenizer php7.3-bcmath php7.3-xml php7.3-fpm php7.3-curl php7.3-zip curl tar unzip git redis-server apache2 libapache2-mod-php7.3 redis-server git wget expect
fi
sh -c "DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated mariadb-server"
elif [ "$lsb_dist" = "centos" ] && [ "$dist_version" = "7" ]; then
if [ "$webserver" = "1" ]; then
yum -y install php php-common php-fpm php-cli php-json php-mysqlnd php-mcrypt php-gd php-mbstring php-pdo php-zip php-bcmath php-dom php-opcache MariaDB-server redis nginx git policycoreutils-python-utils unzip wget expect tar
elif [ "$webserver" = "2" ]; then
yum -y install php php-common php-fpm php-cli php-json php-mysqlnd php-mcrypt php-gd php-mbstring php-pdo php-zip php-bcmath php-dom php-opcache MariaDB-server redis httpd git policycoreutils-python-utils mod_ssl unzip wget expect tar
fi
else
if [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
if [ "$dist_version" = "8" ]; then
dnf -y install MariaDB-server MariaDB-client --disablerepo=AppStream
fi
else
dnf -y install MariaDB-server
fi
dnf -y module install php:remi-7.3
if [ "$webserver" = "1" ]; then
dnf -y install redis nginx git policycoreutils-python-utils unzip wget expect jq php-mysql php-zip php-bcmath tar
elif [ "$webserver" = "2" ]; then
dnf -y install redis httpd git policycoreutils-python-utils mod_ssl unzip wget expect jq php-mysql php-zip php-mcmath tar
fi
fi
output "Enabling Services..."
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
systemctl enable redis-server
service redis-server start
systemctl enable php7.3-fpm
service php7.3-fpm start
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
systemctl enable redis
service redis start
systemctl enable php-fpm
service php-fpm start
fi
systemctl enable cron
systemctl enable mariadb
if [ "$webserver" = "1" ]; then
systemctl enable nginx
service nginx start
elif [ "$webserver" = "2" ]; then
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
systemctl enable apache2
service apache2 start
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
systemctl enable httpd
service httpd start
fi
fi
service mysql start
}
install_pterodactyl() {
output "Creating the databases and setting root password..."
password=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`
adminpassword=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`
rootpassword=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`
Q0="DROP DATABASE IF EXISTS test;"
Q1="CREATE DATABASE IF NOT EXISTS panel;"
Q2="SET old_passwords=0;"
Q3="GRANT ALL ON panel.* TO 'pterodactyl'@'127.0.0.1' IDENTIFIED BY '$password';"
Q4="GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, INDEX, DROP, EXECUTE, PROCESS, RELOAD, LOCK TABLES, CREATE USER ON *.* TO 'admin'@'$SERVER_IP' IDENTIFIED BY '$adminpassword' WITH GRANT OPTION;"
Q5="SET PASSWORD FOR 'root'@'localhost' = PASSWORD('$rootpassword');"
Q6="DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
Q7="DELETE FROM mysql.user WHERE User='';"
Q8="DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%';"
Q9="FLUSH PRIVILEGES;"
SQL="${Q0}${Q1}${Q2}${Q3}${Q4}${Q5}${Q6}${Q7}${Q8}${Q9}"
mysql -u root -e "$SQL"
output "Binding MariaDB/MySQL to 0.0.0.0."
if grep -Fqs "bind-address" /etc/mysql/mariadb.conf.d/50-server.cnf ; then
sed -i -- '/bind-address/s/#//g' /etc/mysql/mariadb.conf.d/50-server.cnf
sed -i -- '/bind-address/s/127.0.0.1/0.0.0.0/g' /etc/mysql/mariadb.conf.d/50-server.cnf
output 'Restarting MySQL process...'
service mysql restart
elif grep -Fqs "bind-address" /etc/mysql/my.cnf ; then
sed -i -- '/bind-address/s/#//g' /etc/mysql/my.cnf
sed -i -- '/bind-address/s/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf
output 'Restarting MySQL process...'
service mysql restart
elif grep -Fqs "bind-address" /etc/my.cnf ; then
sed -i -- '/bind-address/s/#//g' /etc/my.cnf
sed -i -- '/bind-address/s/127.0.0.1/0.0.0.0/g' /etc/my.cnf
output 'Restarting MySQL process...'
service mysql restart
elif grep -Fqs "bind-address" /etc/mysql/my.conf.d/mysqld.cnf ; then
sed -i -- '/bind-address/s/#//g' /etc/mysql/my.conf.d/mysqld.cnf
sed -i -- '/bind-address/s/127.0.0.1/0.0.0.0/g' /etc/mysql/my.conf.d/mysqld.cnf
output 'Restarting MySQL process...'
service mysql restart
else
output 'A MySQL configuration file could not be detected! Please contact support.'
fi
output "Downloading Pterodactyl..."
mkdir -p /var/www/pterodactyl
cd /var/www/pterodactyl
curl -Lo panel.tar.gz https://github.com/pterodactyl/panel/releases/download/v1.0.3/panel.tar.gz
tar -xzvf panel.tar.gz
chmod -R 755 storage/* bootstrap/cache/
output "Installing Pterodactyl..."
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
cp .env.example .env
/usr/local/bin/composer install --no-dev --optimize-autoloader
php artisan key:generate --force
php artisan p:environment:setup -n --author=$email --url=https://$FQDN --timezone=America/New_York --cache=redis --session=database --queue=redis --redis-host=127.0.0.1 --redis-pass= --redis-port=6379
php artisan p:environment:database --host=127.0.0.1 --port=3306 --database=panel --username=pterodactyl --password=$password
output "To use PHP's internal mail sending, select [mail]. To use a custom SMTP server, select [smtp]. TLS Encryption is recommended."
php artisan p:environment:mail
php artisan migrate --seed --force
php artisan p:user:make --email=$email --admin=1
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
chown -R www-data:www-data * /var/www/pterodactyl
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
if [ "$webserver" = "1" ]; then
chown -R nginx:nginx * /var/www/pterodactyl
elif [ "$webserver" = "2" ]; then
chown -R apache:apache * /var/www/pterodactyl
fi
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/pterodactyl/storage(/.*)?"
restorecon -R /var/www/pterodactyl
fi
output "Creating panel queue listeners..."
(crontab -l ; echo "* * * * * php /var/www/pterodactyl/artisan schedule:run >> /dev/null 2>&1")| crontab -
service cron restart
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
cat > /etc/systemd/system/pteroq.service <<- 'EOF'
[Unit]
Description=Pterodactyl Queue Worker
After=redis-server.service
[Service]
User=www-data
Group=www-data
Restart=always
ExecStart=/usr/bin/php /var/www/pterodactyl/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3
[Install]
WantedBy=multi-user.target
EOF
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
if [ "$webserver" = "1" ]; then
cat > /etc/systemd/system/pteroq.service <<- 'EOF'
Description=Pterodactyl Queue Worker
After=redis-server.service
[Service]
User=nginx
Group=nginx
Restart=always
ExecStart=/usr/bin/php /var/www/pterodactyl/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3
[Install]
WantedBy=multi-user.target
EOF
elif [ "$webserver" = "2" ]; then
cat > /etc/systemd/system/pteroq.service <<- 'EOF'
[Unit]
Description=Pterodactyl Queue Worker
After=redis-server.service
[Service]
User=apache
Group=apache
Restart=always
ExecStart=/usr/bin/php /var/www/pterodactyl/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3
[Install]
WantedBy=multi-user.target
EOF
fi
setsebool -P httpd_can_network_connect 1
setsebool -P httpd_execmem 1
setsebool -P httpd_unified 1
fi
sudo systemctl daemon-reload
systemctl enable pteroq.service
systemctl start pteroq
}
install_pterodactyl_0.7.19() {
output "Creating the databases and setting root password..."
password=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`
adminpassword=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`
rootpassword=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`
Q0="DROP DATABASE IF EXISTS test;"
Q1="CREATE DATABASE IF NOT EXISTS panel;"
Q2="SET old_passwords=0;"
Q3="GRANT ALL ON panel.* TO 'pterodactyl'@'127.0.0.1' IDENTIFIED BY '$password';"
Q4="GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, INDEX, DROP, EXECUTE, PROCESS, RELOAD, LOCK TABLES, CREATE USER ON *.* TO 'admin'@'$SERVER_IP' IDENTIFIED BY '$adminpassword' WITH GRANT OPTION;"
Q5="SET PASSWORD FOR 'root'@'localhost' = PASSWORD('$rootpassword');"
Q6="DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
Q7="DELETE FROM mysql.user WHERE User='';"
Q8="DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%';"
Q9="FLUSH PRIVILEGES;"
SQL="${Q0}${Q1}${Q2}${Q3}${Q4}${Q5}${Q6}${Q7}${Q8}${Q9}"
mysql -u root -e "$SQL"
output "Binding MariaDB/MySQL to 0.0.0.0."
if grep -Fqs "bind-address" /etc/mysql/mariadb.conf.d/50-server.cnf ; then
sed -i -- '/bind-address/s/#//g' /etc/mysql/mariadb.conf.d/50-server.cnf
sed -i -- '/bind-address/s/127.0.0.1/0.0.0.0/g' /etc/mysql/mariadb.conf.d/50-server.cnf
output 'Restarting MySQL process...'
service mysql restart
elif grep -Fqs "bind-address" /etc/mysql/my.cnf ; then
sed -i -- '/bind-address/s/#//g' /etc/mysql/my.cnf
sed -i -- '/bind-address/s/127.0.0.1/0.0.0.0/g' /etc/mysql/my.cnf
output 'Restarting MySQL process...'
service mysql restart
elif grep -Fqs "bind-address" /etc/my.cnf ; then
sed -i -- '/bind-address/s/#//g' /etc/my.cnf
sed -i -- '/bind-address/s/127.0.0.1/0.0.0.0/g' /etc/my.cnf
output 'Restarting MySQL process...'
service mysql restart
elif grep -Fqs "bind-address" /etc/mysql/my.conf.d/mysqld.cnf ; then
sed -i -- '/bind-address/s/#//g' /etc/mysql/my.conf.d/mysqld.cnf
sed -i -- '/bind-address/s/127.0.0.1/0.0.0.0/g' /etc/mysql/my.conf.d/mysqld.cnf
output 'Restarting MySQL process...'
service mysql restart
else
output 'A MySQL configuration file could not be detected! Please contact support.'
fi
output "Downloading Pterodactyl..."
mkdir -p /var/www/pterodactyl
cd /var/www/pterodactyl
curl -Lo panel.tar.gz https://github.com/pterodactyl/panel/releases/download/v0.7.19/panel.tar.gz
tar --strip-components=1 -xzvf panel.tar.gz
chmod -R 755 storage/* bootstrap/cache/
output "Installing Pterodactyl..."
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
cp .env.example .env
/usr/local/bin/composer install --no-dev --optimize-autoloader
php artisan key:generate --force
php artisan p:environment:setup -n --author=$email --url=https://$FQDN --timezone=America/New_York --cache=redis --session=database --queue=redis --redis-host=127.0.0.1 --redis-pass= --redis-port=6379
php artisan p:environment:database --host=127.0.0.1 --port=3306 --database=panel --username=pterodactyl --password=$password
output "To use PHP's internal mail sending, select [mail]. To use a custom SMTP server, select [smtp]. TLS Encryption is recommended."
php artisan p:environment:mail
php artisan migrate --seed --force
php artisan p:user:make --email=$email --admin=1
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
chown -R www-data:www-data * /var/www/pterodactyl
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
if [ "$webserver" = "1" ]; then
chown -R nginx:nginx * /var/www/pterodactyl
elif [ "$webserver" = "2" ]; then
chown -R apache:apache * /var/www/pterodactyl
fi
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/pterodactyl/storage(/.*)?"
restorecon -R /var/www/pterodactyl
fi
output "Creating panel queue listeners..."
(crontab -l ; echo "* * * * * php /var/www/pterodactyl/artisan schedule:run >> /dev/null 2>&1")| crontab -
service cron restart
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
cat > /etc/systemd/system/pteroq.service <<- 'EOF'
[Unit]
Description=Pterodactyl Queue Worker
After=redis-server.service
[Service]
User=www-data
Group=www-data
Restart=always
ExecStart=/usr/bin/php /var/www/pterodactyl/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3
[Install]
WantedBy=multi-user.target
EOF
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
if [ "$webserver" = "1" ]; then
cat > /etc/systemd/system/pteroq.service <<- 'EOF'
Description=Pterodactyl Queue Worker
After=redis-server.service
[Service]
User=nginx
Group=nginx
Restart=always
ExecStart=/usr/bin/php /var/www/pterodactyl/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3
[Install]
WantedBy=multi-user.target
EOF
elif [ "$webserver" = "2" ]; then
cat > /etc/systemd/system/pteroq.service <<- 'EOF'
[Unit]
Description=Pterodactyl Queue Worker
After=redis-server.service
[Service]
User=apache
Group=apache
Restart=always
ExecStart=/usr/bin/php /var/www/pterodactyl/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3
[Install]
WantedBy=multi-user.target
EOF
fi
setsebool -P httpd_can_network_connect 1
setsebool -P httpd_execmem 1
setsebool -P httpd_unified 1
fi
sudo systemctl daemon-reload
systemctl enable pteroq.service
systemctl start pteroq
}
upgrade_pterodactyl(){
cd /var/www/pterodactyl
php artisan down
curl -L https://github.com/pterodactyl/panel/releases/download/v1.0.3/panel.tar.gz | tar --strip-components=1 -xzv
chmod -R 755 storage/* bootstrap/cache
composer install --no-dev --optimize-autoloader
php artisan view:clear
php artisan config:clear
php artisan migrate --force
php artisan db:seed --force
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
chown -R www-data:www-data * /var/www/pterodactyl
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
chown -R apache:apache * /var/www/pterodactyl
chown -R nginx:nginx * /var/www/pterodactyl
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/pterodactyl/storage(/.*)?"
restorecon -R /var/www/pterodactyl
fi
output "Your panel has successfully been updated to version 1.0.3"
php artisan up
php artisan queue:restart
}
upgrade_pterodactyl_1.0(){
cd /var/www/pterodactyl
php artisan down
curl -L https://github.com/pterodactyl/panel/releases/download/v1.0.3/panel.tar.gz | tar --strip-components=1 -xzv
rm -rf $(find app public resources -depth | head -n -1 | grep -Fv "$(tar -tf panel.tar.gz)")
tar -xzvf panel.tar.gz && rm -f panel.tar.gz
chmod -R 755 storage/* bootstrap/cache
composer install --no-dev --optimize-autoloader
php artisan view:clear
php artisan config:clear
php artisan migrate --force
php artisan db:seed --force
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
chown -R www-data:www-data * /var/www/pterodactyl
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then
chown -R apache:apache * /var/www/pterodactyl
chown -R nginx:nginx * /var/www/pterodactyl