7 Installing Automatic phpMyAdmin for Pterodactyl
Arnaud Lier edited this page 2024-06-23 12:25:02 +00:00

Prerequisites

For the sake of this tutorial, we will assume that Pterodactyl, phpMyAdmin and the database hosts are already configured and installed. If this is not the case, here are some tutorials that may help you from other sources:

Please note that if you get a problem during a step, feel free to join our Discord to open a ticket.

Checking content

In the .zip file downloaded after the purchase, and once unzipped, you will find two folders:

  • phpmyadmin : The files contained in this folder will allow the connection to phpMyAdmin
  • pterodactyl : It contains all the modifications brought to Pterodactyl

If you are missing folders, download the addon again.

Installing Pterodactyl Side

Installing Node.js and yarn

Execute these commands:

Debian, Ubuntu and derivatives

curl -sL https://deb.nodesource.com/setup_20.x | sudo -E bash -
apt install -y nodejs

CentOS 7

curl -sL https://rpm.nodesource.com/setup_20.x | sudo -E bash -
sudo yum install -y nodejs yarn

CentOS 8, Fedora, RHEL and derivatives

curl -sL https://rpm.nodesource.com/setup_20.x | sudo -E bash -
sudo dnf install -y nodejs yarn

Installing dependencies

In your SSH terminal, run these commands:

npm i -g yarn 
cd /var/www/pterodactyl
yarn install

Installing the addon

Follow the PanelEdit_EN.md or the PanelEdit_FR.md file contained in the ZIP file that you have downloaded.

Installing phpMyAdmin side

Like Pterodactyl side, upload all the files of the folder phpmyadmin of the ZIP that you have downloaded in the folder of your phpMyAdmin installation. Then, you will need to modify configuration for the host in config.inc.php by adding these lines:

$cfg['Servers'][$i]['auth_type']     = 'signon';
$cfg['Servers'][$i]['SignonSession'] = 'TokenSession';
$cfg['Servers'][$i]['SignonURL']     = 'token.php';
$cfg['Servers'][$i]['LogoutURL']     = 'token-logout.php';

A server configuration should now look like this for example:

$i++;
$cfg['Servers'][$i]['verbose']       = 'example'; 
$cfg['Servers'][$i]['connect_type']  = 'tcp';
$cfg['Servers'][$i]['host']          = 'localhost';
$cfg['Servers'][$i]['compress']      = false;
$cfg['Servers'][$i]['AllowRoot']     = false;
$cfg['Servers'][$i]['ForceSSL']      = true;
$cfg['Servers'][$i]['auth_type']     = 'signon';
$cfg['Servers'][$i]['SignonSession'] = 'TokenSession';
$cfg['Servers'][$i]['SignonURL']     = 'token.php';
$cfg['Servers'][$i]['LogoutURL']     = 'token-logout.php';

You can now edit the file token.php that you just uploaded, to fit your needs :

  1. $encryption_key (line 14) and $encryption_iv (line 16) : These variables must have the same values set in the Pterodactyl side (More information on how to generate these here).
  2. $cookie_name (line 18) : The name of the cookie to get data from, must be the same as in Pterodactyl side.
  3. $cookie_domain (line 20) : The domain of the cookie, like the cookie name, must be the same as in Pterodactyl side (More information on how to choose one here).

Configuration

Go to your admin part of your Pterodactyl Installation, then in the "Automatic phpMyAdmin" category, click on create a new installation. Choose a name and a description.

Then, for the URL, it needs to be the one of your phpMyAdmin installation. You need to include the protocol (e.g. https://phpmyadmin.example.org)!

For the cookie name, it needs to be the same as configured in the token.php file of your phpMyAdmin installation, same for the cookie_domain, the encryption_key and the encryption_iv.

When the selected Database Host is none, this phpMyAdmin installation will be used for every Database Host when clicking on the button to connect to the database. But when there is one selected, it'll be this one that will be used when connecting to a database of this host.

Finally, for the phpMyAdmin Server ID, in most cases it'll need to be set to 1. But if you are using a normal connection on phpMyAdmin like said here, you'll need to change that number to the corresponding configuration in phpMyAdmin. You can now save this installation!

The addon is now fully configured. Go to the "Databases" tab of any of your server with an active database and click the button to access your data right away!