1
0
mirror of https://github.com/tommytran732/Pterodactyl-Script synced 2024-11-22 18:41:32 -05:00

Lots of minor bug fixes and updated contact info.

This commit is contained in:
AryunGupta 2021-10-12 20:12:01 -04:00
parent e2f5fbb115
commit 79adeff07f

View File

@ -14,7 +14,7 @@ PHPMYADMIN=5.1.1
preflight(){ preflight(){
output "Pterodactyl Installation & Upgrade Script" output "Pterodactyl Installation & Upgrade Script"
output "Copyright © 2020 Thien Tran <contact@thientran.io>." output "Copyright © 2020 Thien Tran <contact@tommytran.io>."
output "Please join my Matrix for community support: https://matrix.to/#/#tommytran732:matrix.org" output "Please join my Matrix for community support: https://matrix.to/#/#tommytran732:matrix.org"
output "" output ""
@ -113,7 +113,7 @@ os_check(){
if [ -r /etc/os-release ]; then if [ -r /etc/os-release ]; then
lsb_dist="$(. /etc/os-release && echo "$ID")" lsb_dist="$(. /etc/os-release && echo "$ID")"
dist_version="$(. /etc/os-release && echo "$VERSION_ID")" dist_version="$(. /etc/os-release && echo "$VERSION_ID")"
if [ "$lsb_dist" = "rhel" ]; then if [ "$lsb_dist" = "rhel" ] || [ "$lsb_dist" = "rocky" ]; then
dist_version="$(echo $dist_version | awk -F. '{print $1}')" dist_version="$(echo $dist_version | awk -F. '{print $1}')"
fi fi
else else
@ -140,12 +140,17 @@ os_check(){
output "Unsupported CentOS version. Only CentOS Stream 8 is supported." output "Unsupported CentOS version. Only CentOS Stream 8 is supported."
exit 2 exit 2
fi fi
elif [ "$lsb_dist" = "rocky" ]; then
if [ "$dist_version" != "8" ]; then
output "Unsupported RockyLinux version. Only RockyLinux 8 is supported."
exit 2
fi
elif [ "$lsb_dist" = "rhel" ]; then elif [ "$lsb_dist" = "rhel" ]; then
if [ $dist_version != "8" ]; then if [ $dist_version != "8" ]; then
output "Unsupported RHEL version. Only RHEL 8 is supported." output "Unsupported RHEL version. Only RHEL 8 is supported."
exit 2 exit 2
fi fi
elif [ "$lsb_dist" != "ubuntu" ] && [ "$lsb_dist" != "debian" ] && [ "$lsb_dist" != "centos" ]; then elif [ "$lsb_dist" != "ubuntu" ] && [ "$lsb_dist" != "debian" ] && [ "$lsb_dist" != "centos" ] && [ "$lsb_dist" != "rocky" ] && [ "$lsb_dist" != "rhel" ]; then
output "Unsupported operating system." output "Unsupported operating system."
output "" output ""
output "Supported OS:" output "Supported OS:"
@ -153,6 +158,7 @@ os_check(){
output "Debian: 10" output "Debian: 10"
output "Fedora: 34" output "Fedora: 34"
output "CentOS Stream: 8" output "CentOS Stream: 8"
output "Rocky Linux: 8"
output "RHEL: 8" output "RHEL: 8"
exit 2 exit 2
fi fi
@ -254,7 +260,7 @@ repositories_setup(){
apt-get -y autoremove apt-get -y autoremove
apt-get -y autoclean apt-get -y autoclean
apt-get -y install curl apt-get -y install curl
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ] || [ "$lsb_dist" = "rocky" ]; then
if [ "$lsb_dist" = "fedora" ] ; then if [ "$lsb_dist" = "fedora" ] ; then
dnf -y install http://rpms.remirepo.net/fedora/remi-release-34.rpm dnf -y install http://rpms.remirepo.net/fedora/remi-release-34.rpm
dnf -y install dnf-plugins-core python2 libsemanage-devel dnf -y install dnf-plugins-core python2 libsemanage-devel
@ -262,7 +268,7 @@ repositories_setup(){
dnf -y module enable php:remi-8.0 dnf -y module enable php:remi-8.0
dnf -y module enable nginx:mainline/common dnf -y module enable nginx:mainline/common
dnf -y module enable mariadb:14/server dnf -y module enable mariadb:14/server
elif [ "$lsb_dist" = "centos" ]; then elif [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rocky" ]; then
dnf -y install epel-release boost-program-options dnf -y install epel-release boost-program-options
dnf -y install http://rpms.remirepo.net/enterprise/remi-release-8.rpm dnf -y install http://rpms.remirepo.net/enterprise/remi-release-8.rpm
dnf config-manager --set-enabled remi dnf config-manager --set-enabled remi
@ -271,7 +277,7 @@ repositories_setup(){
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash
dnf config-manager --set-enabled mariadb dnf config-manager --set-enabled mariadb
elif [ "$lsb_dist" = "rhel" ]; then elif [ "$lsb_dist" = "rhel" ]; then
dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
dnf -y install boost-program-options dnf -y install boost-program-options
dnf -y install http://rpms.remirepo.net/enterprise/remi-release-8.rpm dnf -y install http://rpms.remirepo.net/enterprise/remi-release-8.rpm
dnf config-manager --set-enabled remi dnf config-manager --set-enabled remi
@ -295,7 +301,7 @@ install_dependencies(){
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 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
sh -c "DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated mariadb-server" sh -c "DEBIAN_FRONTEND=noninteractive apt-get install -y --allow-unauthenticated mariadb-server"
else else
if [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then if [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ] || [ "$lsb_dist" = "rocky" ]; then
dnf -y install MariaDB-server MariaDB-client --disablerepo=AppStream dnf -y install MariaDB-server MariaDB-client --disablerepo=AppStream
else else
dnf -y install MariaDB-server dnf -y install MariaDB-server
@ -310,14 +316,12 @@ install_dependencies(){
service redis-server start service redis-server start
systemctl enable php8.0-fpm systemctl enable php8.0-fpm
service php8.0-fpm start service php8.0-fpm start
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ] || [ "$lsb_dist" = "rocky" ]; then
systemctl enable redis systemctl enable --now redis
service redis start systemctl enable --now php-fpm
systemctl enable php-fpm
service php-fpm start
fi fi
systemctl enable cron systemctl enable --now cron
systemctl enable --now mariadb systemctl enable --now mariadb
systemctl enable --now nginx systemctl enable --now nginx
} }
@ -373,7 +377,7 @@ install_pterodactyl() {
chmod -R 755 storage/* bootstrap/cache/ chmod -R 755 storage/* bootstrap/cache/
output "Installing Pterodactyl..." output "Installing Pterodactyl..."
if [ "$installoption" = "2" ] || [ "$installoption" = "6" ]; then if [ "$installoption" = "1" ] || [ "$installoption" = "3" ]; then
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer --version=1.10.16 curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer --version=1.10.16
else else
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
@ -389,7 +393,7 @@ install_pterodactyl() {
php artisan p:user:make --email=$email --admin=1 php artisan p:user:make --email=$email --admin=1
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
chown -R www-data:www-data * /var/www/pterodactyl chown -R www-data:www-data * /var/www/pterodactyl
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ] || [ "$lsb_dist" = "rocky" ]; then
chown -R nginx:nginx * /var/www/pterodactyl chown -R nginx:nginx * /var/www/pterodactyl
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/pterodactyl/storage(/.*)?" semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/pterodactyl/storage(/.*)?"
restorecon -R /var/www/pterodactyl restorecon -R /var/www/pterodactyl
@ -412,7 +416,7 @@ ExecStart=/usr/bin/php /var/www/pterodactyl/artisan queue:work --queue=high,stan
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ] || [ "$lsb_dist" = "rocky" ]; then
cat > /etc/systemd/system/pteroq.service <<- 'EOF' cat > /etc/systemd/system/pteroq.service <<- 'EOF'
Description=Pterodactyl Queue Worker Description=Pterodactyl Queue Worker
After=redis-server.service After=redis-server.service
@ -429,8 +433,7 @@ EOF
setsebool -P httpd_unified 1 setsebool -P httpd_unified 1
fi fi
sudo systemctl daemon-reload sudo systemctl daemon-reload
systemctl enable pteroq.service systemctl enable --now pteroq.service
systemctl start pteroq
} }
upgrade_pterodactyl(){ upgrade_pterodactyl(){
@ -445,7 +448,7 @@ upgrade_pterodactyl(){
php artisan db:seed --force php artisan db:seed --force
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
chown -R www-data:www-data * /var/www/pterodactyl chown -R www-data:www-data * /var/www/pterodactyl
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ] || [ "$lsb_dist" = "rocky" ]; then
chown -R nginx:nginx * /var/www/pterodactyl chown -R nginx:nginx * /var/www/pterodactyl
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/pterodactyl/storage(/.*)?" semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/pterodactyl/storage(/.*)?"
restorecon -R /var/www/pterodactyl restorecon -R /var/www/pterodactyl
@ -465,7 +468,8 @@ server_tokens off;
set_real_ip_from 103.21.244.0/22; set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22; set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22; set_real_ip_from 103.31.4.0/22;
set_real_ip_from 104.16.0.0/12; set_real_ip_from 104.16.0.0/13;
set_real_ip_from 104.24.0.0/14;
set_real_ip_from 108.162.192.0/18; set_real_ip_from 108.162.192.0/18;
set_real_ip_from 131.0.72.0/22; set_real_ip_from 131.0.72.0/22;
set_real_ip_from 141.101.64.0/18; set_real_ip_from 141.101.64.0/18;
@ -539,9 +543,6 @@ server {
} }
} }
' | sudo -E tee /etc/nginx/sites-available/pterodactyl.conf >/dev/null 2>&1 ' | sudo -E tee /etc/nginx/sites-available/pterodactyl.conf >/dev/null 2>&1
if [ "$lsb_dist" = "debian" ]; then
sed -i 's/http2//g' /etc/nginx/sites-available/pterodactyl.conf
fi
ln -s /etc/nginx/sites-available/pterodactyl.conf /etc/nginx/sites-enabled/pterodactyl.conf ln -s /etc/nginx/sites-available/pterodactyl.conf /etc/nginx/sites-enabled/pterodactyl.conf
service nginx restart service nginx restart
} }
@ -554,7 +555,8 @@ server_tokens off;
set_real_ip_from 103.21.244.0/22; set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22; set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22; set_real_ip_from 103.31.4.0/22;
set_real_ip_from 104.16.0.0/12; set_real_ip_from 104.16.0.0/13;
set_real_ip_from 104.24.0.0/14;
set_real_ip_from 108.162.192.0/18; set_real_ip_from 108.162.192.0/18;
set_real_ip_from 131.0.72.0/22; set_real_ip_from 131.0.72.0/22;
set_real_ip_from 141.101.64.0/18; set_real_ip_from 141.101.64.0/18;
@ -660,7 +662,7 @@ EOF
webserver_config(){ webserver_config(){
if [ "$lsb_dist" = "debian" ] || [ "$lsb_dist" = "ubuntu" ]; then if [ "$lsb_dist" = "debian" ] || [ "$lsb_dist" = "ubuntu" ]; then
nginx_config nginx_config
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ] || [ "$lsb_dist" = "rocky" ]; then
php_config php_config
nginx_config_redhat nginx_config_redhat
chown -R nginx:nginx /var/lib/php/session chown -R nginx:nginx /var/lib/php/session
@ -680,12 +682,12 @@ install_wings() {
output "Installing Pterodactyl Wings dependencies..." output "Installing Pterodactyl Wings dependencies..."
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
apt-get -y install curl tar unzip apt-get -y install curl tar unzip
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ] || [ "$lsb_dist" = "rocky" ]; then
yum -y install curl tar unzip yum -y install curl tar unzip
fi fi
output "Installing Docker" output "Installing Docker"
if [ "$lsb_dist" = "rhel" ]; then if [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ] || [ "$lsb_dist" = "rocky" ]; then
dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
dnf -y install docker-ce dnf -y install docker-ce
else else
@ -718,8 +720,7 @@ StartLimitInterval=600
WantedBy=multi-user.target WantedBy=multi-user.target
EOF EOF
systemctl enable wings systemctl enable --now wings
systemctl start wings
output "Wings ${WINGS} has now been installed on your system." output "Wings ${WINGS} has now been installed on your system."
} }
@ -769,7 +770,7 @@ EOF
output "Installation completed." output "Installation completed."
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
chown -R www-data:www-data * /var/www/pterodactyl chown -R www-data:www-data * /var/www/pterodactyl
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ] || [ "$lsb_dist" = "rocky" ]; then
chown -R nginx:nginx * /var/www/pterodactyl chown -R nginx:nginx * /var/www/pterodactyl
semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/pterodactyl/storage(/.*)?" semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/pterodactyl/storage(/.*)?"
restorecon -R /var/www/pterodactyl restorecon -R /var/www/pterodactyl
@ -781,7 +782,7 @@ ssl_certs(){
cd /root || exit cd /root || exit
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
apt-get -y install certbot apt-get -y install certbot
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ] || [ "$lsb_dist" = "rocky" ]; then
yum -y install certbot yum -y install certbot
fi fi
service nginx stop service nginx stop
@ -790,7 +791,7 @@ ssl_certs(){
if [ "$installoption" = "2" ]; then if [ "$installoption" = "2" ]; then
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
ufw deny 80 ufw deny 80
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]; then elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rhel" ]|| [ "$lsb_dist" = "rocky" ]; then
firewall-cmd --permanent --remove-port=80/tcp firewall-cmd --permanent --remove-port=80/tcp
firewall-cmd --reload firewall-cmd --reload
fi fi
@ -820,7 +821,7 @@ ssl_certs(){
firewall(){ firewall(){
if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then if [ "$lsb_dist" = "ubuntu" ] || [ "$lsb_dist" = "debian" ]; then
apt -y install iptables apt -y install iptables
elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "rhel" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "cloudlinux" ]; then elif [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "rhel" ] || [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "rocky" ]; then
yum -y install iptables yum -y install iptables
fi fi
@ -865,7 +866,7 @@ EOF
ufw allow 3306 ufw allow 3306
fi fi
yes | ufw enable yes | ufw enable
elif [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "rhel" ]; then elif [ "$lsb_dist" = "centos" ] || [ "$lsb_dist" = "fedora" ] || [ "$lsb_dist" = "rhel" ] || [ "$lsb_dist" = "rocky" ]; then
yum -y install firewalld yum -y install firewalld
systemctl enable firewalld systemctl enable firewalld
systemctl start firewalld systemctl start firewalld