I've always enjoyed hosting game servers and coding, but after setting up Pterodactyl and Wings a few days ago, I decided it was the perfect opportunity to dive into some Bash scripting. My goal was simple: automate a setup process that normally takes a lot of time and make it faster and way more efficient for myself.
What the Script Does
- Menu System: Choose between installing Pterodactyl or Wings.
- Pterodactyl: Sets up domain, admin email, database, user; installs dependencies, runs migrations, and configures crontab and queue workers.
- Wings: Downloads the correct binary, creates configuration directories, and sets up Wings as a service for automatic management.
Key Challenges & Fixes
Database Configuration:
Problem: MariaDB rejected credentials for the pterodactyl user.
Fix: Adjusted MariaDB user creation to allow access from both localhost and 127.0.0.1, ensuring proper database access.
CREATE USER IF NOT EXISTS \`$DB_USER\`@'127.0.0.1' IDENTIFIED BY '$DB_PASS';
CREATE USER IF NOT EXISTS \`$DB_USER\`@'localhost' IDENTIFIED BY '$DB_PASS';
Crontab Command Issue:
Problem: The crontab entry wasn’t being added due to a typo (-1 instead of -l).
Fix: Corrected the crontab command to add the cron job correctly, ensuring tasks run on schedule.
(crontab -l 2>/dev/null; echo "* * * * * php /var/www/pterodactyl/artisan schedule:run >> /dev/null 2>&1") | crontab -
Syntax Errors:
Problem: Common script syntax issues such as missing spaces after [[, semicolons, and incorrect if statements led to failure.
Fix: Fixed the syntax issues, including default values for timezones and ensuring the if statements are properly formatted.
Redundant Code Cleanup:
Problem: The queue worker setup was duplicated, leading to unnecessary complexity.
Fix: Cleaned up the code to improve readability, removing redundancies and streamlining the setup process.
Missing sudo Permissions:
Problem: Several commands were missing sudo, which caused failures due to insufficient privileges.
Fix: Added sudo to the necessary commands to ensure smooth execution of the script.
Final Message & Next Steps
Once the installation is complete, the script provides instructions for the final Wings setup.
if [[ $choice == "2" ]]; then
echo
echo " Next steps are as follows for the final Wings setup:"
echo " 1. Log into your Pterodactyl Panel."
echo " 2. Head over to admin, into nodes and create new node."
echo " 3. Scroll down and download the generated config.yml"
echo " 4. Place it at: /etc/pterodactyl/config.yml"
echo
echo " Once you're all done, start wings with:"
echo " sudo systemctl restart wings"
echo " or run it in debug mode if you wish:"
echo " sudo wings --debug"
echo
echo " Wings will NOT start until the config.yml file is in place!!"
fi
This script ended up being my first real deep dive into Bash scripting and server automation. What would normally take hours to manually set up, installing Pterodactyl and Wings, is now pretty much fully automated, saving me time and removing a lot of the same old repetitive work.
This was literally my first Bash script. Before this, I had never worked with Bash, my only real coding experience was HTML, CSS, JavaScript and Lua. I did use AI for a small part, a random password generator and an initial menu structure, but everything else came from reading the official documentation, testing on a fresh VM and fixing errors as they came up.
Fixing issues like permissions and database configuration while learning how Bash actually behaves in real scenarios was both very rewarding and at times incredibly frustrating. It made it clear to me just how powerful scripting can be when it comes to removing unnecessary "boring" work.
You can check out the full script on my Github:
N4V1CKAS
/
pterodactyl-wings-installer
An Interactive Bash script to automate Pterodactyl Panel and Wings installation on Ubuntu
Pterodactyl + Wings Easy Installer
An interactive Bash script to automate the installation of Pterodactyl Panel and Wings daemon on Ubuntu.
This project was created as my first real deep dive into Bash scripting. The goal was simple, to automate a setup process that normally takes me a significant amount of time when done manually, while also learning how Bash behaves in real world server scenarios. The script went through multiple iterations and fixes as I tested it on fresh VMs and resolved issues along the way.
Features
- Interactive menu (Panel or Wings)
- Automated dependency installation
- MariaDB database setup
- Pterodactyl Panel configuration
- Crontab and queue worker setup
- Automatic Wings binary detection (amd64 / arm64)
Requirements
- Ubuntu Server 24.04 (tested, could work on previous versions)
- Fresh VM or VPS recommended
- User with sudo privileges
Notes
- This was my first ever Bash script and took a lot of time to build through…
Top comments (0)