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 with CentOS 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
EDIT (6. Dec 2020): Updated for Pterodactyl v1.1.1; Use –user SystemD
Contents
Web host/Plesk configuration
WARNING: According to Pterodactyl MySQL 5 should still work, however I run into issues. You need MINIMUM MariaDB 10.2 (10.1 is too old, too). If mysql --version
reports not 10.2 or higher, you will have to use this tutorial to upgrade your database.
Read very carefully. Especially if you are not that experienced with Linux. Don’t copy-paste multiple lines into the console; and think about what you are doing. I use CentOS 7/8 for this tutorial, but it can be easily applied to Ubuntu by simply googling the respective commands. If you are not comfortable with this, you probably should not try to use this panel.
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 7 for Redis):
# for CentOS 7 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.
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. Also remember the username (gamepanel in this case), you will have to SU into it later.
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.
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; }
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. Don’t forget to check “Allow remote connections”.
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:
# Set this to the version you want to install. Look into the docs (see link at the beginning of this post) PTEROVERSION=v1.1.1 cd httpdocs # Delete old Plesk default index files rm ./public/index.html ./index.html curl -Lo panel.tar.gz https://github.com/pterodactyl/panel/releases/download/$PTEROVERSION/panel.tar.gz tar xzvf panel.tar.gz # Correct permissions of caches chmod -R u+w storage/* chmod -R u+w bootstrap/cache # Correct permissions of all files # folders find . -type d -exec chmod g+rx {} + find . -type d -exec chmod o+rx {} + # files find . -type f -exec chmod g+r {} + find . -type f -exec chmod o+r {} +
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 recommended 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 # Choose redis there $PHP7 artisan p:environment:setup # Insert the database credentials you created in plesk $PHP7 artisan p:environment:database # Choosing SMTP with localhost should work automatically then $PHP7 artisan p:environment:mail $PHP7 artisan migrate --seed --force # Create admin user $PHP7 artisan p:user:make
You don’t need to set the user for permissions, as we didn’t work with root.
The panel should be available, you can try by going to your panels website.
Troubleshooting: If the panel is not available
If you’re just getting a white page, or a error 500, do a ls -l
and make sure, that the files are owned by the user you set (e.g. gamepanel) and have the group psacln. Then make sure that files can be read by everyone (e.g. -rw-r–r–.) and folders can be accessed by everyone (e.g. drwxr-xr-x.); this seems to be a requirement by Plesk. Don’t do a chmod 777!
If there are still issues, look into the folder logs in the home directory of the user. E.g. cd && cd logs
then look into the file error_log and especially into the file proxy_error_log
Setting up workers
Go back to Plesk and select your panel domain. Go to Scheduled Tasks (on the right side) and click on Add Task. Choose Script Path and use as file httpdocs/artisan and with arguments schedule:run
Under Run select Cron Style and type in * * * * *
.
The following Screenshot shows the old method with Run a Command (which is fine too).
Click on Run Now to test it. Click then on OK.
Setting up SystemD unit
Make sure, that you are still inside SSH. If you’re still in the user, go back to root by typing exit
.
As root, enable systemd of your user:
# Replace with the name of your gamepanel ssh user BASHUSER=gamepanel loginctl enable-linger $BASHUSER # now go back to the user su $BASHUSER cd # go to home # Set User ENV for systemd echo XDG_RUNTIME_DIR=/run/user/$(id -ru) > .bashrc source .bashrc # This command now should return running systemctl --user status
If the last command was successful, you can proceed.
If it is NOT successful, then there is a problem enabling SystemD for your user. In this case, you can create a system-wide daemon: https://pterodactyl.io/panel/1.0/getting_started.html#create-queue-worker. There you would have to use for user the user you created in plesk (e.g. gamepanel), for group use pscln and you would have to replace /usr/bin/php with the php path as done before in this tutorial. The path to artisan must be of course replaced, too.
You must now still be inside the gamepanel bash user. Create a systemd user file:
mkdir -p .config/systemd/user touch .config/systemd/user/pteroq.service
Into this file .config/systemd/user/pteroq.service insert following:
[Unit] Description=Pterodactyl Queue Worker User [Service] Restart=always ExecStart=/opt/plesk/php/7.4/bin/php %h/httpdocs/artisan queue:work --queue=high,standard,low --sleep=3 --tries=3 [Install] WantedBy=default.target
Now start and enable the service with the following command:
systemctl daemon-reload --user systemctl enable --now pteroq.service --user
Now typing in systemctl status pteroq.service --user
should return that it is running successfully.
Installing the Daemon
Proceed to the Wings 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
Hey there! Thank you for this helpful tutorial.
I followed your instructions and then I tried to call the website, but I get a 403 (1338 directory index of … is forbidden).
First I thought the nginx commands were not saved, but they are.
One thing is not clear to me – the nginx commands contain “index index.php;” – but there is no index-file in the installation folder of pterodactyl? Maybe this causes the 403?
Found the solution. My bad. 😉
I just forgot to set the folder in plesk to “/public”. So all works fine!
How can we update when a new version comes out?
Simply repeat the chapter “Download and Configuration” but stop AFTER run composer install.
Then do
$PHP7 php artisan view:clear
$PHP7 artisan config:clear
$PHP7 artisan migrate –seed –force
I tried with ubuntu 18.04. pterodactyl v1.6.3. not worked
error is : No application encryption key has been specified.
edit: Panel 1.6.x wings 1.5.x has auto update
https://pterodactyl.io/panel/1.0/updating.html
Hey there great work on keeping this updated. I am having a port binding issue maybe you could help me with. I do have the daemon on the same server. I have tried changing the ports to unused ones then get a binding error in the browser console. Any ideas would be great.
Thanks.
hi when i try this shows me 403 forbidden 🙁
Hey, the onstallation complete sucessfull but if i open my Petrodactyl Domain, i see only the Plesk default page.
You either did not set the document root, or you didn’t turn off Proxy Mode.
what is your new discord?
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 😉
I think you still have an older mariadb version (5.5). However as far as I know you need at least 10 for JSON support.
Update the whole Plesk panel to the latest version (Plesk Obsidian), it supports MariaDB 10.3.
I think you have to upgrade then the db manually, there are some kb articles about it for Plesk. (https://support.plesk.com/hc/en-us/articles/213403429-How-to-upgrade-MySQL-5-5-to-5-6-5-7-or-MariaDB-5-5-to-10-0-10-1-10-2-on-Linux-)
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?
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).
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 😀
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
yes, that’s right.
I was on a run while typing that comment while pressing on post comment I realized that 😀
Why do you disable Apache proxy mode?
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.
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
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.
Hi, I really appreciate that someone makes a guide like this 😀
Hope you keep updating it when the new versions come out!
Pingback: Updating Pterodactyl from v0.6 to v0.7 with a Plesk installation | Denis' Blog