Pterodactyl Panel & Wings

Tutorial about the installation of Pterodactyl Panel & Wings.
June 27, 2022 Translations: 

(German YouTube video showcasing the process)


For lazy people (inofficial script):

bash <(curl -s https://pterodactyl-installer.se)

Installing the panel

Official documentation: https://pterodactyl.io/project/introduction.html

Install dependencies

sudo apt update -y
sudo apt install ca-certificates apt-transport-https software-properties-common gnupg curl -y
wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -
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
sudo apt update -y && sudo apt upgrade -y
apt -y install php8.1 php8.1-{cli,gd,mysql,pdo,mbstring,tokenizer,bcmath,xml,fpm,curl,zip} mariadb-server redis-server nginx tar unzip git
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Install the panel

mkdir -p /var/www/pterodactyl
cd /var/www/pterodactyl
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/
sudo mariadb

Configure MariaDB

CREATE USER 'pterodactyl'@'localhost' IDENTIFIED BY 'PASSWORT';
CREATE DATABASE panel;
GRANT ALL PRIVILEGES ON panel.* TO 'pterodactyl'@'localhost' WITH GRANT OPTION;
exit

Configure the panel

cp .env.example .env
TRUSTED_PROXIES='<ip_reverse_proxy>'
composer install --no-dev --optimize-autoloader
php artisan key:generate
php artisan p:environment:setup
php artisan p:environment:database
php artisan p:environment:mail
php artisan migrate --seed
php artisan p:user:make

These commands make changes to the .env file. With key:generate, a encrytion key is added which is used to encrypt the panel’s data. Be sure to back this file up (e.g. store it in a password manager) to prevent data loss.

Modify the file permissions

The pterodactyl files have to be owned by the www-data user and group.

Create cronjob

A cronjob has to be created in order for scheduled tasks (e.g. updates) to work.

Edit the crontab:

crontab -e

In the editor, add the following cronjob to the end of the file:

* * * * * php /var/www/pterodactyl/artisan schedule:run >> /dev/null 2>&1

Create a systemd service

For the queue worker of the panel, a systemd service has to be created.

nano /etc/systemd/system/pteroq.service
[Unit]
Description=Pterodactyl Queue Worker
After=redis-server.service

[Service]
User=www-data
Group=www-data
Restart=always
ExecStart=/usr/bin/php /var/www/pterodactyl/artisan queue:work -queue=high,standard,low --sleep=3 --tries=3
StartLimitInterval=180
StartLimitBurst=30
RestartSec=5s

[Install]
WantedBy=multi-user.target

Start the services

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

Create an NGINX configuration

This configuration is an example without TLS. You should always use TLS in a production environment. This can be achieved with the use of a reverse proxy.

Disable default site

rm /etc/nginx/sites-enabled/default

Create a site for Pterodactyl

nano /etc/nginx/sites-available/pterodactyl.conf
server {

    listen 80;
    server_name example.com;


    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.3-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;
    }
}
ln -s /etc/nginx/sites-available/pterodactyl.conf /etc/nginx/sites-enabled/pterodactyl.conf

Restart NGINX

systemctl restart nginx

Install Wings

Install Docker

Docker kann entweder schnell über den folgenden Befehl installiert werden, aber sollte in Produktivumgebungen nach den Vorgaben in der offiziellen Docker-Dokumentation installiert werden.

Docker can be installed with the quick installation command shown below. This method is not recommended for production use, and you should refer to the official Docker installation documentation.

curl -sSL https://get.docker.com/ | CHANNEL=stable bash

Enable Docker service

systemctl enable --now docker

Starting with kernel version 5.8, this configuration is the default; thus this section can be skipped. This example uses GRUB. The same configuration to the kernel commandline applies to other bootloaders e.g. systemd-boot.

nano /etc/default/grub

Modify the variable GRUB_CMDLINE_LINUX_DEFAULT:

GRUB_CMDLINE_LINUX_DEFAULT="swapaccount=1"

Download and install Wings

Create a directory for Wings

mkdir -p /etc/pterodactyl

Download the Wings executable

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")"

Add execution permissions to the executable

chmod u+x /usr/local/bin/wings

Configure Wings

There are two ways of configuring Wings:

  1. Automatic configuration via the command shown in the Pterodactyl web ui
  2. Manually through the config file at /etc/pterodactyl/config.yml

Create and start Wings service

Create service

nano /etc/systemd/system/wings.service

Insert service configuration:

[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

Start the service

systemctl enable --now wings

Done! Now the installation and configuration of the Pterodactyl Panel & Wings should be finished.