Skip to content

Instantly share code, notes, and snippets.

@ayan4m1
Last active February 23, 2020 23:56
Show Gist options
  • Save ayan4m1/1c2c7a780a777600e2a49f73b1248d56 to your computer and use it in GitHub Desktop.
Save ayan4m1/1c2c7a780a777600e2a49f73b1248d56 to your computer and use it in GitHub Desktop.

Pterodactyl on CentOS 7

# remove wifi card firmwares
yum remove -y iwl*-firmware
yum update -y

# install extra repos and yum-config-manager
yum install -y epel-release yum-utils http://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --disable remi-php54
yum-config-manager --enable remi-php74
yum update -y

yum install -y fail2ban
# todo: fail2ban setup

# install panel dependencies
yum install -y redis mariadb-server nginx
yum install -y vim git-core zip unzip certbot
yum install -y 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 composer

# set up redis
systemctl start redis
systemctl enable redis

# set up mariadb
systemctl start mariadb
systemctl enable mariadb
mysql_secure_installation

# get ssl cert
certbot certonly -d my.host.name

# add panel firewall rules
firewall-cmd --add-service=http --permanent
firewall-cmd --add-service=https --permanent 
firewall-cmd --reload

# add panel selinux rules
setsebool -P httpd_can_network_connect 1
setsebool -P httpd_execmem 1
setsebool -P httpd_unified 1

# install panel software
mkdir -p /var/www/pterodactyl
cd /var/www/pterodactyl
git clone https://github.com/pterodactyl/panel.git .
chmod -R 755 storage/* bootstrap/cache/
cp .env.example .env
composer install --no-dev --optimize-autoloader
php artisan key:generate --force
php artisan p:environment:setup
php artisan p:environment:database
php artisan p:environment:mail

php artisan migrate --seed
php artisan p:user:make
chown -R nginx:nginx *

crontab -e
# add the following to root crontab
# * * * * * php /var/www/pterodactyl/artisan schedule:run >> /dev/null 2>&1

# todo: create /etc/systemd/system/pteroq.service
systemctl enable --now pteroq

vim /etc/php-fpm.d/www-pterodactyl.conf
# copy default config into this file

vim /etc/nginx/conf.d/pterodactyl.conf
# copy default config into this file

chmod -R nginx:nginx /var/www/pterodactyl

systemctl start nginx
systemctl enable nginx
systemctl enable php-fpm
systemctl start php-fpm

# your panel is now accessible at my.host.name

# install daemon dependencies
yum install -y make gcc gcc-c++ python device-mapper-persistent-data lvm2
yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo
yum install -y docker-ce
systemctl enable docker
systemctl start docker

curl --silent --location https://rpm.nodesource.com/setup_10.x | bash -
yum install -y nodejs

# add daemon firewall rules
firewall-cmd --add-port 8080/tcp --permanent
firewall-cmd --add-port 2022/tcp --permanent
firewall-cmd --permanent --zone=trusted --change-interface=docker0
firewall-cmd --reload

# install daemon software
mkdir -p /srv/daemon /srv/daemon-data
cd /srv/daemon
git clone https://github.com/pterodactyl/daemon.git .
npm install --only=production

# generate core.json from pterodactyl panel

vim /etc/systemd/system/wings.service
# copy start script into this file
systemctl enable wings
systemctl start wings

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment