Introduction
Pterodactyl is a free to use control panel for managing your game hosting services. In this tutorial we will be explaining how to install and configure Pterodactyl for Ubuntu 20.04.

Please note, this will be a slightly longer article than usual, however if you follow the steps correctly you will be on your way to start self-hosting your own game servers.
This article is based of Pterodactly's own tutorial. Please view more here: https://pterodactyl.io/panel/1.0/getting_started.html

System Requirements
This tutorial is designed for Ubuntu 20.04, however it should still work for Ubuntu 18.04. If you are using CentOS or another operating system, this tutorial will not work. Additionally, we design these tutorials to be compatible with Slashy Hosting VPS', therefore it may not work the same way if you're using a third-party provider due to different virtualisation types. Switch to Slashy Hosting today and get 33% off your order using code 33OFF at checkout: https://slashy.host/vps

Before you begin, please make sure that you have a clean server install, and login via SSH. If you do not know how to login via SSH, please follow the tutorial here: How to connect to a VPS

Dependencies
In this section we will install the packages required for Pterodactyl to run.
Enter the following command: sudo apt install software-properties-common curl apt-transport-https ca-certificates gnupg. You will be prompted to answer either Y/n, simply type Y and click enter.
Next, add the necessary repositories using the 3 commands
LC_ALL=C.UTF-8 add-apt-repository -y ppa:ondrej/php
add-apt-repository -y ppa:chris-lea/redis-server
curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | sudo bash

Now you want to update your repositories by running the command sudo apt update
Install the universe repository using the command apt-add-repository universe
Now, you want to install all required dependencies using the command: sudo apt -y install php8.0 php8.0-{cli,gd,mysql,pdo,mbstring,tokenizer,bcmath,xml,fpm,curl,zip} mariadb-server nginx tar unzip git redis-server

Installation of Composer
To install composer, run the command: curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Downloading Pterodactyl
Now that the dependencies have been installed, start the installation of Pterodactyl by following the steps below.
Create the directory for pterodactyl to be installed by running: sudo mkdir -p /var/www/pterodactyl
Move your SSH session to the new directory by running: cd /var/www/pterodactyl
Download the Pterodactyl files by running curl -Lo panel.tar.gz https://github.com/pterodactyl/panel/releases/latest/download/panel.tar.gz
By default, the files will be compressed so you need to uncompress the files by running: tar -xzvf panel.tar.gz
Change the permissions of some pterodactyl directories by using chmod -R 755 storage/* bootstrap/cache/

Configuring MySQL
Now that the files have been downloaded, you will need to configure a database environment for Pterodactyl to run. You can do this by following the steps in this section
Create an SQL session by running the command mysql -u root -p. This may prompt you for a password, however you can enter anything due to no password being set
Now, you want to create a new SQL user. For the purpose of this tutorial, we will be creating a user called pterodactyl and setting the password to 3xamp13Pa55w0rd. You can modify this command to use a more secure password as recommended: CREATE USER 'pterodactyl'@'127.0.0.1' IDENTIFIED BY '3xamp13Pa55w0rd';
Next, we want to create the database for our panel. We will be using the database name of panel for this tutorial. `CREATE DATABASE panel`;
Now we need to grant privileges to our pterodactyl user to access and control the panel database. GRANT ALL PRIVILEGES ON panel.* TO 'pterodactyl'@'127.0.0.1' WITH GRANT OPTION;
Commands used in this section
Finally exit the MySQL session by typing exit;, and you will be greeted with a message to confirm your exit "Bye"

Installation of Pterodactyl
We are now ready to start the configuration and installation of Pterodactyl.
Copy your example environment configuration file to your live file using cp .env.example .env
Install core dependencies by running: composer install --no-dev --optimize-autoloader
It will prompt you to continue as root/super user. Type yes and click enter
Generate an application encryption key by using php artisan key:generate --force

Environment Setup
Run php artisan p:environment:setup to start the environment setup. It will ask you for some prompts
Egg Author Email - You can enter your email here
Application URL - Enter the domain that you will be using here, if you're not using a domain enter your VPS IP in the format of http://(IP HERE) For example, http://192.168.1.0
Timezone - Select your timezone from https://php.net/manual/en/timezones.php and enter it here
Cache Driver - Select file
Session Driver - Select MySQL Database
Queue Driver - Select MySQL Database
Enable UI based settings editor - Select yes
Run php artisan p:environment:database to configure your database
Leave Database Host as the default 127.0.0.1
Leave Database Port to 3306
Database name will be the same name that you created your database as during the MySQL installation phase. By default it's panel
Database username will be the same username that you used to create your MySQL user. By default it is pterodactyl
Database password - Enter the password used to create the database user. For example purposes, we used 3xamp13Pa55w0rd
Run php artisan p:environment:mail to configure mail sending (We will be using php mail for this section)
For driver, select mail
Email address emails should originate from - Enter your desired email address here
Name that emails should appear from - You can enter anything here
Encryption method - None
You can install all the required data for your panel using the command php artisan migrate --seed --force, this may take a while

Creating Pterodactyl user
Now you are ready to create your first Pterodactyl user.
Run php artisan p:user:make
Is this user an administrator? - Select yes
Email Address - Enter your email address here
Username - Enter your desired username here
First Name - Enter your first name here
Last Name - Enter your last name here
Password - Enter your desired password here

Permission cleanup
Run the following command to grant the web server ownership of the pterodactyl panel chown -R www-data:www-data /var/www/pterodactyl/*

Crontab Setup
The crontab is a vital part of a website running automated tasks on its own. In this section we will be installing the Pterodactyl crontab
Setup your crontab by running crontab -e, you will be prompted to select an editor, we recommend 1. /bin/nano
Go to the end of your script and create a new line. Next, paste the following line into the file * * * * * php /var/www/pterodactyl/artisan schedule:run >> /dev/null 2>&1
Once done, hit Ctrl + X on your keyboard to exit the file, then type y and click enter when it prompts you to save

Queue Workers
Queue workers allow pterodactyl to run in the background, and to automatically start if your server goes offline.
Enter the command nano /etc/systemd/system/pteroq.service
Paste in the script below to the file, and as you did in the Crontab setup section, exit and save the file
# 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

Enable your services by running sudo systemctl enable --now redis-server and sudo systemctl enable --now pteroq.service

Webserver Configuration
Run the command nano /etc/nginx/sites-available/pterodactyl.conf to create a new web server config. Now you want to paste the script below like you did in the section above, and replace <domain> with the URL that you specified whilst doing the environment configuration earlier. We used http://192.168.1.0 as an example, however make sure you remove the http:// before the domain/ip.
server {
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.0-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;
}
}

Enable your configuration by running sudo ln -s /etc/nginx/sites-available/pterodactyl.conf /etc/nginx/sites-enabled/pterodactyl.conf
Delete the default nginx config by running rm /etc/nginx/sites-enabled/default
Restart your web server so the changes take effect systemctl restart nginx
As a test, you should now be able to access your panel URL via your browser.

Wings: Installing Docker
Install docker by running the command curl -sSL https://get.docker.com/ | CHANNEL=stable bash
Start docker by default on a system reboot by running systemctl enable --now docker

Wings: Installation of Wings
Run mkdir -p /etc/pterodactyl to create a directory for wings to live
Download the wings file by running curl -L -o /usr/local/bin/wings https://github.com/pterodactyl/wings/releases/latest/download/wings_linux_amd64
Change the permission of the wings file by running chmod u+x /usr/local/bin/wings
Login to your Pterodactyl Panel via your browser, and navigate to the Admin Icon on the top navigation bar

Click the Locations tab on the sidebar, and then click "Create New"
Enter your desired information in here. We will use slashy.ca for this tutorial and leave Description blank.
Submit the location
From the sidebar, select Nodes
Click the "Create New" button
Call your node whatever you wish. We will use slashy-node-1 for this tutorial
For "Communicate over SSL" set this to use HTTP Connection
Specify the total memory on your server in MB (1GB = 1024MB)
Specify the total storage of your server in MB (1GB = 1024MB)
Set FQDN to your VPS IP Address
Set Memory over allocation to the amount you want to overcommit by. We recommend 0%
Set Disk space over allocation to the amount you want to overcommit by. We recommend 0%

You will now be taken to the Node Details page. Go to the configuration tab and copy the configuration file text.
Back on your VPS enter the command nano /etc/pterodactyl/config.yml and paste the configuration in that file before saving and existing it
Check wings works by running sudo wings --debug. You can then click Ctrl + C to exit the session

Wings: systemd
Enter the command nano /etc/systemd/system/wings.service
Paste the script below into this file before saving and exiting
[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

Enable the wings service to reboot on a server restart using the command systemctl enable --now wings

IP Allocations
Head over to the Allocation tab on your Pterodactyl Web Panel
Under "Assign new allocations" enter the IP address of your node, followed by the ports that you would like to use for servers. We recommend using port 25565
Submit the form

Conclusion
There we have it, you have now installed Pterodactyl ready for you to add new servers to the panel.

We hope that this tutorial helped you out! As always, leave us a thumbs up below if this solved your problem.
Was this article helpful?
Cancel
Thank you!