install Pterodactyl on CyberPanel

How to install Pterodactyl on CyberPanel to run your own Minecraft server

If you’re looking to install your own Minecraft server using Pterodactyl on CyberPanel, you’re in the right place! This comprehensive guide will walk you through each step, from creating CNAME records to configuring your servers and databases. Follow along for a seamless and enjoyable gaming experience.

To install Pterodactyl on CyberPanel and run your own Minecraft server, follow these detailed steps. Before starting, ensure you have read and applied the instructions in the following articles:

Step 1: Create CNAME Records on Your DNS

First, you need to create two CNAME records:

ServerAlias.Domain.com
NodeAlias.Domain.com

Step 2: Create Websites on CyberPanel

For each CNAME, create a website on CyberPanel:

  1. Go to
MAIN > Website > Create Website
  1. Fill out the following data:
  • Select Package: Default
  • Select Owner: admin (or any user you prefer)
  • Domain Name: ServerAlias.Domain.com (use your domain, without “www”, in lowercase)
  • Email: your email address
  • Select PHP: 8.0
  1. Click Create Website.
  2. Repeat for NodeAlias.Domain.com.

Step 3: Issue SSL Certificates

  1. Go to
MAIN > Website > List Websites
  1. Find the created websites and click Issue SSL.
  2. Wait for it to finish, then click Manage to confirm the certificate from Let’s Encrypt.
  3. Go to on the same page.
CONFIGURATIONS > Rewrite Rules
  1. For ServerAlias.Domain.com replace the text with:
Nginx
RewriteEngine On
REWRITERULE ^(.*)$ HTTP://ServerAlias.Domain.com/$1 [P]
  1. For NodeAlias.Domain.com replace the text with:
Nginx
RewriteEngine On
REWRITERULE ^(.*)$ HTTP://NodeAlias.Domain.com/$1 [P]
  1. Click Save Rewrite Rules.

Step 4: Configure OpenLiteSpeed

Access the OpenLiteSpeed control panel:

  1. Go to
Server Configuration > External App
  1. Click the plus sign at the top right.
  2. Select Type: Web Server.
  3. Fill out the following data:
  • Name: ServerAlias.Domain.com
  • Address: 127.0.0.1:802
  • Max Connections: 60
  • Initial Request Timeout (secs): 60
  • Retry Timeout (secs): 60
  1. Click the floppy sign to save.
  2. Repeat the above steps for NodeAlias.Domain.com:
  • Name: NodeAlias.Domain.com
  • Address: 127.0.0.1:8443

Step 5: Add Web Socket Proxy

  1. Go to
Virtual Hosts > Summary > Virtual Host List
  1. Click on NodeAlias.Domain.com.
  2. Go to Web Socket Proxy.
  3. Click the plus sign and fill out:
  • URI: /
  • Address: 127.0.0.1:8443
  1. Click the floppy sign to save.
  2. Restart LiteSpeed by clicking the green circular arrow.

Step 6: Deploy Pterodactyl Docker Compose on Portainer

  1. Open the Portainer control panel.
  2. Click on local Environments.
  3. Click on Stacks in the left panel.
  4. Click Add stack and fill out:
  • Name: pterodactyl
  • In the “Web editor”, add the following Docker Compose script:
YAML
version: "3.8"
# This section declares the basic config of all of your Containers that are
# declared below as "services"
x-common:
  database:
    &db-environment
    # You don't need to change these because it will not be exposed to the public.
    MYSQL_PASSWORD: &db-password "password_here"
    MYSQL_ROOT_PASSWORD: "password_here"
  panel:
    &panel-environment
    #This is the URL that your panel will be on after being reverse proxied.
    # set this to "https://yoursubdomain.yourdomain.yourdomainstld"
    APP_URL: "https://<ServerAlias.Domain.com>"
    # A list of valid timezones can be found here:
    # http://php.net/manual/en/timezones.php
    APP_TIMEZONE: "Etc/UCT"
    APP_SERVICE_AUTHOR: "email@gmail.com"
  # Mail is an optional Setup, I have the basic setup if you want to use a gmail
  # account. You will need an App Password as the MAIL_PASSWORD field, not your
  # gmail password. Uncomment the following lines to enable mail.
    HASHIDS_SALT: "Play.MC-SmartCraft.com"  # DO NOT CHANGE
    HASHIDS_LENGTH: 8  # DO NOT CHANGE
    
  #mail:
    #&mail-environment
    #MAIL_FROM: "youremail@gmail.com"
    #MAIL_DRIVER: "smtp"
    #MAIL_HOST: "smtp.gmail.com"
    #MAIL_PORT: "587"
    #MAIL_USERNAME: "youremail@gmail.com"
    #MAIL_PASSWORD: ""
    #MAIL_ENCRYPTION: "true"
services:
  # Wings is the service that hooks into docker and actually creates your game
  # servers,
  wings:
    image: ghcr.io/pterodactyl/wings:latest
    restart: always
    networks:
      - ptero0
    # These are the ports exposed by Wings, I don't recommend changing them.
    ports:
      - "8443:443"
      - "2022:2022"
    tty: true
    environment:
      TZ: "Etc/UCT"
      # For ease of setup, this is going to use root user.
      WINGS_UID: 0
      WINGS_GID: 0
      WINGS_USERNAME: root
    # This is where docker will bind certain parts of container to your actual
    # host OS. These locations will be used later.
    volumes:
      - "/var/run/docker.sock:/var/run/docker.sock" # DO NOT CHANGE
      - "/var/lib/docker/containers:/var/lib/docker/containers" # DO NOT CHANGE
      - "/opt/pterodactyl/wings/config:/etc/pterodactyl" # Feel free to change.
      - "/var/lib/pterodactyl:/var/lib/pterodactyl" # DO NOT CHANGE
      - "/var/log/pterodactyl:/var/log/pterodactyl" # DO NOT CHANGE
      - "/tmp/pterodactyl/:/tmp/pterodactyl/" # Recommended not to change.
  # It's a database. Not much else to explain.
  database:
    image: mariadb:10.5
    restart: always
    command: --default-authentication-plugin=mysql_native_password
    volumes:
      - "/opt/pterodactyl/panel/database:/var/lib/mysql"
    environment:
      <<: *db-environment
      MYSQL_DATABASE: "panel"
      MYSQL_USER: "pterodactyl"
  # It's a CACHE database. Not much else to explain.
  cache:
    image: redis:alpine
    restart: always
  # Now the fun part. Your actual panel.
  panel:
    image: ghcr.io/pterodactyl/panel:latest
    restart: always
    # For NGINX Reverse Proxy, I will be using these ports for simplicity.
    ports:
      - "802:80"
      - "4432:443"
    # Links these containers together in a docker network.
    links:
      - database
      - cache
    # This is where docker will bind certain parts of container to your actual
    # host OS. These don't really matter that much.
    volumes:
      - "/opt/pterodactyl/panel/appvar/:/app/var/"
      - "/opt/pterodactyl/panel/nginx/:/etc/nginx/http.d/"
      - "/opt/pterodactyl/panel/logs/:/app/storage/logs"
    # Sets the config stuff
    environment:
      <<: [*panel-environment]
      # <<: [*mail-environment]
      DB_PASSWORD: *db-password
      APP_ENV: "production"
      APP_ENVIRONMENT_ONLY: "false"
      CACHE_DRIVER: "redis"
      SESSION_DRIVER: "redis"
      QUEUE_DRIVER: "redis"
      REDIS_HOST: "cache"
      DB_HOST: "database"
      DB_PORT: "3306"
# This is Wings' Network. We don't need much depth here, all you need to know, is
# that it allows the passthrough of the ports from Wings.
networks:
  ptero0:
    name: ptero0
    driver: bridge
    ipam:
      config:
        - subnet: "192.55.0.0/16"
    driver_opts:
      com.docker.network.bridge.name: ptero0

Update placeholders (MYSQL_PASSWORD, MYSQL_ROOT_PASSWORD, APP_URL, APP_TIMEZONE, APP_SERVICE_AUTHOR) before deploying.
For “TIME ZONE” you can select your zone from here.

  1. Click Deploy the stack.
  2. Stop the “pterodactyl-wings-1” container in Portainer.

Step 7: Create an Admin User for Pterodactyl

  1. Access the VPS terminal with root privileges.
  2. Run the command:
Bash
sudo docker exec -it pterodactyl-panel-1 php artisan p:user:make
  1. Follow the prompts to create an administrator account.

Step 8: Open the Pterodactyl Control Panel

  1. Visit https://ServerAlias.Domain.com.
  2. Navigate to the admin panel.
  3. Create a location:
  4. Go to
MANAGEMENT > Locations
  1. Click Create New.
  2. Short Code: MainLocation (or any name you prefer).
  3. Click Create.

Step 9: Create a Node on Pterodactyl

  1. Go to
MANAGEMENT > Nodes
  1. Click Create New.
  2. Fill out:
  • Name: MainNode (or any name you prefer).
  • Location: MainLocation (Select location your created).
  • Node Visibility: Public
  • FQDN: NodeAlias.Domain.com (add node CNAME).
  • Communicate Over SSL: Use SSL Connection
  • Behind Proxy: Behind Proxy
  • Total Memory: 4096 (Add the total RAM space of the node).
  • Memory Over-Allocation: 0 (Entering 0 will prevent creating new servers if it would put the node over the limit).
  • Total Disk Space: 10240 (Add the total Disk space of the node).
  • Disk Over-Allocation: 0 (Entering 0 will prevent creating new servers if it would put the node over the limit).
  • Daemon Port: 443
  • Daemon SFTP Port: 2022
  1. Click Create Node.

Step 10: Add Minecraft Ports to Node

  1. On the Allocation page, fill out:
  • IP Address: 0.0.0.0
  • Ports: 25565,19132,19133
  1. Click Submit.

Step 11: Connect Node to Wings Container

  1. Copy the node configuration from Pterodactyl.
  2. Access Webmin control panel and navigate to
Tools > File Manager
  1. Go to
/opt/pterodactyl/wings/config
  1. and create a new file named config.yml.
  2. Paste the node configuration and add:
YAML
docker:
  network:
    interfaces:
      v4:
        subnet: 192.54.0.0/16
        gateway: 192.54.0.1
  1. Save the file.
  2. Start the “pterodactyl-wings-1” container in Portainer.

Step 12: Connect Database Container to Pterodactyl

  1. Go to
MANAGEMENT > Databases
  1. Click Create New.
  2. Fill out:
  • Name: MainDatabase (or any name you prefer).
  • Host: pterodactyl-database-1 (name of database contener).
  • Port: 3306
  • Username: root
  • Password: (from MYSQL_ROOT_PASSWORD in the stack configuration)
  • Linked Node: MainNode (Select node your created).
  1. Click Create.

Step 13: Open Minecraft Ports on CSF Firewall

  1. Go to CyberPanel control panel.
  2. Navigate to
Server > Security > Firewall > csf - ConfigServer Firewall > Firewall Configuration > IPv4 Port Settings
  1. Add the ports 25565,19132,19133 to TCP_IN.
  2. Click Change and then Restart csf-ltd.

Step 14: Create a Minecraft Server on Pterodactyl

  1. Go to
MANAGEMENT > Servers
  1. Click Create New.
  2. Fill out:
  • Server Name: FirstServer (or any name you prefer).
  • Server Owner: your username
  • Default Allocation: 25565
  • Database Limit: 1 (or any number you prefer).
  • Allocation Limit: 1 (or any number you prefer).
  • Backup Limit: 1 (or any number you prefer).
  • CPU Limit: 0 (set 0 for no limt).
  • Memory: 2048 (or any number you prefer).
  • Swap: -1 (set -1 for no limt).
  • Disk Space: 10240 (or any number you prefer).
  • Nest: Minecraft
  • Egg: Paper (Choose server type you want).
  • Docker Image: Java 21 (Choose the appropriate version of Java for the plugin).
  1. Click Create Server.
  2. Click the wrench icon next to the newly created server.

After agreeing to the terms and conditions, your Minecraft server will start and can be accessed via

ServerAlias.Domain.com

Enjoy managing and playing on your new Minecraft server!

Conclusion

In conclusion, install a Minecraft server using Pterodactyl on CyberPanel provides you with full control and customization. By following these steps, you can create an optimized server environment, ready for endless gaming adventures. Enjoy the experience of managing your server and bringing your Minecraft world to life!

In order to read the following explanation of this series, you can click on the following link How install MeshCentral on CyberPanel for your own remote desktop server

More:


You may also like

Leave a Reply

Your email address will not be published. Required fields are marked *