Installing Pterodactyl for Plesk

Pterodactyl is a software for managing game servers. As it’s still in development, installing it in some environments is not straight-forward. You should read the official docs along. The guide is written for Plesk but could be helpful for other panel users like cPanel too.

Originally published 9. Sep 2017
EDIT (7. Feb 2018): Fixed error thanks to samyratchet
EDIT (15. Mar 2018): Updated for Pterodactyl v0.7.6
EDIT (28. Jun 2018): Updated for Pterodactyl v0.7.7
EDIT (06. Mar 2019): Updated for Pterodactyl v0.7.13
EDIT (11. May 2020): Updated for Pterodactyl v0.7.17; Added screenshots

Web host/Plesk configuration

Log into to your SSH console (we start with root) and install the Redis and PHP packages. Here are the commands for CentOS (the epel repository is a requirement on CentOS for Redis):

yum install epel-release
yum update
yum install redis
plesk installer --select-release-current --install-component php7.4
yum install plesk-php74-redis plesk-php74-cli plesk-php74-bcmath plesk-php74-gd plesk-php74-mbstring plesk-php74-mysql plesk-php74-pdo plesk-php74-xml

Start redis and enable autostart:

systemctl start redis
systemctl enable redis

Log into Plesk, go to Domain -> Add Domain (even if you use a subdomain like panel.example.com, click on Add Domain and not on Add Subdomain. This way you can separate the installation of your main homepage). Type in the full URL of which it will be reached later and make sure to click on Secure the domain with Let’s Encrypt. Remember the username and click on save.

Add Domain (click to enlarge)

Now we will have to modify some settings on the domain. Go to Web Hosting Access and change Access to the server over SSH to /bin/bash.

Web Hosting Access

Go to Hosting Settings and set the document root to httpdocs/public and change PHP Support to 7.4 and run as FPM application served by nginx.

Hosting settings

Go to Apache & Nginx Settings, turn off Proxy Mode and write into additional NGINX directives:

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

location ~ / {
	try_files $uri $uri/ /index.php?$query_string;
}
Apache & nginx settings

You should now create a new database for the panel in the Databases menu (Domain -> Databases (in the menu on the right side) -> Add Database). And remember its configuration.

Installing Pterodactyl

For security reasons and simply because we don’t want to get any permission problems later, we won’t work with root.

(It’s also a little paradox that the official wiki goes through the installation with root, as the Panel advertises with its security. Working with root, especially for beginners, is never safe).

Download and Configuration

While creating your domain/webspace you had to provide a user and a password. SU into that user with su yourusernameforvhost (I named it gamepanel in the screenshots). And simply type cd to get to the home directory.

Create a temporary alias for the PHP-command (you will have to do this each time, you open a ssh session or SU into an user):
PHP7=/opt/plesk/php/7.4/bin/php

Install composer locally into the vhost by typing:

curl -sS https://getcomposer.org/installer | $PHP7 -- --install-dir=. --filename=composer

Download and extract Pterodactyl and set permissions:

cd httpdocs
curl -Lo panel.tar.gz curl -Lo panel.tar.gz https://github.com/pterodactyl/panel/releases/download/v0.7.17/panel.tar.gz
tar --strip-components=1 -xzvf panel.tar.gz

chmod -R u+w storage/*
chmod -R u+w bootstrap/cache

Run composer:

cp .env.example .env
$PHP7 ../composer install --no-dev --optimize-autoloader

Run the configuration commands as stated in the wiki, but with the Plesk PHP installation. When asked for a database backend, use always the default one (Redis / MariaDB). And when asked for MariaDB user credentials, insert the ones you used while creating the database with Plesk:

# Run the first command only, when doing a new installation (not an upgrade)
$PHP7 artisan key:generate --force
$PHP7 artisan p:environment:setup
$PHP7 artisan p:environment:database
$PHP7 artisan p:environment:mail
$PHP7 artisan migrate --seed
$PHP7 artisan p:user:make

You don’t need to correct the permissions, as we didn’t work with root.

The panel should be available, you can try by going to your panels website.

Setting up workers

Go back to Plesk and select your panel domain. Go to Scheduled Tasks and click on Add Task. Choose Run a command and type into Command:

/opt/plesk/php/7.4/bin/php /var/www/vhosts/YOURPANELDOMAIN/httpdocs/artisan schedule:run >> /dev/null 2>&1

Don’t forget to replace YOURPANELDOMAIN with your domain. Under Run select Cron Style and type in * * * * *.

Scheduled Tasks

You can now type exit into the console (to log out of your user and get back to root).

As root in SSH, create a new file pteroq.service in /etc/systemd/system

Make sure to set User to the one with whom you SUd into and for Group choose psacln. Also make sure to set ExecStart to the correct path.

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

[Unit]
Description=Pterodactyl Queue Worker
# REPLACE with redis-server.service IF _not_ on CentOS
After=redis.service

[Service]
# REPLACE user with the SSH user of your webspace as specified in Web Hosting Access in plesk
User=gamepanel
Group=psacln
Restart=always
# ADJUST the path to your webspace directory
ExecStart=/opt/plesk/php/7.4/bin/php /var/www/vhosts/GAMES.YOURDOMAIN/httpdocs/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3

[Install]
WantedBy=multi-user.target

Now start the service with the following command:

systemctl enable --now pteroq.service

Installing the Daemon

Proceed to the Daemon Docs. I don’t recommend installing the daemon on the same (v)server where Plesk is installed!

When you found an error in my documentation write a comment. You can also write me on Discord: Sapd#4930

16 thoughts on “Installing Pterodactyl for Plesk”

  1. Hey, the onstallation complete sucessfull but if i open my Petrodactyl Domain, i see only the Plesk default page.

  2. Hi Denis,

    i do it like your how to but try to install the latest version 1.0.0 Beta Release 2. But i get some strange error. After artisan migrate command the tables were created but in the end i get this error.

    SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the
    manual that corresponds to your MariaDB server version for the right syntax to use near ‘json null aft
    er `server_id`’ at line 1 (SQL: alter table `subusers` add `permissions` json null after `server_id`)

    MariaDB: mysql Ver 15.1 Distrib 5.5.65-MariaDB, for Linux (x86_64) using readline 5.1
    Actual Plesk Version also

    i hope you have an idea 😉

  3. Really nice guide, but I’ve been pulling my hair out since last year because for some reason NGINX decides that it won’t load common file extensions (txt, png, jpeg, etc), even though I have the directives set correctly. Any ideas?

    1. Some directive is wrong.
      Open up ptero, open the browser console -> network -> Reload the site. Then see if the resources are 404 errors or 500.
      If 500, check the logs, if 404 make sure the location directives are correct (you can also take a look in the logs, it will point to where it searches for the file usually).

  4. hey in the beginning code you have an error, that confused the shit out of me 😀
    yum install redisplesk installer –select-release-current –install-component php7.2
    there is no space between redis and plesk 😀

    1. Oh yeah, you’re right I fixed it, thank you.

      But it’s not a white space missing, but a new line, so these are two separate commands:
      yum install redis
      plesk installer –select-release-current –install-component php7.2

    1. I just preferred nginx only in this case.
      With proxy mode it works like this:
      User request <-> nginx <-> apache

      It should theoretically work with proxy mode on too, you would have to leave “Additional nginx directives” empty then.

  5. so i am using a physical server with plesk and would like to install dameon on it can i just install docker through my panel as it gives me that option

    1. I would install Docker by hand. I am not sure how the docker option in the panel works, I guess it is specially designed for hosting. Installing by hand (package manager) has no disadvantages.

      It’s btw better when you partition the physical server into vservers (e.g. with Proxmox) and run Plesk and the gameservers on two different vservers.

  6. Pingback: Updating Pterodactyl from v0.6 to v0.7 with a Plesk installation | Denis' Blog

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.