Advertisement
Guest User

install.sh

a guest
Oct 10th, 2018
209
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 79.59 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. output() {
  4. echo -e '\e[36m'$1'\e[0m';
  5. }
  6.  
  7. copyright(){
  8. output "Pterodactyl Installation script v15.2."
  9. output "Copyright © 2018 Thien Tran <contact@thientran.io>."
  10. output "Please report any issues to https://discord.gg/baJK6ZD"
  11. output ""
  12. }
  13.  
  14. server_options() {
  15. output "Thank you for your purchase. Please note that this script is meant to be installed on a fresh OS. Installing it on a non-fresh OS may cause problems."
  16. output "Please select what you would like to install:\n[1] Install the panel.\n[2] Install the daemon.\n[3] Install the panel and daemon."
  17. read choice
  18. case $choice in
  19. 1 ) installoption=1
  20. output "You have selected panel installation only."
  21. ;;
  22. 2 ) installoption=2
  23. output "You have selected daemon installation only."
  24. ;;
  25. 3 ) installoption=3
  26. output "You have selected panel and daemon installation."
  27. ;;
  28. * ) output "You did not enter a a valid selection."
  29. server_options
  30. esac
  31. }
  32.  
  33. get_distribution() {
  34. output "Automatic Operating System Detection initialized."
  35. if [ -r /etc/os-release ]; then
  36. lsb_dist="$(. /etc/os-release && echo "$ID")"
  37. dist_version="$(. /etc/os-release && echo "$VERSION_ID")"
  38. fi
  39. output "OS: $lsb_dist $dist_version detected."
  40. output ""
  41. }
  42.  
  43. os_options() {
  44. if [ "$lsb_dist" = "ubuntu" ]; then
  45. if [ "$dist_version" = "18.04" ]; then
  46. osoption=1
  47. elif [ "$dist_version" == "16.04" ]; then
  48. osoption=2
  49. elif [ "$dist_version" = "14.04" ]; then
  50. osoption=3
  51. else
  52. output "Unsupported Ubuntu version. Only Ubuntu 18.04, 16.04, and 14.04 are supported."
  53. fi
  54. elif [ "$lsb_dist" = "debian" ]; then
  55. if [ "$dist_version" = "9" ]; then
  56. osoption=4
  57. elif [ "$dist_version" = "8" ]; then
  58. osoption=5
  59. else
  60. output "Unsupported Debian version. Only Debian 9 and 8 are supported.."
  61. fi
  62. elif [ "$lsb_dist" = "fedora" ]; then
  63. if [ "$dist_version" = "28" ]; then
  64. osoption=6
  65. elif [ "$dist_version" = "27" ]; then
  66. osoption=7
  67. else
  68. output "Unsupported Fedora version. Only Fedora 28 and 27 are supported."
  69. fi
  70. elif [ "$lsb_dist" = "centos" ]; then
  71. if [ "$dist_version" = "7" ]; then
  72. osoption=8
  73. else
  74. output "Unsupported CentOS version. Only CentOS 7 is supported."
  75. fi
  76. else
  77. output "Unsupported Operating System."
  78. output "Supported OS:"
  79. output "Ubuntu: 18.04, 16.04 14.04"
  80. output "Debian: 9, 8"
  81. output "Fedora: 28, 27"
  82. output "CentOS 7"
  83. fi
  84. }
  85.  
  86. webserver_options() {
  87. output "Please select which web server you would like to use:\n[1] Nginx (Recommended).\n[2] Apache2/Httpd."
  88. read choice
  89. case $choice in
  90. 1 ) webserver=1
  91. output "You have selected Nginx."
  92. ;;
  93. 2 ) webserver=2
  94. output "You have selected Apache2 / Httpd."
  95. ;;
  96. * ) output "You did not enter a valid selection."
  97. webserver_options
  98. esac
  99. }
  100.  
  101. fonix_options() {
  102. output "Would you like to install Fonix's themes? :\n[1] No.\n[2] Graphite theme.\n[3] Midnight theme."
  103. output "You can find out about Fonix's themes here: https://github.com/TheFonix/Pterodactyl-Themes"
  104. read choice
  105. case $choice in
  106. 1 ) fonixoption=1
  107. output "You have selected to install vanilla Pterodactyl theme."
  108. ;;
  109. 2 ) fonixoption=2
  110. output "You have selected to install Fonix's Graphite theme."
  111. ;;
  112. 3 ) fonixoption=3
  113. output "You have selected panel and Fonix's Midnight theme."
  114. ;;
  115. * ) output "You did not enter a a valid selection"
  116. fonix_options
  117. esac
  118. }
  119.  
  120. fonix_graphite() {
  121. output "Installing Graphite Theme"
  122. cd /var/www/pterodactyl
  123. curl https://raw.githubusercontent.com/TheFonix/Pterodactyl-Themes/master/Pterodactyl-7/Graphite/build.sh | sh
  124. }
  125.  
  126. fonix_midnight(){
  127. output "Installing Midnight Theme"
  128. cd /var/www/pterodactyl
  129. curl https://raw.githubusercontent.com/TheFonix/Pterodactyl-Themes/master/Pterodactyl-7/Midnight/build.sh | sh
  130. }
  131.  
  132. required_infos() {
  133. output "Please enter your FQDN (panel.yourdomain.com):"
  134. read FQDN
  135.  
  136. output "Please enter the desired user email address:"
  137. read email
  138. }
  139.  
  140. daemon_option(){
  141. output "Please select your preferred Daemon installation mode:\n[1] Systemd (Recommended).\n[2] Forever."
  142. read choice
  143. case $choice in
  144. 1 ) daemonoption=1
  145. output "You have selected to install the Daemon using Systemd."
  146. ;;
  147. 2 ) daemonoption=2
  148. output "You have selected to install the Daemon using Forever."
  149. ;;
  150. * ) output "You did not enter a a valid selection"
  151. daemon_option
  152. esac
  153. }
  154.  
  155. server_u18() {
  156. output "Forcing IPv4 on apt."
  157. echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4
  158. output "Adding repositories and PPAs."
  159. apt-get -y update
  160. apt-get -y install software-properties-common
  161. add-apt-repository -y universe
  162. LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
  163. add-apt-repository -y ppa:chris-lea/redis-server
  164. add-apt-repository -y ppa:nginx/stable
  165. apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
  166. add-apt-repository -y 'deb [arch=amd64,arm64,ppc64el] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu bionic main'
  167. add-apt-repository -y ppa:certbot/certbot
  168. output "Updating all server packages."
  169. apt-get -y update
  170. apt-get -y upgrade
  171. apt-get -y autoremove
  172. apt-get -y autoclean
  173. }
  174.  
  175. server_u16() {
  176. output "Forcing IPv4 on apt."
  177. echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4
  178. output "Adding repositories and PPAs."
  179. apt-get -y update
  180. apt-get -y install software-properties-common
  181. add-apt-repository -y universe
  182. LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
  183. add-apt-repository -y ppa:chris-lea/redis-server
  184. add-apt-repository -y ppa:nginx/stable
  185. apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xF1656F24C74CD1D8
  186. add-apt-repository 'deb [arch=amd64,arm64,i386,ppc64el] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu xenial main'
  187. add-apt-repository -y ppa:certbot/certbot
  188. output "Updating all server packages."
  189. apt-get -y update
  190. apt-get -y upgrade
  191. apt-get -y autoremove
  192. apt-get -y autoclean
  193. }
  194.  
  195. server_u14() {
  196. output "Forcing IPv4 on apt."
  197. echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4
  198. output "Adding repositories and PPAs."
  199. apt-get -y update
  200. apt-get -y install software-properties-common
  201. add-apt-repository -y universe
  202. LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
  203. add-apt-repository -y ppa:ondrej/nginx
  204. add-apt-repository -y ppa:chris-lea/redis-server
  205. sudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 0xcbcb082a1bb943db
  206. sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://sfo1.mirrors.digitalocean.com/mariadb/repo/10.3/ubuntu trusty main'
  207. add-apt-repository -y ppa:certbot/certbot
  208. output "Updating all server packages."
  209. apt-get -y update
  210. apt-get -y upgrade
  211. apt-get -y autoremove
  212. apt-get -y autoclean
  213. }
  214.  
  215. server_d9(){
  216. output "Forcing IPv4 on apt."
  217. echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4
  218. output "Adding repositories."
  219. apt-get -y update
  220. apt-get -y install ca-certificates apt-transport-https
  221. apt-get -y install software-properties-common dirmngr
  222. wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
  223. sudo echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list
  224. sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xF1656F24C74CD1D8
  225. sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.3/debian stretch main'
  226. apt-get -y update
  227. apt-get -y upgrade
  228. apt-get -y autoremove
  229. apt-get -y autoclean
  230. }
  231.  
  232. server_d8(){
  233. output "Forcing IPv4 on apt."
  234. echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4
  235. output "Adding repositories."
  236. apt-get -y update
  237. apt-get -y install ca-certificates apt-transport-https
  238. apt-get -y install software-properties-common
  239. wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -
  240. sudo echo "deb https://packages.sury.org/php/ jessie main" | sudo tee /etc/apt/sources.list.d/php.list
  241. sudo apt-key adv --recv-keys --keyserver keyserver.ubuntu.com 0xcbcb082a1bb943db
  242. sudo add-apt-repository 'deb [arch=amd64,i386,ppc64el] http://nyc2.mirrors.digitalocean.com/mariadb/repo/10.3/debian jessie main'
  243. apt-get -y update
  244. apt-get -y upgrade
  245. apt-get -y autoremove
  246. apt-get -y autoclean
  247. }
  248.  
  249. server_f28(){
  250. output "Adding repositories."
  251. echo '
  252. # MariaDB 10.3 Fedora repository list - created 2018-10-05 23:47 UTC
  253. # http://downloads.mariadb.org/mariadb/repositories/
  254. [mariadb]
  255. name = MariaDB
  256. baseurl = http://yum.mariadb.org/10.3/fedora28-amd64
  257. gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
  258. gpgcheck=1
  259. ' | sudo -E tee /etc/yum.repos.d/mariadb.repo >/dev/null 2>&1
  260.  
  261. echo '
  262. [heffer-nginx-mainline]
  263. name=Copr repo for nginx-mainline owned by heffer
  264. baseurl=https://copr-be.cloud.fedoraproject.org/results/heffer/nginx-mainline/fedora-$releasever-$basearch/
  265. type=rpm-md
  266. skip_if_unavailable=True
  267. gpgcheck=1
  268. gpgkey=https://copr-be.cloud.fedoraproject.org/results/heffer/nginx-mainline/pubkey.gpg
  269. repo_gpgcheck=0
  270. enabled=1
  271. enabled_metadata=1
  272. ' | sudo -E tee /etc/yum.repos.d/nginx.repo >/dev/null 2>&1
  273.  
  274. dnf -y upgrade
  275. dnf -y autoremove
  276. dnf -y clean packages
  277. }
  278.  
  279. server_f27(){
  280. output "Adding repositories."
  281. echo '
  282. # MariaDB 10.3 Fedora repository list - created 2018-10-08 09:49 UTC
  283. # http://downloads.mariadb.org/mariadb/repositories/
  284. [mariadb]
  285. name = MariaDB
  286. baseurl = http://yum.mariadb.org/10.3/fedora27-amd64
  287. gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
  288. gpgcheck=1
  289. ' | sudo -E tee /etc/yum.repos.d/mariadb.repo >/dev/null 2>&1
  290.  
  291. echo '
  292. [heffer-nginx-mainline]
  293. name=Copr repo for nginx-mainline owned by heffer
  294. baseurl=https://copr-be.cloud.fedoraproject.org/results/heffer/nginx-mainline/fedora-$releasever-$basearch/
  295. type=rpm-md
  296. skip_if_unavailable=True
  297. gpgcheck=1
  298. gpgkey=https://copr-be.cloud.fedoraproject.org/results/heffer/nginx-mainline/pubkey.gpg
  299. repo_gpgcheck=0
  300. enabled=1
  301. enabled_metadata=1
  302. ' | sudo -E tee /etc/yum.repos.d/nginx.repo >/dev/null 2>&1
  303.  
  304. dnf -y install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
  305. dnf -y install https://rpms.remirepo.net/fedora/remi-release-27.rpm
  306.  
  307. dnf -y upgrade
  308. dnf -y autoremove
  309. dnf -y clean packages
  310. }
  311.  
  312. server_c7(){
  313. echo '
  314. # MariaDB 10.3 CentOS repository list - created 2018-10-08 09:23 UTC
  315. # http://downloads.mariadb.org/mariadb/repositories/
  316. [mariadb]
  317. name = MariaDB
  318. baseurl = http://yum.mariadb.org/10.3/centos7-amd64
  319. gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
  320. gpgcheck=1
  321. ' | sudo -E tee /etc/yum.repos.d/mariadb.repo >/dev/null 2>&1
  322.  
  323. echo '
  324. [heffer-nginx-mainline]
  325. name=Copr repo for nginx-mainline owned by heffer
  326. baseurl=https://copr-be.cloud.fedoraproject.org/results/heffer/nginx-mainline/epel-7-$basearch/
  327. type=rpm-md
  328. skip_if_unavailable=True
  329. gpgcheck=1
  330. gpgkey=https://copr-be.cloud.fedoraproject.org/results/heffer/nginx-mainline/pubkey.gpg
  331. repo_gpgcheck=0
  332. enabled=1
  333. enabled_metadata=1
  334. ' | sudo -E tee /etc/yum.repos.d/nginx.repo >/dev/null 2>&1
  335.  
  336. yum -y install epel-release
  337. yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
  338. yum -y install yum-utils
  339. yum-config-manager --enable remi-php72
  340.  
  341. yum -y upgrade
  342. yum -y autoremove
  343. yum -y clean packages
  344. }
  345.  
  346. erver_f27(){
  347. output "Adding repositories."
  348. echo '
  349. # MariaDB 10.3 Fedora repository list - created 2018-10-08 09:49 UTC
  350. # http://downloads.mariadb.org/mariadb/repositories/
  351. [mariadb]
  352. name = MariaDB
  353. baseurl = http://yum.mariadb.org/10.3/fedora27-amd64
  354. gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
  355. gpgcheck=1
  356. ' | sudo -E tee /etc/yum.repos.d/mariadb.repo >/dev/null 2>&1
  357.  
  358. echo '
  359. [heffer-nginx-mainline]
  360. name=Copr repo for nginx-mainline owned by heffer
  361. baseurl=https://copr-be.cloud.fedoraproject.org/results/heffer/nginx-mainline/fedora-$releasever-$basearch/
  362. type=rpm-md
  363. skip_if_unavailable=True
  364. gpgcheck=1
  365. gpgkey=https://copr-be.cloud.fedoraproject.org/results/heffer/nginx-mainline/pubkey.gpg
  366. repo_gpgcheck=0
  367. enabled=1
  368. enabled_metadata=1
  369. ' | sudo -E tee /etc/yum.repos.d/nginx.repo >/dev/null 2>&1
  370.  
  371. dnf -y install https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
  372. dnf -y install https://rpms.remirepo.net/fedora/remi-release-27.rpm
  373.  
  374. dnf -y upgrade
  375. dnf -y autoremove
  376. dnf -y clean packages
  377. }
  378.  
  379. server_c7(){
  380. echo '
  381. # MariaDB 10.3 CentOS repository list - created 2018-10-08 09:23 UTC
  382. # http://downloads.mariadb.org/mariadb/repositories/
  383. [mariadb]
  384. name = MariaDB
  385. baseurl = http://yum.mariadb.org/10.3/centos7-amd64
  386. gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
  387. gpgcheck=1
  388. ' | sudo -E tee /etc/yum.repos.d/mariadb.repo >/dev/null 2>&1
  389.  
  390. echo '
  391. [heffer-nginx-mainline]
  392. name=Copr repo for nginx-mainline owned by heffer
  393. baseurl=https://copr-be.cloud.fedoraproject.org/results/heffer/nginx-mainline/epel-7-$basearch/
  394. type=rpm-md
  395. skip_if_unavailable=True
  396. gpgcheck=1
  397. gpgkey=https://copr-be.cloud.fedoraproject.org/results/heffer/nginx-mainline/pubkey.gpg
  398. repo_gpgcheck=0
  399. enabled=1
  400. enabled_metadata=1
  401. ' | sudo -E tee /etc/yum.repos.d/nginx.repo >/dev/null 2>&1
  402.  
  403. yum -y install epel-release
  404. yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
  405. yum -y install yum-utils
  406. yum-config-manager --enable remi-php72
  407.  
  408. yum -y upgrade
  409. yum -y autoremove
  410. yum -y clean packages
  411. }
  412.  
  413. install_nginx_dependencies() {
  414. output "Installing Nginx, PHP, and Dependencies."
  415. apt-get -y install php7.2 php7.2-cli php7.2-gd php7.2-mysql php7.2-pdo php7.2-mbstring php7.2-tokenizer php7.2-bcmath php7.2-xml php7.2-fpm php7.2-curl php7.2-zip curl tar unzip git redis-server nginx git
  416. }
  417.  
  418. install_apache_dependencies() {
  419. output "Installing Apache, PHP and Dependencies."
  420. apt-get -y install php7.2 php7.2-cli php7.2-gd php7.2-mysql php7.2-pdo php7.2-mbstring php7.2-tokenizer php7.2-bcmath php7.2-xml php7.2-fpm php7.2-curl php7.2-zip curl tar unzip git redis-server apache2 libapache2-mod-php7.2 redis-server git
  421. }
  422.  
  423. install_nginx_dependencies_f28(){
  424. output "Installing Nginx, PHP, and Dependencies."
  425. dnf -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 cronie nginx git policycoreutils-python-utils libsemanage-devel unzip
  426. }
  427.  
  428. install_apache_dependencies_f28(){
  429. output "Installing Apache, PHP and Dependencies."
  430. dnf -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 cronie httpd git policycoreutils-python-utils libsemanage-devel mod_ssl unzip
  431. }
  432.  
  433. install_nginx_dependencies_f27(){
  434. output "Installing Nginx, PHP, and Dependencies."
  435. dnf -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 cronie nginx git policycoreutils-python-utils libsemanage-devel unzip
  436. }
  437.  
  438. install_apache_dependencies_f27(){
  439. output "Installing Apache, PHP and Dependecies."
  440. dnf -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 cronie httpd git policycoreutils-python-utils libsemanage-devel mod_ssl unzip
  441. }
  442.  
  443. install_nginx_dependencies_c7(){
  444. output "Installing Nginx, PHP, and Dependencies."
  445. 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 cronie nginx git libsemanage-devel unzip
  446. }
  447.  
  448. install_apache_dependencies_c7(){
  449. output "Installing Apache, PHP and Dependencies."
  450. 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 cronie httpd git libsemanage-devel mod_ssl unzip
  451. }
  452.  
  453. install_mariadb() {
  454. output "Installing MariaDB Server."
  455. sh -c "DEBIAN_FRONTEND=noninteractive apt-get install -y mariadb-server"
  456. }
  457.  
  458. activate_services(){
  459. systemctl enable php-fpm
  460. systemctl enable nginx
  461. systemctl enable httpd
  462. systemctl enable redis
  463. systemctl enable mariadb
  464. systemctl enable cron
  465. systemctl start php-fpm
  466. systemctl start nginx
  467. systemctl start httpd
  468. systemctl start redis
  469. systemctl start mariadb
  470. systemctl start cron
  471. }
  472.  
  473. pterodactyl_queue(){
  474. cat > /etc/systemd/system/pteroq.service <<- 'EOF'
  475. [Unit]
  476. Description=Pterodactyl Queue Worker
  477. After=redis-server.service
  478.  
  479. [Service]
  480. User=www-data
  481. Group=www-data
  482. Restart=always
  483. ExecStart=/usr/bin/php /var/www/pterodactyl/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3
  484.  
  485. [Install]
  486. WantedBy=multi-user.target
  487. EOF
  488.  
  489. sudo systemctl daemon-reload
  490. systemctl enable pteroq.service
  491. systemctl start pteroq
  492. }
  493.  
  494. pterodactyl_queue_nginx(){
  495. cat > /etc/systemd/system/pteroq.service <<- 'EOF'
  496. [Unit]
  497. Description=Pterodactyl Queue Worker
  498. After=redis-server.service
  499.  
  500. [Service]
  501. User=nginx
  502. Group=nginx
  503. Restart=always
  504. ExecStart=/usr/bin/php /var/www/pterodactyl/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3
  505.  
  506. [Install]
  507. WantedBy=multi-user.target
  508. EOF
  509.  
  510. sudo systemctl daemon-reload
  511. systemctl enable pteroq.service
  512. systemctl start pteroq
  513. }
  514.  
  515. pterodactyl_queue_apache(){
  516. cat > /etc/systemd/system/pteroq.service <<- 'EOF'
  517. [Unit]
  518. Description=Pterodactyl Queue Worker
  519. After=redis-server.service
  520.  
  521. [Service]
  522. User=apache
  523. Group=apache
  524. Restart=always
  525. ExecStart=/usr/bin/php /var/www/pterodactyl/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3
  526.  
  527. [Install]
  528. WantedBy=multi-user.target
  529. EOF
  530.  
  531. sudo systemctl daemon-reload
  532. systemctl enable pteroq.service
  533. systemctl start pteroq
  534. }
  535.  
  536. pterodactyl_supervisor(){
  537. apt -y install supervisor
  538. service supervisor start
  539. sudo bash -c 'cat > /etc/supervisor/conf.d/pterodactyl-worker.conf' <<-'EOF'
  540. [program:pterodactyl-worker]
  541. process_name=%(program_name)s_%(process_num)02d
  542. command=/usr/bin/php /var/www/pterodactyl/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3
  543. autostart=true
  544. autorestart=true
  545. user=www-data
  546. numprocs=2
  547. redirect_stderr=true
  548. stdout_logfile=/var/www/pterodactyl/storage/logs/queue-worker.log
  549. EOF
  550. output "Updating Supervisor"
  551. sudo supervisorctl reread
  552. sudo supervisorctl update
  553. sudo supervisorctl start pterodactyl-worker:*
  554. sed -i -e '$i \service supervisor start\n' /etc/rc.local
  555. }
  556.  
  557. install_pterodactyl() {
  558. output "Creating the databases and setting root password"
  559. password=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`
  560. rootpassword=`cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1`
  561. Q1="CREATE DATABASE IF NOT EXISTS panel;"
  562. Q2="GRANT ALL ON panel.* TO 'pterodactyl'@'127.0.0.1' IDENTIFIED BY '$password';"
  563. Q3="SET PASSWORD FOR 'root'@'localhost' = PASSWORD('$rootpassword');"
  564. Q4="SET PASSWORD FOR 'root'@'127.0.0.1' = PASSWORD('$rootpassword');"
  565. Q5="SET PASSWORD FOR 'root'@'::1' = PASSWORD('$rootpassword');"
  566. Q6="DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1');"
  567. Q7="DELETE FROM mysql.user WHERE User='';"
  568. Q8="DELETE FROM mysql.db WHERE Db='test' OR Db='test\_%';"
  569. Q9="FLUSH PRIVILEGES;"
  570. SQL="${Q1}${Q2}${Q3}${Q4}${Q5}${Q6}${Q7}${Q8}${Q9}"
  571. mysql -u root -e "$SQL"
  572.  
  573. output "Downloading Pterodactyl."
  574. mkdir -p /var/www/pterodactyl
  575. cd /var/www/pterodactyl
  576. curl -Lo panel.tar.gz https://github.com/pterodactyl/panel/releases/download/v0.7.10/panel.tar.gz
  577. tar --strip-components=1 -xzvf panel.tar.gz
  578. chmod -R 755 storage/* bootstrap/cache/
  579.  
  580. output "Installing Pterodactyl."
  581. curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
  582. cp .env.example .env
  583. composer install --no-dev --optimize-autoloader
  584. php artisan key:generate --force
  585. php artisan p:environment:setup --author=$email --url=https://$FQDN --timezone=America/New_York --cache=redis --session=redis --queue=redis --disable-settings-ui --redis-host=127.0.0.1 --redis-pass= --redis-port=6379
  586. php artisan p:environment:database --host=127.0.0.1 --port=3306 --database=panel --username=pterodactyl --password=$password
  587. output "To use PHP's internal mail sending, select [mail]. To use a custom SMTP server, select [smtp]. TLS Encryption is recommended."
  588. php artisan p:environment:mail
  589. php artisan migrate --seed --force
  590. php artisan p:user:make --email=$email --admin=1
  591. chown -R www-data:www-data *
  592. chown -R nginx:nginx *
  593. chown -R apache:apache *
  594. chown -R apache:apache .*
  595.  
  596. output "Creating panel queue listeners"
  597. (crontab -l ; echo "* * * * * php /var/www/pterodactyl/artisan schedule:run >> /dev/null 2>&1")| crontab -
  598. service cron restart
  599. }
  600.  
  601. nginx_config() {
  602. output "Disabling default configuration"
  603. rm -rf /etc/nginx/sites-enabled/default
  604. output "Configuring Nginx Webserver"
  605.  
  606. echo '
  607. server_tokens off;
  608.  
  609. server {
  610. listen 80;
  611. server_name '"$FQDN"';
  612. return 301 https://$server_name$request_uri;
  613. }
  614.  
  615. server {
  616. listen 443 ssl http2;
  617. server_name '"$FQDN"';
  618.  
  619. root /var/www/pterodactyl/public;
  620. index index.php;
  621.  
  622. access_log /var/log/nginx/pterodactyl.app-access.log;
  623. error_log /var/log/nginx/pterodactyl.app-error.log error;
  624.  
  625. # allow larger file uploads and longer script runtimes
  626. client_max_body_size 100m;
  627. client_body_timeout 120s;
  628.  
  629. sendfile off;
  630.  
  631. # SSL Configuration
  632. ssl_certificate /etc/letsencrypt/live/'"$FQDN"'/fullchain.pem;
  633. ssl_certificate_key /etc/letsencrypt/live/'"$FQDN"'/privkey.pem;
  634. ssl_session_cache shared:SSL:10m;
  635. ssl_protocols TLSv1.2;
  636. ssl_ciphers 'ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256';
  637. ssl_prefer_server_ciphers on;
  638.  
  639. # See https://hstspreload.org/ before uncommenting the line below.
  640. # add_header Strict-Transport-Security "max-age=15768000; preload;";
  641. add_header X-Content-Type-Options nosniff;
  642. add_header X-XSS-Protection "1; mode=block";
  643. add_header X-Robots-Tag none;
  644. add_header Content-Security-Policy "frame-ancestors 'self'";
  645. add_header X-Frame-Options DENY;
  646. add_header Referrer-Policy same-origin;
  647.  
  648. location / {
  649. try_files $uri $uri/ /index.php?$query_string;
  650. }
  651.  
  652. location ~ \.php$ {
  653. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  654. fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
  655. fastcgi_index index.php;
  656. include fastcgi_params;
  657. fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M";
  658. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  659. fastcgi_param HTTP_PROXY "";
  660. fastcgi_intercept_errors off;
  661. fastcgi_buffer_size 16k;
  662. fastcgi_buffers 4 16k;
  663. fastcgi_connect_timeout 300;
  664. fastcgi_send_timeout 300;
  665. fastcgi_read_timeout 300;
  666. include /etc/nginx/fastcgi_params;
  667. }
  668.  
  669. location ~ /\.ht {
  670. deny all;
  671. }
  672. }
  673. ' | sudo -E tee /etc/nginx/sites-available/pterodactyl.conf >/dev/null 2>&1
  674.  
  675. ln -s /etc/nginx/sites-available/pterodactyl.conf /etc/nginx/sites-enabled/pterodactyl.conf
  676. service nginx restart
  677. }
  678.  
  679. apache_config() {
  680. output "Disabling default configuration"
  681. rm -rf /etc/nginx/sites-enabled/default
  682. output "Configuring Apache2"
  683. echo '
  684. <VirtualHost *:80>
  685. ServerName '"$FQDN"'
  686. RewriteEngine On
  687. RewriteCond %{HTTPS} !=on
  688. RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
  689. </VirtualHost>
  690.  
  691. <VirtualHost *:443>
  692. DocumentRoot "/var/www/pterodactyl/public"
  693. AllowEncodedSlashes On
  694. php_value upload_max_filesize 100M
  695. php_value post_max_size 100M
  696. <Directory "/var/www/pterodactyl/public">
  697. AllowOverride all
  698. </Directory>
  699.  
  700. SSLEngine on
  701. SSLCertificateFile /etc/letsencrypt/live/'"$FQDN"'/fullchain.pem
  702. SSLCertificateKeyFile /etc/letsencrypt/live/'"$FQDN"'/privkey.pem
  703. ServerName '"$FQDN"'
  704. </VirtualHost>
  705.  
  706. ' | sudo -E tee /etc/apache2/sites-available/pterodactyl.conf >/dev/null 2>&1
  707.  
  708. ln -s /etc/apache2/sites-available/pterodactyl.conf /etc/apache2/sites-enabled/pterodactyl.conf
  709. a2enmod ssl
  710. a2enmod rewrite
  711. service apache2 restart
  712. }
  713.  
  714. nginx_config_f28(){
  715. output "Configuring Nginx Webserver"
  716.  
  717. echo '
  718. server {
  719. listen 80;
  720. server_name '"$FQDN"';
  721. return 301 https://$server_name$request_uri;
  722. }
  723.  
  724. server {
  725. listen 443 ssl http2;
  726. server_name '"$FQDN"';
  727.  
  728. root /var/www/pterodactyl/public;
  729. index index.php;
  730.  
  731. access_log /var/log/nginx/pterodactyl.app-access.log;
  732. error_log /var/log/nginx/pterodactyl.app-error.log error;
  733.  
  734. # allow larger file uploads and longer script runtimes
  735. client_max_body_size 100m;
  736. client_body_timeout 120s;
  737.  
  738. sendfile off;
  739.  
  740. # strengthen ssl security
  741. ssl_certificate /etc/letsencrypt/live/'"$FQDN"'/fullchain.pem;
  742. ssl_certificate_key /etc/letsencrypt/live/'"$FQDN"'/privkey.pem;
  743. ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
  744. ssl_prefer_server_ciphers on;
  745. ssl_session_cache shared:SSL:10m;
  746. ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:ECDHE-RSA-AES128-GCM-SHA256:AES256+EECDH:DHE-RSA-AES128-GCM-SHA256:AES256+EDH:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-RSA-AES128-SHA256:ECDHE-RSA-AES256-SHA:ECDHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-RSA-AES128-SHA256:DHE-RSA-AES256-SHA:DHE-RSA-AES128-SHA:ECDHE-RSA-DES-CBC3-SHA:EDH-RSA-DES-CBC3-SHA:AES256-GCM-SHA384:AES128-GCM-SHA256:AES256-SHA256:AES128-SHA256:AES256-SHA:AES128-SHA:DES-CBC3-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!MD5:!PSK:!RC4";
  747.  
  748. # See the link below for more SSL information:
  749. # https://raymii.org/s/tutorials/Strong_SSL_Security_On_nginx.html
  750. #
  751. # ssl_dhparam /etc/ssl/certs/dhparam.pem;
  752.  
  753. # Add headers to serve security related headers
  754. add_header Strict-Transport-Security "max-age=15768000; preload;";
  755. add_header X-Content-Type-Options nosniff;
  756. add_header X-XSS-Protection "1; mode=block";
  757. add_header X-Robots-Tag none;
  758. add_header Content-Security-Policy "frame-ancestors 'self'";
  759.  
  760. location / {
  761. try_files $uri $uri/ /index.php?$query_string;
  762. }
  763.  
  764. location ~ \.php$ {
  765. fastcgi_split_path_info ^(.+\.php)(/.+)$;
  766. fastcgi_pass unix:/var/run/php-fpm/pterodactyl.sock;
  767. fastcgi_index index.php;
  768. include fastcgi_params;
  769. fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M";
  770. fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
  771. fastcgi_param HTTP_PROXY "";
  772. fastcgi_intercept_errors off;
  773. fastcgi_buffer_size 16k;
  774. fastcgi_buffers 4 16k;
  775. fastcgi_connect_timeout 300;
  776. fastcgi_send_timeout 300;
  777. fastcgi_read_timeout 300;
  778. include /etc/nginx/fastcgi_params;
  779. }
  780.  
  781. location ~ /\.ht {
  782. deny all;
  783. }
  784. }
  785. ' | sudo -E tee /etc/nginx/conf.d/pterodactyl.conf >/dev/null 2>&1
  786.  
  787. service nginx restart
  788. chown -R nginx:nginx $(pwd)
  789. semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/pterodactyl/storage(/.*)?"
  790. restorecon -R /var/www/pterodactyl
  791. }
  792.  
  793. apache_config_f28() {
  794. output "Configuring Apache2"
  795. echo '
  796. <VirtualHost *:80>
  797. ServerName '"$FQDN"'
  798. RewriteEngine On
  799. RewriteCond %{HTTPS} !=on
  800. RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
  801. </VirtualHost>
  802.  
  803. <VirtualHost *:443>
  804. DocumentRoot "/var/www/pterodactyl/public"
  805. AllowEncodedSlashes On
  806. <Directory "/var/www/pterodactyl/public">
  807. AllowOverride all
  808. </Directory>
  809.  
  810. SSLEngine on
  811. SSLCertificateFile /etc/letsencrypt/live/'"$FQDN"'/fullchain.pem
  812. SSLCertificateKeyFile /etc/letsencrypt/live/'"$FQDN"'/privkey.pem
  813. ServerName '"$FQDN"'
  814. </VirtualHost>
  815.  
  816. ' | sudo -E tee /etc/httpd/conf.d/pterodactyl.conf >/dev/null 2>&1
  817. service httpd restart
  818. }
  819.  
  820. php_config(){
  821. output "Configuring PHP socket."
  822. echo '
  823. [pterodactyl]
  824.  
  825. user = nginx
  826. group = nginx
  827.  
  828. listen = /var/run/php-fpm/pterodactyl.sock
  829. listen.owner = nginx
  830. listen.group = nginx
  831. listen.mode = 0750
  832.  
  833. pm = ondemand
  834. pm.max_children = 9
  835. pm.process_idle_timeout = 10s
  836. pm.max_requests = 200
  837. ' | sudo -E tee /etc/php-fpm.d/www-pterodactyl.conf >/dev/null 2>&1
  838.  
  839. systemctl restart php-fpm
  840.  
  841. }
  842.  
  843. install_daemon() {
  844. cd /root
  845. output "Installing Pterodactyl Daemon dependencies."
  846. apt-get -y install curl tar unzip
  847. output "Installing Docker"
  848. curl -sSL https://get.docker.com/ | CHANNEL=stable bash
  849. systemctl enable docker
  850. systemctl start docker
  851. output "Enabling Swap support for Docker."
  852. sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="[^"]*/& swapaccount=1/' /etc/default/grub
  853. sudo update-grub
  854. output "Installing Nodejs."
  855. curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
  856. apt -y install nodejs make gcc g++ node-gyp
  857.  
  858. output "Updating server packages."
  859. apt-get -y update
  860. apt-get -y upgrade
  861. apt-get -y autoremove
  862. apt-get -y autoclean
  863.  
  864. output "Installing the Pterodactyl Daemon."
  865. mkdir -p /srv/daemon /srv/daemon-data
  866. cd /srv/daemon
  867. curl -L https://github.com/pterodactyl/daemon/releases/download/v0.6.7/daemon.tar.gz | tar --strip-components=1 -xzv
  868. npm install --only=production
  869.  
  870. bash -c 'cat > /etc/systemd/system/wings.service' <<-'EOF'
  871. [Unit]
  872. Description=Pterodactyl Wings Daemon
  873. After=docker.service
  874.  
  875. [Service]
  876. User=root
  877. #Group=some_group
  878. WorkingDirectory=/srv/daemon
  879. LimitNOFILE=4096
  880. PIDFile=/var/run/wings/daemon.pid
  881. ExecStart=/usr/bin/node /srv/daemon/src/index.js
  882. Restart=on-failure
  883. StartLimitInterval=600
  884.  
  885. [Install]
  886. WantedBy=multi-user.target
  887. EOF
  888.  
  889. systemctl daemon-reload
  890. systemctl enable wings
  891. }
  892.  
  893. install_daemon_forever() {
  894. cd /root
  895. output "Installing Pterodactyl Daemon dependencies."
  896. apt-get -y install curl tar unzip
  897. output "Installing Docker"
  898. curl -sSL https://get.docker.com/ | CHANNEL=stable bash
  899. systemctl enable docker
  900. systemctl start docker
  901. output "Enabling Swap support for Docker."
  902. sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="[^"]*/& swapaccount=1/' /etc/default/grub
  903. sudo update-grub
  904. output "Installing Nodejs."
  905. curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -
  906. apt -y install nodejs make gcc g++ node-gyp
  907.  
  908. output "Updating server packages."
  909. apt-get -y update
  910. apt-get -y upgrade
  911. apt-get -y autoremove
  912. apt-get -y autoclean
  913.  
  914. output "Installing the Pterodactyl Daemon."
  915. mkdir -p /srv/daemon /srv/daemon-data
  916. cd /srv/daemon
  917. curl -L https://github.com/pterodactyl/daemon/releases/download/v0.6.7/daemon.tar.gz | tar --strip-components=1 -xzv
  918. npm install --only=production
  919. npm install -g forever
  920. }
  921.  
  922. install_daemon_f28() {
  923. cd /root
  924. output "Installing Pterodactyl Daemon dependencies."
  925. dnf -y install curl tar unzip
  926. output "Installing Docker"
  927. curl -sSL https://get.docker.com/ | CHANNEL=stable bash
  928. systemctl enable docker
  929. systemctl start docker
  930. output "Enabling Swap support for Docker."
  931. sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="[^"]*/& swapaccount=1/' /etc/default/grub
  932. grub2-mkconfig -o /boot/grub2/grub.cfg
  933. output "Installing Nodejs."
  934. curl --silent --location https://rpm.nodesource.com/setup_10.x | sudo bash -
  935. dnf -y install nodejs make gcc-c++
  936.  
  937. output "Updating server packages."
  938. dnf -y upgrade
  939. dnf -y autoremove
  940. dnf -y clean packages
  941.  
  942. output "Installing the Pterodactyl Daemon."
  943. mkdir -p /srv/daemon /srv/daemon-data
  944. cd /srv/daemon
  945. wget https://thientran.io/daemon-0.6.7.zip
  946. unzip daemon-0.6.7
  947. npm install --only=production
  948.  
  949. bash -c 'cat > /etc/systemd/system/wings.service' <<-'EOF'
  950. [Unit]
  951. Description=Pterodactyl Wings Daemon
  952. After=docker.service
  953.  
  954. [Service]
  955. User=root
  956. #Group=some_group
  957. WorkingDirectory=/srv/daemon
  958. LimitNOFILE=4096
  959. PIDFile=/var/run/wings/daemon.pid
  960. ExecStart=/usr/bin/node /srv/daemon/src/index.js
  961. Restart=on-failure
  962. StartLimitInterval=600
  963.  
  964. [Install]
  965. WantedBy=multi-user.target
  966. EOF
  967.  
  968. systemctl daemon-reload
  969. systemctl enable wings
  970. }
  971.  
  972. install_daemon_forever_f28() {
  973. cd /root
  974. output "Installing Pterodactyl Daemon dependencies."
  975. dnf -y install curl tar unzip
  976. output "Installing Docker"
  977. curl -sSL https://get.docker.com/ | CHANNEL=stable bash
  978. systemctl enable docker
  979. systemctl start docker
  980. output "Enabling Swap support for Docker."
  981. sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="[^"]*/& swapaccount=1/' /etc/default/grub
  982. grub2-mkconfig -o /boot/grub2/grub.cfg
  983. output "Installing Nodejs."
  984. curl --silent --location https://rpm.nodesource.com/setup_10.x | sudo bash -
  985. dnf -y install nodejs make gcc-c++ make
  986.  
  987. output "Updating server packages."
  988. dnf -y upgrade
  989. dnf -y autoremove
  990. dnf -y clean packages
  991.  
  992. output "Installing the Pterodactyl Daemon."
  993. mkdir -p /srv/daemon /srv/daemon-data
  994. cd /srv/daemon
  995. wget https://thientran.io/daemon-0.6.7.zip
  996. unzip daemon-0.6.7
  997. npm install --only=production
  998. npm install -g forever
  999. }
  1000.  
  1001. install_daemon_c7() {
  1002. cd /root
  1003. output "Installing Pterodactyl Daemon dependencies."
  1004. yum -y install curl tar unzip
  1005. output "Installing Docker"
  1006. curl -sSL https://get.docker.com/ | CHANNEL=stable bash
  1007. systemctl enable docker
  1008. systemctl start docker
  1009. output "Enabling Swap support for Docker."
  1010. sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="[^"]*/& swapaccount=1/' /etc/default/grub
  1011. grub2-mkconfig -o /boot/grub2/grub.cfg
  1012. output "Installing Nodejs."
  1013. curl --silent --location https://rpm.nodesource.com/setup_10.x | sudo bash -
  1014. yum -y install nodejs make gcc-c++
  1015.  
  1016. output "Updating server packages."
  1017. yum -y upgrade
  1018. yum -y autoremove
  1019. yum -y clean packages
  1020.  
  1021. output "Installing the Pterodactyl Daemon."
  1022. mkdir -p /srv/daemon /srv/daemon-data
  1023. cd /srv/daemon
  1024. curl -L https://github.com/pterodactyl/daemon/releases/download/v0.6.7/daemon.tar.gz | tar --strip-components=1 -xzv
  1025. npm install --only=production
  1026.  
  1027. bash -c 'cat > /etc/systemd/system/wings.service' <<-'EOF'
  1028. [Unit]
  1029. Description=Pterodactyl Wings Daemon
  1030. After=docker.service
  1031.  
  1032. [Service]
  1033. User=root
  1034. #Group=some_group
  1035. WorkingDirectory=/srv/daemon
  1036. LimitNOFILE=4096
  1037. PIDFile=/var/run/wings/daemon.pid
  1038. ExecStart=/usr/bin/node /srv/daemon/src/index.js
  1039. Restart=on-failure
  1040. StartLimitInterval=600
  1041.  
  1042. [Install]
  1043. WantedBy=multi-user.target
  1044. EOF
  1045.  
  1046. systemctl daemon-reload
  1047. systemctl enable wings
  1048. }
  1049.  
  1050. install_daemon_forever_c7() {
  1051. cd /root
  1052. output "Installing Pterodactyl Daemon dependencies."
  1053. yum -y install curl tar unzip
  1054. output "Installing Docker"
  1055. curl -sSL https://get.docker.com/ | CHANNEL=stable bash
  1056. systemctl enable docker
  1057. systemctl start docker
  1058. output "Enabling Swap support for Docker."
  1059. sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="[^"]*/& swapaccount=1/' /etc/default/grub
  1060. grub2-mkconfig -o /boot/grub2/grub.cfg
  1061. output "Installing Nodejs."
  1062. curl --silent --location https://rpm.nodesource.com/setup_10.x | sudo bash -
  1063. yum -y install nodejs make gcc-c++ make
  1064.  
  1065. output "Updating server packages."
  1066. yum -y upgrade
  1067. yum -y autoremove
  1068. yum -y clean packages
  1069.  
  1070. output "Installing the Pterodactyl Daemon."
  1071. mkdir -p /srv/daemon /srv/daemon-data
  1072. cd /srv/daemon
  1073. curl -L https://github.com/pterodactyl/daemon/releases/download/v0.6.7/daemon.tar.gz | tar --strip-components=1 -xzv
  1074. npm install --only=production
  1075. npm install -g forever
  1076. }
  1077.  
  1078. kernel_modifications_d8(){
  1079. output "Modifying Grub."
  1080. sed -i 's/GRUB_CMDLINE_LINUX_DEFAULT="[^"]*/& cgroup_enable=memory/' /etc/default/grub
  1081. output "Adding backport repositories."
  1082. echo deb http://http.debian.net/debian jessie-backports main > /etc/apt/sources.list.d/jessie-backports.list
  1083. echo deb http://http.debian.net/debian jessie-backports main contrib non-free > /etc/apt/sources.list.d/jessie-backports.list
  1084. output "Updating Server Packages."
  1085. apt-get -y update
  1086. apt-get -y upgrade
  1087. apt-get -y autoremove
  1088. apt-get -y autoclean
  1089. output"Installing new kernel"
  1090. apt install -t jessie-backports linux-image-4.9.0-0.bpo.7-amd64
  1091. output "Modifying Docker."
  1092. sed -i 's,/usr/bin/dockerd,/usr/bin/dockerd --storage-driver=overlay2,g' /lib/systemd/system/docker.service
  1093. systemctl daemon-reload
  1094. service docker start
  1095. }
  1096.  
  1097. ssl_certs(){
  1098. output "Installing LetsEncrypt and creating an SSL certificate."
  1099. apt-get -y install certbot
  1100. service nginx stop
  1101. service apache2 stop
  1102. apt-get update && apt-get upgrade -y
  1103. certbot certonly --standalone --email "$email" --agree-tos -d "$FQDN" --non-interactive
  1104. service nginx restart
  1105. service apache2 restart
  1106. }
  1107.  
  1108. ssl_certs_d8(){
  1109. output "Installing LetsEncrypt and creating an SSL certificate."
  1110. sudo apt-get -y install certbot -t jessie-backports
  1111. service nginx stop
  1112. service apache2 stop
  1113. apt-get update && apt-get upgrade -y
  1114. certbot certonly --standalone --email "$email" --agree-tos -d "$FQDN" --non-interactive
  1115. service nginx restart
  1116. service apache2 restart
  1117. }
  1118.  
  1119. ssl_certs_f28(){
  1120. output "Installing LetsEncrypt and creating an SSL certificate."
  1121. dnf -y install certbot
  1122. service nginx stop
  1123. service httpd stop
  1124. certbot certonly --standalone --email "$email" --agree-tos -d "$FQDN" --non-interactive
  1125. service nginx restart
  1126. service httpd restart
  1127. }
  1128.  
  1129. ssl_certs_c7(){
  1130. output "Installing LetsEncrypt and creating an SSL certificate."
  1131. yum -y install certbot
  1132. service nginx stop
  1133. service httpd stop
  1134. certbot certonly --standalone --email "$email" --agree-tos -d "$FQDN" --non-interactive
  1135. service nginx restart
  1136. service httpd restart
  1137. }
  1138.  
  1139. firewall(){
  1140. apt-get -y install ufw
  1141. ufw allow 22
  1142. ufw allow 80
  1143. ufw allow 443
  1144. ufw --force enable
  1145. }
  1146.  
  1147. firewall_daemon(){
  1148. apt-get -y install ufw
  1149. ufw allow 22
  1150. ufw allow 8080
  1151. ufw allow 2022
  1152. ufw --force enable
  1153. }
  1154.  
  1155. firewall_f28(){
  1156. dnf -y install firewalld
  1157. systemctl enable firewalld
  1158. systemctl start firewalld
  1159. firewall-cmd --add-service=http --permanent
  1160. firewall-cmd --add-service=https --permanent
  1161. firewall-cmd --add-service=http
  1162. firewall-cmd --add-service=https
  1163. firewall-cmd --reload
  1164. }
  1165.  
  1166. firewall_daemon_f28(){
  1167. dnf -y install firewalld
  1168. systemctl enable firewalld
  1169. systemctl start firewalld
  1170. firewall-cmd --permanent --add-port=2022/tcp
  1171. firewall-cmd --permanent --add-port=8080/tcp
  1172. firewall-cmd --reload
  1173. }
  1174.  
  1175. firewall_c7(){
  1176. yum -y install firewalld
  1177. systemctl enable firewalld
  1178. systemctl start firewalld
  1179. firewall-cmd --add-service=http --permanent
  1180. firewall-cmd --add-service=https --permanent
  1181. firewall-cmd --add-service=http
  1182. firewall-cmd --add-service=https
  1183. firewall-cmd --reload
  1184. }
  1185.  
  1186. firewall_daemon_c7(){
  1187. yum -y install firewalld
  1188. systemctl enable firewalld
  1189. systemctl start firewalld
  1190. firewall-cmd --permanent --add-port=2022/tcp
  1191. firewall-cmd --permanent --add-port=8080/tcp
  1192. firewall-cmd --reload
  1193. }
  1194.  
  1195. create_rclocal(){
  1196. printf '%s\n' '#!/bin/bash' 'exit 0' | sudo tee -a /etc/rc.local
  1197. chmod +x /etc/rc.local
  1198. }
  1199.  
  1200. iptables_rules(){
  1201. iptables -t mangle -A PREROUTING -m conntrack --ctstate INVALID -j DROP
  1202. iptables -t mangle -A PREROUTING -p tcp ! --syn -m conntrack --ctstate NEW -j DROP
  1203. iptables -t mangle -A PREROUTING -p tcp -m conntrack --ctstate NEW -m tcpmss ! --mss 536:65535 -j DROP
  1204. iptables -t mangle -A PREROUTING -p tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -j DROP
  1205. iptables -t mangle -A PREROUTING -p tcp --tcp-flags FIN,SYN FIN,SYN -j DROP
  1206. iptables -t mangle -A PREROUTING -p tcp --tcp-flags SYN,RST SYN,RST -j DROP
  1207. iptables -t mangle -A PREROUTING -p tcp --tcp-flags FIN,RST FIN,RST -j DROP
  1208. iptables -t mangle -A PREROUTING -p tcp --tcp-flags FIN,ACK FIN -j DROP
  1209. iptables -t mangle -A PREROUTING -p tcp --tcp-flags ACK,URG URG -j DROP
  1210. iptables -t mangle -A PREROUTING -p tcp --tcp-flags ACK,FIN FIN -j DROP
  1211. iptables -t mangle -A PREROUTING -p tcp --tcp-flags ACK,PSH PSH -j DROP
  1212. iptables -t mangle -A PREROUTING -p tcp --tcp-flags ALL ALL -j DROP
  1213. iptables -t mangle -A PREROUTING -p tcp --tcp-flags ALL NONE -j DROP
  1214. iptables -t mangle -A PREROUTING -p tcp --tcp-flags ALL FIN,PSH,URG -j DROP
  1215. iptables -t mangle -A PREROUTING -p tcp --tcp-flags ALL SYN,FIN,PSH,URG -j DROP
  1216. iptables -t mangle -A PREROUTING -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j DROP
  1217. iptables -t mangle -A PREROUTING -p icmp -j DROP
  1218. iptables -A INPUT -p tcp -m connlimit --connlimit-above 80 --connlimit-mask 32 --connlimit-saddr -j REJECT --reject-with tcp-reset
  1219. iptables -t mangle -A PREROUTING -f -j DROP
  1220. /sbin/iptables -A INPUT -p tcp --dport ssh -m conntrack --ctstate NEW -m recent --set
  1221. /sbin/iptables -A INPUT -p tcp --dport ssh -m conntrack --ctstate NEW -m recent --update --seconds 60 --hitcount 10 -j DROP
  1222. /sbin/iptables -N port-scanning
  1223. /sbin/iptables -A port-scanning -p tcp --tcp-flags SYN,ACK,FIN,RST RST -m limit --limit 1/s --limit-burst 2 -j RETURN
  1224. /sbin/iptables -A port-scanning -j DROP
  1225. sh -c "iptables-save > /etc/iptables.conf"
  1226. sed -i -e '$i \iptables-restore < /etc/iptables.conf\n' /etc/rc.local
  1227. }
  1228.  
  1229. broadcast(){
  1230. output "Your MariaDB root password is $rootpassword"
  1231. }
  1232.  
  1233. broadcast_daemon(){
  1234. output "Installation completed. Please configure the daemon. Remember to do 'cd /srv/daemon.'"
  1235. output "The guide for daemon configuration can be founded here: https://pterodactyl.io/daemon/installing.html#configure-daemon"
  1236. output ""
  1237. output "If you chose the Systemd installation, do 'service wings restart' after the configuration process is finished."
  1238. output "If you chose the Forever installation, do 'forever start src/index.js' after the configuration process is finished."
  1239. }
  1240.  
  1241. broadcast_daemon_u4(){
  1242. output "Installation completed. Please configure the daemon. Remember to do 'cd /srv/daemon.'"
  1243. output "The guide for daemon configuration can be founded here: https://pterodactyl.io/daemon/installing.html#configure-daemon"
  1244. output "Please run 'forever start src/index.js' after the configuration process is finished."
  1245. }
  1246.  
  1247. broadcast_d8(){
  1248. output "Please restart the server after you have configured the daemon to apply the necessary kernel changes on Debian 8."
  1249. }
  1250.  
  1251. #Execution
  1252. copyright
  1253. server_options
  1254. get_distribution
  1255. os_options
  1256.  
  1257. case $osoption in
  1258. 1) case $installoption in
  1259. 1) webserver_options
  1260. fonix_options
  1261. required_infos
  1262. apt-get -y install sudo
  1263. create_rclocal
  1264. iptables_rules
  1265. server_u18
  1266. install_mariadb
  1267. firewall
  1268. case $webserver in
  1269. 1) install_nginx_dependencies
  1270. install_pterodactyl
  1271. pterodactyl_queue
  1272. ssl_certs
  1273. nginx_config
  1274. ;;
  1275. 2) install_apache_dependencies
  1276. install_pterodactyl
  1277. pterodactyl_queue
  1278. ssl_certs
  1279. apache_config
  1280. ;;
  1281. esac
  1282. case $fonixoption in
  1283. 1) broadcast
  1284. ;;
  1285. 2) fonix_graphite
  1286. broadcast
  1287. ;;
  1288. 3) fonix_midnight
  1289. broadcast
  1290. ;;
  1291. esac
  1292. output "Use 'ufw enable <port>' to enable your desired ports. Port 22, 80, 443 have been opened by default."
  1293. ;;
  1294. 2) required_infos
  1295. daemon_option
  1296. apt-get -y install sudo
  1297. create_rclocal
  1298. iptables_rules
  1299. apt-get -y install software-properties-common
  1300. add-apt-repository -y universe
  1301. add-apt-repository -y ppa:certbot/certbot
  1302. apt-get update && apt-get upgrade -y
  1303. firewall_daemon
  1304. case $daemonoption in
  1305. 1) install_daemon
  1306. ;;
  1307. 2) install_daemon_forever
  1308. ;;
  1309. esac
  1310. ufw allow 80
  1311. ssl_certs
  1312. ufw delete 8 -y
  1313. ufw delete 4 -y
  1314. broadcast_daemon
  1315. output "Use 'ufw enable <port>' to enable your desired ports. Port 22, 8080, 2022 have been opened by default."
  1316. ;;
  1317. 3) webserver_options
  1318. fonix_options
  1319. required_infos
  1320. daemon_option
  1321. apt-get -y install sudo
  1322. create_rclocal
  1323. iptables_rules
  1324. server_u18
  1325. install_mariadb
  1326. firewall
  1327. firewall_daemon
  1328. case $webserver in
  1329. 1) install_nginx_dependencies
  1330. install_pterodactyl
  1331. pterodactyl_queue
  1332. ssl_certs
  1333. nginx_config
  1334. case $daemonoption in
  1335. 1) install_daemon
  1336. ;;
  1337. 2) install_daemon_forever
  1338. ;;
  1339. esac
  1340. ;;
  1341. 2) install_apache_dependencies
  1342. install_pterodactyl
  1343. pterodactyl_queue
  1344. ssl_certs
  1345. apache_config
  1346. case $daemonoption in
  1347. 1) install_daemon
  1348. ;;
  1349. 2) install_daemon_forever
  1350. ;;
  1351. esac
  1352. ;;
  1353. esac
  1354. case $fonixoption in
  1355. 1) broadcast
  1356. broadcast_daemon
  1357. ;;
  1358. 2) fonix_graphite
  1359. broadcast
  1360. broadcast_daemon
  1361. ;;
  1362. 3) fonix_midnight
  1363. broadcast
  1364. broadcast_daemon
  1365. ;;
  1366. esac
  1367. output "Use 'ufw enable <port>' to enable your desired ports. Port 22, 80, 443, 8080, 2022 have been opened by default."
  1368. ;;
  1369. esac
  1370. ;;
  1371.  
  1372. 2) case $installoption in
  1373. 1) webserver_options
  1374. fonix_options
  1375. required_infos
  1376. apt-get -y install sudo
  1377. iptables_rules
  1378. server_u16
  1379. install_mariadb
  1380. firewall
  1381. case $webserver in
  1382. 1) install_nginx_dependencies
  1383. install_pterodactyl
  1384. pterodactyl_queue
  1385. ssl_certs
  1386. nginx_config
  1387. ;;
  1388. 2) install_apache_dependencies
  1389. install_pterodactyl
  1390. pterodactyl_queue
  1391. ssl_certs
  1392. apache_config
  1393. ;;
  1394. esac
  1395. case $fonixoption in
  1396. 1) broadcast
  1397. ;;
  1398. 2) fonix_graphite
  1399. broadcast
  1400. ;;
  1401. 3) fonix_midnight
  1402. broadcast
  1403. ;;
  1404. esac
  1405. output "Use 'ufw enable <port>' to enable your desired ports. Port 22, 80, 443 have been opened by default."
  1406. ;;
  1407. 2) required_infos
  1408. daemon_option
  1409. apt-get -y install sudo
  1410. iptables_rules
  1411. apt-get -y install software-properties-common
  1412. add-apt-repository -y universe
  1413. add-apt-repository -y ppa:certbot/certbot
  1414. apt-get update && apt-get upgrade -y
  1415. firewall_daemon
  1416. case $daemonoption in
  1417. 1) install_daemon
  1418. ;;
  1419. 2) install_daemon_forever
  1420. ;;
  1421. esac
  1422. ufw allow 80
  1423. ssl_certs
  1424. ufw delete 8 -y
  1425. ufw delete 4 -y
  1426. broadcast_daemon
  1427. output "Use 'ufw enable <port>' to enable your desired ports. Port 22, 8080, 2022 have been opened by default."
  1428. ;;
  1429. 3) webserver_options
  1430. fonix_options
  1431. required_infos
  1432. daemon_option
  1433. apt-get -y install sudo
  1434. iptables_rules
  1435. server_u16
  1436. install_mariadb
  1437. firewall
  1438. firewall_daemon
  1439. case $webserver in
  1440. 1) install_nginx_dependencies
  1441. install_pterodactyl
  1442. pterodactyl_queue
  1443. ssl_certs
  1444. nginx_config
  1445. case $daemonoption in
  1446. 1) install_daemon
  1447. ;;
  1448. 2) install_daemon_forever
  1449. ;;
  1450. esac
  1451. ;;
  1452. 2) install_apache_dependencies
  1453. install_pterodactyl
  1454. pterodactyl_queue
  1455. ssl_certs
  1456. apache_config
  1457. case $daemonoption in
  1458. 1) install_daemon
  1459. ;;
  1460. 2) install_daemon_forever
  1461. ;;
  1462. esac
  1463. ;;
  1464. esac
  1465. case $fonixoption in
  1466. 1) broadcast
  1467. broadcast_daemon
  1468. ;;
  1469. 2) fonix_graphite
  1470. broadcast
  1471. broadcast_daemon
  1472. ;;
  1473. 3) fonix_midnight
  1474. broadcast
  1475. broadcast_daemon
  1476. ;;
  1477. esac
  1478. output "Use 'ufw enable <port>' to enable your desired ports. Port 22, 80, 443, 8080, 2022 have been opened by default."
  1479. esac
  1480. ;;
  1481. 3) case $installoption in
  1482. 1) webserver_options
  1483. fonix_options
  1484. required_infos
  1485. apt-get -y install sudo
  1486. iptables_rules
  1487. server_u14
  1488. install_mariadb
  1489. firewall
  1490. case $webserver in
  1491. 1) install_nginx_dependencies
  1492. install_pterodactyl
  1493. pterodactyl_supervisor
  1494. ssl_certs
  1495. nginx_config
  1496. ;;
  1497. 2) install_apache_dependencies
  1498. install_pterodactyl
  1499. pterodactyl_supervisor
  1500. ssl_certs
  1501. apache_config
  1502. ;;
  1503. esac
  1504. case $fonixoption in
  1505. 1) broadcast
  1506. ;;
  1507. 2) fonix_graphite
  1508. broadcast
  1509. ;;
  1510. 3) fonix_midnight
  1511. broadcast
  1512. ;;
  1513. esac
  1514. output "Use 'ufw enable <port>' to enable your desired ports. Port 22, 80, 443 have been opened by default."
  1515. ;;
  1516. 2) required_infos
  1517. apt-get -y install sudo
  1518. iptables_rules
  1519. apt-get -y install software-properties-common
  1520. add-apt-repository -y universe
  1521. add-apt-repository -y ppa:certbot/certbot
  1522. apt-get update && apt-get upgrade -y
  1523. firewall_daemon
  1524. install_daemon_forever
  1525. ufw allow 80
  1526. ssl_certs
  1527. ufw delete 8 -y
  1528. ufw delete 4 -y
  1529. broadcast_daemon
  1530. output "Use 'ufw enable <port>' to enable your desired ports. Port 22, 8080, 2022 have been opened by default."
  1531. ;;
  1532. 3) webserver_options
  1533. fonix_options
  1534. required_infos
  1535. apt-get -y install sudo
  1536. iptables_rules
  1537. server_u14
  1538. install_mariadb
  1539. firewall
  1540. firewall_daemon
  1541. case $webserver in
  1542. 1) install_nginx_dependencies
  1543. install_pterodactyl
  1544. pterodactyl_supervisor
  1545. ssl_certs
  1546. nginx_config
  1547. install_daemon_forever
  1548. ;;
  1549. 2) install_apache_dependencies
  1550. install_pterodactyl
  1551. pterodactyl_supervisor
  1552. ssl_certs
  1553. apache_config
  1554. install_daemon_forever
  1555. ;;
  1556. esac
  1557. case $fonixoption in
  1558. 1) broadcast
  1559. broadcast_daemon
  1560. ;;
  1561. 2) fonix_graphite
  1562. broadcast
  1563. broadcast_daemon
  1564. ;;
  1565. 3) fonix_midnight
  1566. broadcast
  1567. broadcast_daemon
  1568. ;;
  1569. esac
  1570. output "Use 'ufw enable <port>' to enable your desired ports. Port 22, 80, 443, 8080, 2022 have been opened by default."
  1571. esac
  1572. ;;
  1573. 4) case $installoption in
  1574. 1) webserver_options
  1575. fonix_options
  1576. required_infos
  1577. apt-get -y install sudo
  1578. iptables_rules
  1579. server_d9
  1580. install_mariadb
  1581. firewall
  1582. case $webserver in
  1583. 1) install_nginx_dependencies
  1584. install_pterodactyl
  1585. pterodactyl_queue
  1586. ssl_certs
  1587. nginx_config
  1588. ;;
  1589. 2) install_apache_dependencies
  1590. install_pterodactyl
  1591. pterodactyl_queue
  1592. ssl_certs
  1593. apache_config
  1594. ;;
  1595. esac
  1596. case $fonixoption in
  1597. 1) broadcast
  1598. ;;
  1599. 2) fonix_graphite
  1600. broadcast
  1601. ;;
  1602. 3) fonix_midnight
  1603. broadcast
  1604. ;;
  1605. esac
  1606. output "Use 'ufw enable <port>' to enable your desired ports. Port 22, 80, 443 have been opened by default."
  1607. ;;
  1608. 2) required_infos
  1609. daemon_option
  1610. apt-get -y install sudo
  1611. iptables_rules
  1612. firewall_daemon
  1613. apt-get -y install software-properties-common
  1614. apt-get update && apt-get upgrade -y
  1615. case $daemonoption in
  1616. 1) install_daemon
  1617. ;;
  1618. 2) install_daemon_forever
  1619. ;;
  1620. esac
  1621. ufw allow 80
  1622. ssl_certs
  1623. ufw delete 8 -y
  1624. ufw delete 4 -y
  1625. broadcast_daemon
  1626. output "Use 'ufw enable <port>' to enable your desired ports. Port 22, 8080, 2022 have been opened by default."
  1627. ;;
  1628. 3) webserver_options
  1629. fonix_options
  1630. required_infos
  1631. daemon_option
  1632. apt-get -y install sudo
  1633. iptables_rules
  1634. server_d9
  1635. install_mariadb
  1636. firewall
  1637. firewall_daemon
  1638. case $webserver in
  1639. 1) install_nginx_dependencies
  1640. install_pterodactyl
  1641. pterodactyl_queue
  1642. ssl_certs
  1643. nginx_config
  1644. case $daemonoption in
  1645. 1) install_daemon
  1646. ;;
  1647. 2) install_daemon_forever
  1648. ;;
  1649. esac
  1650. ;;
  1651. 2) install_apache_dependencies
  1652. install_pterodactyl
  1653. pterodactyl_queue
  1654. ssl_certs
  1655. apache_config
  1656. case $daemonoption in
  1657. 1) install_daemon
  1658. ;;
  1659. 2) install_daemon_forever
  1660. ;;
  1661. esac
  1662. ;;
  1663. esac
  1664. case $fonixoption in
  1665. 1) broadcast
  1666. broadcast_daemon
  1667. ;;
  1668. 2) fonix_graphite
  1669. broadcast
  1670. broadcast_daemon
  1671. ;;
  1672. 3) fonix_midnight
  1673. broadcast
  1674. broadcast_daemon
  1675. ;;
  1676. esac
  1677. output "Use 'ufw enable <port>' to enable your desired ports. Port 22, 80, 443, 8080, 2022 have been opened by default."
  1678. esac
  1679. ;;
  1680. 5) case $installoption in
  1681. 1) webserver_options
  1682. fonix_options
  1683. required_infos
  1684. apt-get -y install sudo
  1685. iptables_rules
  1686. server_d8
  1687. install_mariadb
  1688. firewall
  1689. case $webserver in
  1690. 1) install_nginx_dependencies
  1691. install_pterodactyl
  1692. pterodactyl_queue
  1693. ssl_certs_d8
  1694. nginx_config
  1695. ;;
  1696. 2) install_apache_dependencies
  1697. install_pterodactyl
  1698. pterodactyl_queue
  1699. ssl_certs_d8
  1700. apache_config
  1701. ;;
  1702. esac
  1703. case $fonixoption in
  1704. 1) broadcast
  1705. ;;
  1706. 2) fonix_graphite
  1707. broadcast
  1708. ;;
  1709. 3) fonix_midnight
  1710. broadcast
  1711. ;;
  1712. esac
  1713. output "Use 'ufw enable <port>' to enable your desired ports. Port 22, 80, 443 have been opened by default."
  1714. ;;
  1715. 2) required_infos
  1716. daemon_option
  1717. apt-get -y install sudo
  1718. iptables_rules
  1719. firewall_daemon
  1720. case $daemonoption in
  1721. 1) install_daemon
  1722. ;;
  1723. 2) install_daemon_forever
  1724. ;;
  1725. esac
  1726. kernel_modifications_d8
  1727. ufw allow 80
  1728. ssl_certs_d8
  1729. ufw delete 8 -y
  1730. ufw delete 4 -y
  1731. broadcast_daemon
  1732. broadcast_d8
  1733. output "Use 'ufw enable <port>' to enable your desired ports. Port 22, 8080, 2022 have been opened by default."
  1734. ;;
  1735. 3) webserver_options
  1736. fonix_options
  1737. required_infos
  1738. daemon_option
  1739. apt-get -y install sudo
  1740. iptables_rules
  1741. server_d8
  1742. install_mariadb
  1743. firewall
  1744. firewall_daemon
  1745. case $webserver in
  1746. 1) install_nginx_dependencies
  1747. install_pterodactyl
  1748. pterodactyl_queue
  1749. ssl_certs_d8
  1750. nginx_config
  1751. case $daemonoption in
  1752. 1) install_daemon
  1753. ;;
  1754. 2) install_daemon_forever
  1755. ;;
  1756. esac
  1757. kernel_modifications_d8
  1758. ;;
  1759. 2) install_apache_dependencies
  1760. install_pterodactyl
  1761. pterodactyl_queue
  1762. ssl_certs_d8
  1763. apache_config
  1764. case $daemonoption in
  1765. 1) install_daemon
  1766. ;;
  1767. 2) install_daemon_forever
  1768. ;;
  1769. esac
  1770. kernel_modifications_d8
  1771. ;;
  1772. esac
  1773. case $fonixoption in
  1774. 1) broadcast
  1775. broadcast_daemon
  1776. broadcast_d8
  1777. ;;
  1778. 2) fonix_graphite
  1779. broadcast
  1780. broadcast_daemon
  1781. broadcast_d8
  1782. ;;
  1783. 3) fonix_midnight
  1784. broadcast
  1785. broadcast_daemon
  1786. broadcast_d8
  1787. ;;
  1788. esac
  1789. output "Use 'ufw enable <port>' to enable your desired ports. Port 22, 80, 443, 8080, 2022 have been opened by default."
  1790. esac
  1791. ;;
  1792. 6) case $installoption in
  1793. 1) webserver_options
  1794. fonix_options
  1795. required_infos
  1796. dnf -y install sudo
  1797. create_rclocal
  1798. iptables_rules
  1799. server_f28
  1800. firewall_f28
  1801. case $webserver in
  1802. 1) install_nginx_dependencies_f28
  1803. activate_services
  1804. install_pterodactyl
  1805. pterodactyl_queue_nginx
  1806. ssl_certs_f28
  1807. php_config
  1808. nginx_config_f28
  1809. ;;
  1810. 2) install_apache_dependencies_f28
  1811. activate_services
  1812. install_pterodactyl
  1813. pterodactyl_queue_apache
  1814. ssl_certs_f28
  1815. apache_config_28
  1816. ;;
  1817. esac
  1818. case $fonixoption in
  1819. 1) broadcast
  1820. ;;
  1821. 2) fonix_graphite
  1822. broadcast
  1823. ;;
  1824. 3) fonix_midnight
  1825. broadcast
  1826. ;;
  1827. esac
  1828. semanage permissive -a httpd_t
  1829. output "firewall-cmd --permanent --add-port=<port>/tcp' to enable your desired ports. Port 22, 80, 443 have been opened by default."
  1830. ;;
  1831. 2) required_infos
  1832. daemon_option
  1833. dnf -y install sudo
  1834. create_rclocal
  1835. iptables_rules
  1836. dnf -y upgrade
  1837. firewall_daemon_f28
  1838. case $daemonoption in
  1839. 1) install_daemon_f28
  1840. ;;
  1841. 2) install_daemon_forever_f28
  1842. ;;
  1843. esac
  1844. firewall-cmd --permanent --add-port=80/tcp
  1845. firewall-cmd --reload
  1846. ssl_certs_f28
  1847. firewall-cmd --permanent --remove-port=80/tcp
  1848. firewall-cmd --reload
  1849. broadcast_daemon
  1850. output "firewall-cmd --permanent --add-port=<port>/tcp' to enable your desired ports. Port 22, 8080, 2022 have been opened by default."
  1851. ;;
  1852. 3) webserver_options
  1853. fonix_options
  1854. required_infos
  1855. daemon_option
  1856. dnf -y install sudo
  1857. create_rclocal
  1858. iptables_rules
  1859. server_f28
  1860. firewall_f28
  1861. firewall_daemon_f28
  1862. case $webserver in
  1863. 1) install_nginx_dependencies_f28
  1864. activate_services
  1865. install_pterodactyl
  1866. pterodactyl_queue_nginx
  1867. ssl_certs_f28
  1868. php_config
  1869. nginx_config_f28
  1870. case $daemonoption in
  1871. 1) install_daemon_f28
  1872. ;;
  1873. 2) install_daemon_forever_f28
  1874. ;;
  1875. esac
  1876. ;;
  1877. 2) install_apache_dependencies_f28
  1878. activate_services
  1879. install_pterodactyl
  1880. pterodactyl_queue_apache
  1881. ssl_certs_f28
  1882. apache_config_f28
  1883. case $daemonoption in
  1884. 1) install_daemon_f28
  1885. ;;
  1886. 2) install_daemon_forever_f28
  1887. ;;
  1888. esac
  1889. ;;
  1890. esac
  1891. case $fonixoption in
  1892. 1) broadcast
  1893. broadcast_daemon
  1894. ;;
  1895. 2) fonix_graphite
  1896. broadcast
  1897. broadcast_daemon
  1898. ;;
  1899. 3) fonix_midnight
  1900. broadcast
  1901. broadcast_daemon
  1902. ;;
  1903. esac
  1904. semanage permissive -a httpd_t
  1905. output "firewall-cmd --permanent --add-port=<port>/tcp' to enable your desired ports. Port 22, 80, 443, 8080, 2022 have been opened by default."
  1906. ;;
  1907. esac
  1908. ;;
  1909. 7) case $installoption in
  1910. 1) webserver_options
  1911. fonix_options
  1912. required_infos
  1913. dnf -y install sudo
  1914. create_rclocal
  1915. iptables_rules
  1916. server_f27
  1917. firewall_f28
  1918. case $webserver in
  1919. 1) install_nginx_dependencies_f27
  1920. activate_services
  1921. audit2allow -a -M mysql_t
  1922. semodule -i mysql_t.pp
  1923. systemctl restart mariadb
  1924. install_pterodactyl
  1925. pterodactyl_queue_nginx
  1926. ssl_certs_f28
  1927. php_config
  1928. nginx_config_f28
  1929. ;;
  1930. 2) install_apache_dependencies_f27
  1931. activate_services
  1932. audit2allow -a -M mysql_t
  1933. semodule -i mysql_t.pp
  1934. systemctl restart mariadb
  1935. install_pterodactyl
  1936. pterodactyl_queue_apache
  1937. ssl_certs_f28
  1938. apache_config_28
  1939. ;;
  1940. esac
  1941. case $fonixoption in
  1942. 1) broadcast
  1943. ;;
  1944. 2) fonix_graphite
  1945. broadcast
  1946. ;;
  1947. 3) fonix_midnight
  1948. broadcast
  1949. ;;
  1950. esac
  1951. semanage permissive -a httpd_t
  1952. output "firewall-cmd --permanent --add-port=<port>/tcp' to enable your desired ports. Port 22, 80, 443 have been opened by default."
  1953. ;;
  1954. 2) required_infos
  1955. daemon_option
  1956. dnf -y install sudo
  1957. create_rclocal
  1958. iptables_rules
  1959. dnf -y upgrade
  1960. firewall_daemon_f28
  1961. case $daemonoption in
  1962. 1) install_daemon_f28
  1963. ;;
  1964. 2) install_daemon_forever_f28
  1965. ;;
  1966. esac
  1967. firewall-cmd --permanent --add-port=80/tcp
  1968. firewall-cmd --reload
  1969. ssl_certs_f28
  1970. firewall-cmd --permanent --remove-port=80/tcp
  1971. firewall-cmd --reload
  1972. broadcast_daemon
  1973. output "firewall-cmd --permanent --add-port=<port>/tcp' to enable your desired ports. Port 22, 8080, 2022 have been opened by default."
  1974. ;;
  1975. 3) webserver_options
  1976. fonix_options
  1977. required_infos
  1978. daemon_option
  1979. dnf -y install sudo
  1980. create_rclocal
  1981. iptables_rules
  1982. server_f27
  1983. firewall_f28
  1984. firewall_daemon_f28
  1985. case $webserver in
  1986. 1) install_nginx_dependencies_f27
  1987. activate_services
  1988. audit2allow -a -M mysql_t
  1989. semodule -i mysql_t.pp
  1990. systemctl restart mariadb
  1991. install_pterodactyl
  1992. pterodactyl_queue_nginx
  1993. ssl_certs_f28
  1994. php_config
  1995. nginx_config_f28
  1996. case $daemonoption in
  1997. 1) install_daemon_f28
  1998. ;;
  1999. 2) install_daemon_forever_f28
  2000. ;;
  2001. esac
  2002. ;;
  2003. 2) install_apache_dependencies_f27
  2004. activate_services
  2005. audit2allow -a -M mysql_t
  2006. semodule -i mysql_t.pp
  2007. systemctl restart mariadb
  2008. install_pterodactyl
  2009. pterodactyl_queue_apache
  2010. ssl_certs_f28
  2011. apache_config_f28
  2012. case $daemonoption in
  2013. 1) install_daemon_f28
  2014. ;;
  2015. 2) install_daemon_forever_f28
  2016. ;;
  2017. esac
  2018. ;;
  2019. esac
  2020. case $fonixoption in
  2021. 1) broadcast
  2022. broadcast_daemon
  2023. ;;
  2024. 2) fonix_graphite
  2025. broadcast
  2026. broadcast_daemon
  2027. ;;
  2028. 3) fonix_midnight
  2029. broadcast
  2030. broadcast_daemon
  2031. ;;
  2032. esac
  2033. semanage permissive -a httpd_t
  2034. output "firewall-cmd --permanent --add-port=<port>/tcp' to enable your desired ports. Port 22, 80, 443, 8080, 2022 have been opened by default."
  2035. ;;
  2036. esac
  2037. ;;
  2038. 8) case $installoption in
  2039. 1) webserver_options
  2040. fonix_options
  2041. required_infos
  2042. yum -y install sudo
  2043. iptables_rules
  2044. server_c7
  2045. firewall_c7
  2046. case $webserver in
  2047. 1) install_nginx_dependencies_c7
  2048. activate_services
  2049. install_pterodactyl
  2050. pterodactyl_queue_nginx
  2051. ssl_certs_c7
  2052. php_config
  2053. nginx_config_f28
  2054. ;;
  2055. 2) install_apache_dependencies_c7
  2056. activate_services
  2057. install_pterodactyl
  2058. pterodactyl_queue_apache
  2059. ssl_certs_c7
  2060. apache_config_28
  2061. ;;
  2062. esac
  2063. case $fonixoption in
  2064. 1) broadcast
  2065. ;;
  2066. 2) fonix_graphite
  2067. broadcast
  2068. ;;
  2069. 3) fonix_midnight
  2070. broadcast
  2071. ;;
  2072. esac
  2073. semanage permissive -a httpd_t
  2074. output "firewall-cmd --permanent --add-port=<port>/tcp' to enable your desired ports. Port 22, 80, 443 have been opened by default."
  2075. ;;
  2076. 2) required_infos
  2077. daemon_option
  2078. yum -y install sudo
  2079. iptables_rules
  2080. yum -y upgrade
  2081. firewall_daemon_c7
  2082. case $daemonoption in
  2083. 1) install_daemon_c7
  2084. ;;
  2085. 2) install_daemon_forever_c7
  2086. ;;
  2087. esac
  2088. firewall-cmd --permanent --add-port=80/tcp
  2089. firewall-cmd --reload
  2090. ssl_certs_c7
  2091. firewall-cmd --permanent --remove-port=80/tcp
  2092. firewall-cmd --reload
  2093. broadcast_daemon
  2094. output "firewall-cmd --permanent --add-port=<port>/tcp' to enable your desired ports. Port 22, 8080, 2022 have been opened by default."
  2095. ;;
  2096. 3) webserver_options
  2097. fonix_options
  2098. required_infos
  2099. daemon_option
  2100. yum -y install sudo
  2101. iptables_rules
  2102. server_c7
  2103. firewall_c7
  2104. firewall_daemon_c7
  2105. case $webserver in
  2106. 1) install_nginx_dependencies_c7
  2107. activate_services
  2108. install_pterodactyl
  2109. pterodactyl_queue_nginx
  2110. ssl_certs_c7
  2111. php_config
  2112. nginx_config_f28
  2113. case $daemonoption in
  2114. 1) install_daemon_c7
  2115. ;;
  2116. 2) install_daemon_forever_c7
  2117. ;;
  2118. esac
  2119. ;;
  2120. 2) install_apache_dependencies_c7
  2121. activate_services
  2122. install_pterodactyl
  2123. pterodactyl_queue_apache
  2124. ssl_certs_c7
  2125. apache_config_f28
  2126. case $daemonoption in
  2127. 1) install_daemon_c7
  2128. ;;
  2129. 2) install_daemon_forever_c7
  2130. ;;
  2131. esac
  2132. ;;
  2133. esac
  2134. case $fonixoption in
  2135. 1) broadcast
  2136. broadcast_daemon
  2137. ;;
  2138. 2) fonix_graphite
  2139. broadcast
  2140. broadcast_daemon
  2141. ;;
  2142. 3) fonix_midnight
  2143. broadcast
  2144. broadcast_daemon
  2145. ;;
  2146. esac
  2147. semanage permissive -a httpd_t
  2148. output "firewall-cmd --permanent --add-port=<port>/tcp' to enable your desired ports. Port 22, 80, 443, 8080, 2022 have been opened by default."
  2149. ;;
  2150. esac
  2151. ;;
  2152. esac
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement