Pterodactyl is a popular open-source game server management panel used by server administrators to manage and host game servers. It provides a user-friendly interface for controlling multiple game servers and is designed to be lightweight, secure, and flexible. Below is a detailed tutorial on how to install and configure Pterodactyl on a Linux server, particularly useful for users running AnonVM or similar VPS setups.
Pterodactyl Panel Installation Guide
This guide will walk you through the installation process for Pterodactyl, including the necessary dependencies, configuration, and setup on a fresh Linux VPS. This setup is intended for users who want to host and manage game servers for multiple games like Minecraft, ARK: Survival Evolved, CS
System Requirements
Before beginning the installation process, ensure that your server meets the following requirements:
- OS: Ubuntu 20.04 LTS or Debian 10/11
- CPU: At least 2 vCPUs
- RAM: 4 GB or more (8 GB recommended for smoother performance)
- Disk: SSD with at least 10 GB free space (more for game data)
- Internet: A stable connection with SSH access to your server
Step 1: Update Your Server
Ensure your system packages are up-to-date before starting the installation:
sudo apt update && sudo apt upgrade -y
Reboot the server if necessary:
sudo reboot
Step 2: Install Required Dependencies
You need several dependencies for Pterodactyl to function properly. Install them with the following command:
sudo apt install -y curl wget unzip git sudo software-properties-common apt-transport-https lsb-release ca-certificates
Step 3: Install Docker and Docker-Compose
Pterodactyl relies on Docker for containerizing game servers. Install Docker and Docker Compose:
- Install Docker:
sudo apt install -y docker.io
- Enable Docker to start at boot:
sudo systemctl enable docker
- Start Docker:
sudo systemctl start docker
- Install Docker Compose:
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
Check the Docker Compose installation:
docker-compose --version
Step 4: Install Dependencies for Pterodactyl Panel
- Install PHP 8.1 and required PHP extensions:
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install -y php8.1 php8.1-cli php8.1-fpm php8.1-mbstring php8.1-xml php8.1-curl php8.1-mysql php8.1-zip php8.1-bcmath php8.1-json php8.1-imagick
- Install Composer (PHP dependency manager):
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
Step 5: Download and Install Pterodactyl Panel
- Clone the Pterodactyl repository:
cd /var/www
sudo git clone https://github.com/pterodactyl/panel.git pterodactyl
- Set correct file permissions:
sudo chown -R www-data:www-data /var/www/pterodactyl
- Navigate to the Pterodactyl directory:
cd /var/www/pterodactyl
- Install the necessary PHP dependencies:
composer install --no-dev --optimize-autoloader
Step 6: Configure the Environment
- Copy the
.env.example
file to.env
:
cp .env.example .env
- Edit the
.env
file to set up your environment variables. You’ll need to configure the database settings and application URL. You can edit it usingnano
or any text editor:
nano .env
Make sure to modify:
- APP_URL: Set it to your domain (e.g.,
https://yourdomain.com
). - DB_HOST, DB_DATABASE, DB_USERNAME, DB_PASSWORD: Set up these variables based on your database configuration.
Step 7: Set Up the Database
- Install MariaDB (or MySQL):
sudo apt install mariadb-server mariadb-client
- Secure the MariaDB installation:
sudo mysql_secure_installation
- Create the Pterodactyl database and user:
sudo mysql -u root -p
Then in the MySQL shell:
CREATE DATABASE pterodactyl;
CREATE USER 'pterodactyl'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON pterodactyl.* TO 'pterodactyl'@'localhost';
FLUSH PRIVILEGES;
EXIT;
Step 8: Set Up the Pterodactyl Panel
- Run the Pterodactyl installation command to set up the database and generate the encryption keys:
php artisan key:generate
php artisan migrate --seed
- Create an admin user for the Pterodactyl Panel:
php artisan p:user:make
This will prompt you to set up your admin username, email, and password.
Step 9: Set Up Pterodactyl Daemon
The Pterodactyl panel communicates with game servers through a daemon (Wings). To install it:
- Download and install Wings:
mkdir /etc/pterodactyl
cd /etc/pterodactyl
wget https://github.com/pterodactyl/wings/releases/download/v1.6.0/wings-linux-amd64.tar.gz
tar -xzvf wings-linux-amd64.tar.gz
- Create a configuration file for Wings:
sudo nano /etc/pterodactyl/config.yml
This file will need to be configured with your panel’s information, including the API key generated in the Pterodactyl Panel.
- Run Wings:
./wings
Step 10: Configure Nginx for the Panel
- Install Nginx:
sudo apt install nginx
- Create an Nginx server block for Pterodactyl:
sudo nano /etc/nginx/sites-available/pterodactyl
Add the following configuration (adjust domain and SSL settings as necessary):
server {
listen 80;
server_name yourdomain.com;
root /var/www/pterodactyl/public;
index index.php index.html index.htm;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
- Enable the site and restart Nginx:
sudo ln -s /etc/nginx/sites-available/pterodactyl /etc/nginx/sites-enabled/
sudo nginx -t
sudo systemctl restart nginx
Step 11: Final Setup
- Access the Pterodactyl Panel via your domain (e.g.,
http://yourdomain.com
) and log in with the admin account you created. - Start adding game servers and configuring settings like resources, user permissions, and server installations.
Conclusion
You’ve successfully installed Pterodactyl on your server! You can now manage your game servers with ease and provide a user-friendly panel to manage multiple games. Make sure to secure your installation with SSL certificates (using Let’s Encrypt or any other provider) and regularly update your server and Pterodactyl panel for improved security and performance.