Pterodactyl Panel

Installation of the game panel manager, Pterodactyl. This installation covers a local installation, without opening the panel to WAN. Utilizes internal DNS and reverse proxy.

Installation of VM

The server is running Ubuntu 22.04.2

Proxmox Configuration (Standard Ubuntu Server install)

image.png

image.png

Installation of Panel

Documentation taken from official docs

At the time, version of Panel is 1.11

DNS and Reverse Proxy

Create a local DNS entry for the panel, in my case I'm using pfSense

image.png

Create an entry in the internal reverse proxy, in my case I'm using Nginx Proxy Manager

image.png

image.png

image.png

proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
proxy_buffering off;
proxy_request_buffering off;

Installation of Dependencies

# Add "add-apt-repository" command
apt -y install software-properties-common curl apt-transport-https ca-certificates gnupg

# Add additional repositories for PHP, Redis, and MariaDB
LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php

# Add Redis official APT repository
curl -fsSL https://packages.redis.io/gpg | sudo gpg --dearmor -o /usr/share/keyrings/redis-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/redis-archive-keyring.gpg] https://packages.redis.io/deb $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/redis.list

# Update repositories list
apt update

# Install Dependencies
apt -y install php8.1 php8.1-{common,cli,gd,mysql,mbstring,bcmath,xml,fpm,curl,zip} mariadb-server nginx tar unzip git redis-server

# Install Composer for PHP
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Downloading Files

# Creating the directories
mkdir -p /var/www/pterodactyl
cd /var/www/pterodactyl

# Pulling the file
curl -Lo panel.tar.gz https://github.com/pterodactyl/panel/releases/latest/download/panel.tar.gz
tar -xzvf panel.tar.gz
chmod -R 755 storage/* bootstrap/cache/

Setting up MySQL

# Run as root user, default installation should have no password
mysql -u root -p
CREATE USER 'pterodactyl'@'127.0.0.1' IDENTIFIED BY 'yourPassword';
CREATE DATABASE panel;
GRANT ALL PRIVILEGES ON panel.* TO 'pterodactyl'@'127.0.0.1' WITH GRANT OPTION;
exit

Installation of Panel

cp .env.example .env
composer install --no-dev --optimize-autoloader

# Only run the command below if you are installing this Panel for
# the first time and do not have any Pterodactyl Panel data in the database.
# After generation, save the APP_KEY in the .env file
php artisan key:generate --force
php artisan p:environment:setup
php artisan p:environment:database
php artisan p:environment:mail

When setting up the environment, use the MySQL server and redis server when asked. Also setup the smtp settings to your smtp server.

php artisan migrate --seed --force
php artisan p:user:make

Set permissions

chown -R www-data:www-data /var/www/pterodactyl/*

Crontab

# Edit crontab
sudo crontab -e
* * * * * php /var/www/pterodactyl/artisan schedule:run >> /dev/null 2>&1

Queue worker

Create the fileĀ pteroq.service inĀ /etc/systemd/system with the follow content:

# Pterodactyl Queue Worker File
# ----------------------------------

[Unit]
Description=Pterodactyl Queue Worker
After=redis-server.service

[Service]
# On some systems the user and group might be different.
# Some systems use `apache` or `nginx` as the user and group.
User=www-data
Group=www-data
Restart=always
ExecStart=/usr/bin/php /var/www/pterodactyl/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3
StartLimitInterval=180
StartLimitBurst=30
RestartSec=5s

[Install]
WantedBy=multi-user.target

Starting the services

sudo systemctl enable --now redis-server
sudo systemctl enable --now pteroq.service

Webserver Configuration

Since we are using a reverse proxy, we don't need SSL on the webserver.

# remove the default site
rm /etc/nginx/sites-enabled/default

Create the file pterodactyl.conf inĀ /etc/nginx/sites-available

The <domain> should be a FQDN

server {
    # Replace the example <domain> with your domain name or IP address
    listen 80;
    server_name <domain>;


    root /var/www/pterodactyl/public;
    index index.html index.htm index.php;
    charset utf-8;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location = /favicon.ico { access_log off; log_not_found off; }
    location = /robots.txt  { access_log off; log_not_found off; }

    access_log off;
    error_log  /var/log/nginx/pterodactyl.app-error.log error;

    # allow larger file uploads and longer script runtimes
    client_max_body_size 100m;
    client_body_timeout 120s;

    sendfile off;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/run/php/php8.1-fpm.sock;
        fastcgi_index index.php;
        include fastcgi_params;
        fastcgi_param PHP_VALUE "upload_max_filesize = 100M \n post_max_size=100M";
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param HTTP_PROXY "";
        fastcgi_intercept_errors off;
        fastcgi_buffer_size 16k;
        fastcgi_buffers 4 16k;
        fastcgi_connect_timeout 300;
        fastcgi_send_timeout 300;
        fastcgi_read_timeout 300;
    }

    location ~ /\.ht {
        deny all;
    }
}

Installation of Wings

Documentation taken from official docs

At the time, version of Wings is 1.11

Installation of Docker

curl -sSL https://get.docker.com/ | CHANNEL=stable bash
sudo systemctl enable --now docker

Ā 

DNS

Create a local DNS entry for the panel, in my case I'm using pfSense

image.png

Ā 

Installation of Wings

sudo mkdir -p /etc/pterodactyl
curl -L -o /usr/local/bin/wings "https://github.com/pterodactyl/wings/releases/latest/download/wings_linux_$([[ "$(uname -m)" == "x86_64" ]] && echo "amd64" || echo "arm64")"
sudo chmod u+x /usr/local/bin/wings

Ā 

Create a new node

image.png

Copy the configuration file generated and paste in /etc/pterodactyl/config.yml

# THIS IS AN EXAMPLE
debug: false
uuid: aaa
token_id: aaa
token: aaa
api:
  host: 0.0.0.0
  port: 8080
  ssl:
    enabled: true
    cert: /etc/letsencrypt/live/aaa/fullchain.pem
    key: /etc/letsencrypt/live/aaa/privkey.pem
  upload_limit: 100
system:
  data: /var/lib/pterodactyl/volumes
  sftp:
    bind_port: 2022
allowed_mounts: []
remote: 'https://panel.example.com'

You will need to generate a SSL certificate for the FQDN of your Wings Node. After generating the cert, make sure to place it where the configuration file expects it to be. In the example it would be in the folder /etc/letsencrypt/live/aaa/

Run Wings

sudo wings --debug

Daemonizing Wings

Create the fileĀ wings.service inĀ /etc/systemd/system

[Unit]
Description=Pterodactyl Wings Daemon
After=docker.service
Requires=docker.service
PartOf=docker.service

[Service]
User=root
WorkingDirectory=/etc/pterodactyl
LimitNOFILE=4096
PIDFile=/var/run/wings/daemon.pid
ExecStart=/usr/local/bin/wings
Restart=on-failure
StartLimitInterval=180
StartLimitBurst=30
RestartSec=5s

[Install]
WantedBy=multi-user.target
systemctl enable --now wings