How to make your own Game Hosting to deploy more game servers
Introduction
Pterodactyl is an open-source game server management panel used to manage and run game servers. It is designed for both individual gamers and gaming communities, providing an intuitive interface to manage a variety of game servers.
Prerequisites
- A server running Ubuntu 22.04 or newer.
- A non-root user with sudo privileges.
- At least 1GB of RAM and 1 CPU core (more is recommended depending on the number of game servers you plan to manage).
Step 1: Install Dependencies
Start by updating your system and installing necessary dependencies:
sudo apt update && sudo apt upgrade -y sudo apt install -y curl software-properties-common apt-transport-https ca-certificates gnupg lsb-release zip unzip tar nginx certbot python3-certbot-nginx
Step 2: Install PHP Pterodactyl requires PHP 8.0 or higher. Install PHP and necessary extensions:
sudo add-apt-repository ppa:ondrej/php -y
sudo apt update
sudo apt install -y php8.1 php8.1-cli php8.1-fpm php8.1-gd php8.1-mysql php8.1-pdo php8.1-mbstring php8.1-tokenizer php8.1-bcmath php8.1-xml php8.1-fpm php8.1-curl php8.1-zip
Step 3: Install and Configure Database Install MariaDB and secure the database:
sudo apt install -y mariadb-server mariadb-client
sudo systemctl enable mariadb
sudo systemctl start mariadb
sudo mysql_secure_installation
Login to MariaDB to create your database:
sudo mysql -u root -p
CREATE DATABASE pterodactyl;
GRANT ALL PRIVILEGES ON pterodactyl.* TO 'pterouser'@'localhost' IDENTIFIED BY 'your_password_here';
FLUSH PRIVILEGES;
EXIT;
Replace your_password_here
with a strong password.
Step 4: Install and Configure Pterodactyl Download the Pterodactyl installer:
mkdir -p /var/www/pterodactyl
cd /var/www/pterodactyl
curl -Lo panel.tar.gz https://github.com/pterodactyl/panel/releases/latest/download/panel.tar.gz
tar -xzvf panel.tar.gz
Set folder permissions:
sudo chown -R www-data:www-data /var/www/pterodactyl
Install Composer and set up Pterodactyl:
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
cd /var/www/pterodactyl
composer install --no-dev --optimize-autoloader
Create environment settings:
cp .env.example .env php artisan key:generate --force
Edit .env
to enter database settings, mail settings, and app settings:
nano .env
Step 5: Set Up Web Server Configure Nginx to serve Pterodactyl:
sudo nano /etc/nginx/sites-available/pterodactyl.conf
Add a server block configuration (refer to Pterodactyl's official documentation for the exact details).
Enable the site and restart Nginx:
sudo ln -s /etc/nginx/sites-available/pterodactyl.conf /etc/nginx/sites-enabled/ sudo systemctl restart nginx
Step 6: Final Configuration Run the setup command to complete the Pterodactyl setup:
cd /var/www/pterodactyl
php artisan migrate --seed
php artisan p:environment:setup
php artisan p:environment:mail
php artisan p:generate:encryption-keys
php artisan up
Step 7: Secure the Panel with SSL Use Certbot to install a free Let's Encrypt SSL certificate:
sudo certbot --nginx -d yourdomain.com
Follow the prompts to configure HTTPS.
Conclusion Pterodactyl is now installed on your Ubuntu 22.04 server. You can access the panel through your web browser using the domain you configured. This setup provides a robust platform for managing game servers easily and efficiently.
This guide provides a comprehensive installation procedure, ensuring a smooth setup experience for managing game servers with Pterodactyl.