Add Automatic phpMyAdmin for Pterodactyl

Arnaud Lier 2024-03-30 13:38:03 +00:00
parent 5433569f42
commit 25f693d8fc

@ -0,0 +1,96 @@
# 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:
- [Pterodactyl 1.X.X](https://pterodactyl.io/project/introduction.html)
- [Database Hosts](https://www.youtube.com/watch?v=C7Xo7WvHTYk)
- [phpMyAdmin 5.2.1](https://github.com/AktiCube/themes-and-addons-documentation/wiki/Installation-(phpMyAdmin))
Please note that if you get a problem during a step, feel free to join our [Discord](https://discord.gg/RJ2A8yYS2m) 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 :
### Ubuntu and Debian :
```bash
curl -sL https://deb.nodesource.com/setup_16.x | sudo -E bash -
apt install -y nodejs
```
### CentOS 7 :
```bash
curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash -
sudo yum install -y nodejs yarn
```
### CentOS 8 :
```bash
curl -sL https://rpm.nodesource.com/setup_16.x | sudo -E bash -
sudo dnf install -y nodejs yarn
```
## Installing dependencies
In your SSH terminal, run these commands :
```bash
npm i -g yarn
cd /var/www/pterodactyl
yarn install
```
## Installing the addon
Follow the PanelEdit_EN.txt or the PanelEdit_FR.txt 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 :
```PHP
$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:
```PHP
$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 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 theses [here](https://github.com/AktiCube/themes-and-addons-documentation/wiki/Q&A-(Automatic-phpMyAdmin)#q-how-to-generate-an-encryption-key-and-iv--)).
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](https://github.com/AktiCube/themes-and-addons-documentation/wiki/Q&A-(Automatic-phpMyAdmin)#q-why-should-i-put-a--at-the-beginning-of-my-domain-name-when-my-pterodactyl-and-phpmyadmin-installation-are-on-a-different-subdomain)).
# 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. 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](https://github.com/AktiCube/themes-and-addons-documentation/wiki/Q&A-(Automatic-phpMyAdmin)#q-how-can-i-connect-with-the-basic-interface-of-phpmyadmin-), 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. You can use it perfectly.