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.

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

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 redisplesk installer --select-release-current --install-component php7.2
yum install plesk-php72-redis plesk-php72-cli plesk-php72-bcmath plesk-php72-gd plesk-php72-mbstring plesk-php72-mysql plesk-php72-pdo plesk-php72-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.

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. Save and go to Hosting Settings and set the document root to httpdocs/public and change PHP Support to 7.2 and run as FPM application served by nginx. Save again and 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;
}

You should now create a new database for the panel in the Databases menu. 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. 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.2/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 https://github.com/pterodactyl/panel/releases/download/v0.7.13/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 7.2 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.2/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 * * * * *.

You can now type exit into the console (to log out of your user and get back to root) and proceed to Creating Queue Worker in the official wiki. Make sure to set User to the one with whom you SUd into and for Group choose psacln. Also make sure to set ExecStart this way:

ExecStart=/opt/plesk/php/7.2/bin/php /var/www/vhosts/YOURGAMEPANELDOMAIN/httpdocs/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3

Installing the Daemon

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

Update 7. Feb 2018: Fixed error while calling composer thanks to samyratchet

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

4 thoughts on “Installing Pterodactyl for Plesk”

  1. 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.

  2. 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.