-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinstall.sh
2079 lines (1977 loc) · 92.1 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';
}
PANEL=v1.11.2
WINGS=v1.11.0
PANEL_LEGACY=v0.7.19
DAEMON_LEGACY=v0.6.13
PHPMYADMIN=5.1.1
preflight(){
output "Добро пожаловать в установку Pterodactyl"
output "ExCloud 2023.."
output ""
output "Обратите внимание, что этот сценарий предназначен для установки на новую ОС. Установка на не новую ОС может вызвать проблемы."
output "Автоматическое определение операционной системы ..."
os_check
if [ "$EUID" -ne 0 ]; then
output "Пожалуйста, запустите как пользователь root."
exit 3
fi
output "Автоматическое определение архитектуры ..."
MACHINE_TYPE=`uname -m`
if [ "${MACHINE_TYPE}" == 'x86_64' ]; then
output "Обнаружен 64-битный сервер! Поехали дальше."
output ""
else
output "Обнаружена неподдерживаемая архитектура! Пожалуйста, запускайте скрипт на нашем сервере"
exit 4
fi
output "Автоматическое обнаружение виртуализации ..."
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 "Виртуализация: обнаружено Bare Metal."
elif [ "$virt_serv" = "openvz lxc" ]; then
output "Виртуализация: обнаружено OpenVZ 7."
elif [ "$virt_serv" = "xen xen-hvm" ]; then
output "Виртуализация: обнаружено Xen-HVM."
elif [ "$virt_serv" = "xen xen-hvm aws" ]; then
output "Виртуализация: обнаружено Xen-HVM on AWS."
warn "При создании выделения для этого узла используйте внутренний IP-адрес, поскольку Google Cloud использует маршрутизацию NAT."
warn "Возобновление через 10 секунд ..."
sleep 10
else
output "Виртуализация: $virt_serv ."
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 "Обнаружен неподдерживаемый тип виртуализации. Проконсультируйтесь со своим хостинг-провайдером, может ли ваш сервер запускать Docker или нет. Действуйте на свой страх и риск."
warn "Никакой поддержки не будет, если ваш сервер сломается в любой момент."
warn "Продолжить?\n[1] Да.\n[2] Нет."
read choice
case $choice in
1) output "Продолжение ..."
;;
2) output "Отмена установки ..."
exit 5
;;
esac
output ""
fi
output "Обнаружение ядра ..."
if echo $(uname -r) | grep -q xxxx; then
output "Обнаружено ядро OVH. Этот скрипт работать не будет. Пожалуйста, переустановите свой сервер, используя стандартное / дистрибутивное ядро."
output "Когда вы переустанавливаете свой сервер, нажмите 'custom installation', а после этого нажмите 'use distribution'"
output "Вы также можете сделать пользовательское разбиение на разделы, удалить раздел / home и предоставить / all the remaining space.."
exit 6
elif echo $(uname -r) | grep -q pve; then
output "Обнаружено ядро Proxmox LXE. Вы решили продолжить последний шаг, поэтому мы действуем на ваш страх и риск."
output "Продолжение рискованной операции ..."
elif echo $(uname -r) | grep -q stab; then
if echo $(uname -r) | grep -q 2.6; then
output "Обнаружен OpenVZ 6. Этот сервер определенно не будет работать с Docker, что бы ни сказал ваш провайдер. Отмените установку во избежание дальнейших повреждений."
exit 6
fi
elif echo $(uname -r) | grep -q gcp; then
output "Обнаружена Google Cloud Platform."
warn "Убедитесь, что у вас установлен статический IP-адрес, иначе система не будет работать после перезагрузки."
warn "Также убедитесь, что брандмауэр GCP разрешает порты, необходимые для нормальной работы сервера."
warn "При создании выделения для этого узла используйте внутренний IP-адрес, поскольку Google Cloud использует маршрутизацию NAT."
warn "Возобновление через 10 секунд ..."
sleep 10
else
output "Не обнаружил плохих ядер. Поехали дальше..."
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" ]; then
output "Неподдерживаемая версия Ubuntu. Поддерживаются только Ubuntu 20.04 и 18.04."
exit 2
fi
elif [ "$lsb_dist" = "debian" ]; then
if [ "$dist_version" != "10" ] && [ "$dist_version" != "11" ]; then
output "Неподдерживаемая версия Debian. Поддерживается только Debian 10."
exit 2
fi
elif [ "$lsb_dist" = "fedora" ]; then
if [ "$dist_version" != "33" ] && [ "$dist_version" != "32" ]; then
output "Неподдерживаемая версия Fedora. Поддерживаются только Fedora 33 и 32."
exit 2
fi
elif [ "$lsb_dist" = "centos" ]; then
if [ "$dist_version" != "8" ] && [ "$dist_version" != "7" ]; then
output "Неподдерживаемая версия CentOS. Поддерживаются только CentOS Stream и 8."
exit 2
fi
elif [ "$lsb_dist" = "rhel" ]; then
if [ $dist_version != "8" ]; then
output "Неподдерживаемая версия RHEL. Поддерживается только RHEL 8."
exit 2
fi
elif [ "$lsb_dist" != "ubuntu" ] && [ "$lsb_dist" != "debian" ] && [ "$lsb_dist" != "centos" ]; then
output "Неподдерживаемая операционная система."
output ""
output "Поддерживаемая ОС:"
output "Ubuntu: 20.04, 18.04"
output "Debian: 10"
output "Fedora: 33, 32"
output "CentOS: 8, 7"
output "RHEL: 8"
exit 2
fi
}
install_options(){
output "Выберите вариант установки:"
output "[1] Установить панель ${PANEL}."
output "[2] Установить панель ${PANEL_LEGACY}."
output "[3] Установить wings ${WINGS}."
output "[4] Установить daemon ${DAEMON_LEGACY}."
output "[5] Установить панель ${PANEL} и wings ${WINGS}."
output "[6] Установить панель ${PANEL_LEGACY} и daemon ${DAEMON_LEGACY}."
output "[7] Установить standalone SFTP server."
output "[8] Обновить (1.x) панель до ${PANEL}."
output "[9] Обновить (0.7.x) панель до ${PANEL}."
output "[10] Обновить (0.7.x) панель до ${PANEL_LEGACY}."
output "[11] Обновить (0.6.x) daemon до ${DAEMON_LEGACY}."
output "[12] Миграция daemon в wings."
output "[13] Обновить панель до ${PANEL} и миграция в wings"
output "[14] Обновить панель до ${PANEL_LEGACY} и daemon до ${DAEMON_LEGACY}"
output "[15] Обновить standalone SFTP server до (1.0.5)."
output "[16] Сделать Pterodactyl совместимым с мобильным приложением (используйте это только после того, как вы установили панель - Используйте https://pterodactyl.cloud для получения дополнительной информации)."
output "[17] Обновить мобильную совместимость."
output "[18] Установка или обновление phpMyAdmin (${PHPMYADMIN}) (используйте это только после того, как вы установили панель)."
output "[19] Установить автономный хост базы данных (только для использования в установках с daemon)."
output "[20] Установка тем Pterodactyl (Только для панели ${PANEL_LEGACY} )."
output "[21] Аварийный сброс пароля root MariaDB."
output "[22] Аварийный сброс пароля базы данных."
read -r choice
case $choice in
1 ) installoption=1
output "Вы выбрали установку только панели ${PANEL}."
;;
2 ) installoption=2
output "Вы выбрали установку только панели ${PANEL_LEGACY}."
;;
3 ) installoption=3
output "Вы выбрали установку только wings ${WINGS}."
;;
4 ) installoption=4
output "Вы выбрали установку только daemon ${DAEMON_LEGACY}."
;;
5 ) installoption=5
output "Вы выбрали установку панели ${PANEL} и wings ${WINGS}."
;;
6 ) installoption=6
output "Вы выбрали установку панели ${PANEL_LEGACY} и daemon."
;;
7 ) installoption=7
output "Вы выбрали установку автономного сервера SFTP."
;;
8 ) installoption=8
output "Вы выбрали обновление панели до ${PANEL}."
;;
9 ) installoption=9
output "Вы выбрали обновление панели до ${PANEL}."
;;
10 ) installoption=10
output "Вы выбрали обновление панели до ${PANEL_LEGACY}."
;;
11 ) installoption=11
output "Вы выбрали обновление daemon до ${DAEMON_LEGACY}."
;;
12 ) installoption=12
output "Вы выбрали миграцию daemon ${DAEMON_LEGACY} в wings ${WINGS}."
;;
13 ) installoption=13
output "Вы выбрали обновление панели до ${PANEL} и миграцию в wings ${WINGS}."
;;
14 ) installoption=14
output "Вы выбрали обновление панели до ${PANEL} и daemon до ${DAEMON_LEGACY}."
;;
15 ) installoption=15
output "Вы выбрали обновление автономного SFTP."
;;
16 ) installoption=16
output "Вы активировали совместимость мобильного приложения."
;;
17 ) installoption=17
output "Вы выбрали обновление совместимости мобильного приложения."
;;
18 ) installoption=18
output "Вы выбрали установку или обновление phpMyAdmin ${PHPMYADMIN}."
;;
19 ) installoption=19
output "Вы выбрали установку хоста базы данных."
;;
20 ) installoption=20
output "Вы решили изменить Pterodactyl ${PANEL_LEGACY}."
;;
21 ) installoption=21
output "Вы выбрали сброс пароля root MariaDB."
;;
22 ) installoption=22
output "Вы выбрали сброс пароля базы данных."
;;
* ) output "Вы ввели неверный выбор."
install_options
esac
}
webserver_options() {
output "Выберите, какой веб-сервер вы хотите использовать:\n[1] Nginx (рекомендуется).\n[2] Apache2/httpd (старый, при DDoS-атаке больше нагрузки на сервер)."
read -r choice
case $choice in
1 ) webserver=1
output "Вы выбрали Nginx."
output ""
;;
2 ) webserver=2
output "Вы выбрали Apache2/httpd."
output ""
;;
* ) output "Вы ввели неверный выбор."
webserver_options
esac
}
theme_options() {
output "Хотите установить одну из тем Fonix?"
warn "СЕЙЧАС FONIX НЕ ОБНОВЛЯЕТ СВОЮ ТЕМУ ДО 0.7.19, ЧТОБЫ ИСПРАВИТЬ XSS EXPLOIT В PTERODACTYL <= 0.7.18. НЕ ИСПОЛЬЗУЙТЕ ЭТО. НАСТОЯТЕЛЬНО РЕКОМЕНДУЮ ВЫБРАТЬ [1]."
output "[1] НЕТ."
output "[2] Super Pink и 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 "Вы можете узнать о темах Fonix здесь: https://github.com/TheFonix/Pterodactyl-Themes"
read -r choice
case $choice in
1 ) themeoption=1
output "Вы выбрали для установки стандартную тему Pterodactyl."
output ""
;;
2 ) themeoption=2
output "Вы выбрали для установки Fonix's Super Pink и Fluffy."
output ""
;;
3 ) themeoption=3
output "Вы выбрали для установки Fonix's Tango Twist."
output ""
;;
4 ) themeoption=4
output "Вы выбрали для установки Fonix's Blue Brick."
output ""
;;
5 ) themeoption=5
output "Вы выбрали для установки Fonix's Minecraft Madness."
output ""
;;
6 ) themeoption=6
output "Вы выбрали для установки Fonix's Lime Stitch."
output ""
;;
7 ) themeoption=7
output "Вы выбрали для установки Fonix's Red Ape."
output ""
;;
8 ) themeoption=8
output "Вы выбрали для установки Fonix's BlackEnd Space."
output ""
;;
9 ) themeoption=9
output "Вы выбрали для установки Fonix's Nothing But Graphite."
output ""
;;
* ) output "Вы ввели неверный выбор."
theme_options
esac
}
required_infos() {
output "Пожалуйста, введите желаемый адрес электронной почты пользователя:"
read -r email
dns_check
}
dns_check(){
output "Пожалуйста, введите ваше полное доменное имя (panel.domain.tld):"
read -r FQDN
output "Разрешение DNS..."
SERVER_IP=$(dig +short myip.opendns.com @resolver1.opendns.com)
DOMAIN_RECORD=$(dig +short ${FQDN})
if [ "${SERVER_IP}" != "${DOMAIN_RECORD}" ]; then
output ""
output "Введенный домен не соответствует первичному общедоступному IP-адресу этого сервера."
output "Пожалуйста, сделайте запись A, указывающую на IP-адрес вашего сервера. Например, если вы сделаете запись A под названием 'panel', указывающую на IP-адрес вашего сервера, ваше полное доменное имя будет panel.excloud.su."
output "Если вы используете CloudFlare, отключите оранжевое облако на записи, иначе будет ошибка SSL."
output "Если у вас нет домена, вы можете получить его бесплатно, обратитесь в поддержку ExCloud."
dns_check
else
output "Домен определен правильно. Поехали дальше..."
fi
}
theme() {
output "Инициализация установки темы..."
cd /var/www/pterodactyl || exit
if [ "$themeoption" = "1" ]; then
output "Сохранение стандартной темы Pterodactyl."
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 "Настройка репозиториев ..."
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
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" = "34" ]; then
dnf -y install http://rpms.remirepo.net/fedora/remi-release-34.rpm
elif [ "$dist_version" = "33" ]; then
dnf -y install http://rpms.remirepo.net/fedora/remi-release-33.rpm
fi
dnf -y install dnf-plugins-core python2 libsemanage-devel
dnf config-manager --set-enabled remi
dnf -y module enable php:remi-8.0
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-8.0
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
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-php80
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-8.0
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 "Настройка репозиториев ..."
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
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" = "34" ]; then
dnf -y install http://rpms.remirepo.net/fedora/remi-release-34.rpm
elif [ "$dist_version" = "33" ]; then
dnf -y install http://rpms.remirepo.net/fedora/remi-release-33.rpm
fi
dnf -y install dnf-plugins-core python2 libsemanage-devel
dnf config-manager --set-enabled remi
dnf -y module enable php:remi-8.0
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-8.0
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
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-php80
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-8.0
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 "Установка зависимостей ..."
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
if [ "$webserver" = "1" ]; then
apt -y install php8.0 php8.0-{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 php8.0 php8.0-{cli,gd,mysql,pdo,mbstring,tokenizer,bcmath,xml,fpm,curl,zip} curl tar unzip git redis-server apache2 libapache2-mod-php8.0 redis-server git wget expect
fi
sh -c "DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated mariadb-server"
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-8.0
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 "Включение служб ..."
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
systemctl enable redis-server
service redis-server start
systemctl enable php8.0-fpm
service php8.0-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 "Установка зависимостей ..."
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"
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 "Включение служб ..."
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 "Создание баз данных и установка пароля root ..."
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 "Привязка MariaDB/MySQL к 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 'Перезапуск MySQL процесса ...'
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 'Перезапуск MySQL процесса ...'
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 'Перезапуск MySQL процесса ...'
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 'Перезапуск MySQL процесса ...'
service mysql restart
else
output 'Не удалось обнаружить файл конфигурации MySQL! Обратитесь в службу поддержки.'
fi
output "Загрузка Pterodactyl..."
mkdir -p /var/www/pterodactyl
cd /var/www/pterodactyl || exit
curl -Lo panel.tar.gz https://github.com/pterodactyl/panel/releases/download/${PANEL}/panel.tar.gz
tar -xzvf panel.tar.gz
chmod -R 755 storage/* bootstrap/cache/
output "Установка Pterodactyl..."
if [ "$installoption" = "2" ] || [ "$installoption" = "6" ]; then
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer --version=1.10.16
else
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
fi
cp .env.example .env
/usr/local/bin/composer install --no-dev --optimize-autoloader --no-interaction
php artisan key:generate --force
php artisan p:environment:setup -n --author=$email --url=https://$FQDN --timezone=Europe/Moscow --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 "Чтобы использовать внутреннюю отправку почты PHP, выберите [mail]. Чтобы использовать собственный SMTP-сервер, выберите [smtp]. Рекомендуется шифрование TLS."
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 "Создание слушателей очереди панели ..."
(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 "Создание баз данных и установка пароля root ..."
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 "Привязка MariaDB/MySQL к 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 'Перезапуск MySQL процесса ...'
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 'Перезапуск MySQL процесса ...'
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 'Перезапуск MySQL процесса ...'
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 'Перезапуск MySQL процесса ...'
service mysql restart
else
output 'Не удалось обнаружить файл конфигурации MySQL! Обратитесь в службу поддержки.'
fi
output "Загрузка Pterodactyl..."
mkdir -p /var/www/pterodactyl
cd /var/www/pterodactyl || exit
curl -Lo panel.tar.gz https://github.com/pterodactyl/panel/releases/download/${PANEL_LEGACY}/panel.tar.gz
tar --strip-components=1 -xzvf panel.tar.gz
chmod -R 755 storage/* bootstrap/cache/
output "Установка 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=Europe/Moscow --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 "Чтобы использовать внутреннюю отправку почты PHP, выберите [mail]. Чтобы использовать собственный SMTP-сервер, выберите [smtp]. Рекомендуется шифрование TLS."
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 "Создание слушателей очереди панели ..."
(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 || exit
php artisan down
curl -L https://github.com/pterodactyl/panel/releases/download/${PANEL}/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 "Ваша панель успешно обновлена до версии ${PANEL}"
php artisan up
php artisan queue:restart
}
upgrade_pterodactyl_1.0(){
cd /var/www/pterodactyl || exit
php artisan down
curl -L https://github.com/pterodactyl/panel/releases/download/${PANEL}/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
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/pterodactyl/storage(/.*)?"
restorecon -R /var/www/pterodactyl
fi
output "Ваша панель успешно обновлена до версии ${PANEL}"
php artisan up
php artisan queue:restart
}
upgrade_pterodactyl_0.7.19(){
cd /var/www/pterodactyl || exit
php artisan down
curl -L https://github.com/pterodactyl/panel/releases/download/${PANEL_LEGACY}/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