|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +echo "Provisioning development environment for Pterodactyl Panel." |
| 4 | + |
| 5 | +apt-get install -y software-properties-common > /dev/null |
| 6 | + |
| 7 | +echo "Add the ondrej/php ppa repository" |
| 8 | +add-apt-repository -y ppa:ondrej/php > /dev/null |
| 9 | +echo "Add the mariadb repository" |
| 10 | +curl -sS https://downloads.mariadb.com/MariaDB/mariadb_repo_setup | bash > /dev/null |
| 11 | + |
| 12 | +apt-get update > /dev/null |
| 13 | + |
| 14 | +echo "Install the dependencies" |
| 15 | +export DEBIAN_FRONTEND=noninteractive |
| 16 | +# set the mariadb root password because mariadb asks for it |
| 17 | +debconf-set-selections <<< 'mariadb-server-5.5 mysql-server/root_password password pterodactyl' |
| 18 | +debconf-set-selections <<< 'mariadb-server-5.5 mysql-server/root_password_again password pterodactyl' |
| 19 | +# actually install |
| 20 | +apt-get install -y php7.1 php7.1-cli php7.1-gd php7.1-mysql php7.1-pdo php7.1-mbstring php7.1-tokenizer php7.1-bcmath php7.1-xml php7.1-fpm php7.1-memcached php7.1-curl php7.1-zip mariadb-server nginx curl tar unzip git memcached > /dev/null |
| 21 | + |
| 22 | +echo "Install composer" |
| 23 | +curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer |
| 24 | + |
| 25 | +echo "Install and run mailhog" |
| 26 | +curl -sL -o /usr/bin/mailhog https://github.com/mailhog/MailHog/releases/download/v1.0.0/MailHog_linux_amd64 |
| 27 | +chmod +x /usr/bin/mailhog |
| 28 | +cp /var/www/html/pterodactyl/.dev/vagrant/mailhog.service /etc/systemd/system/ |
| 29 | +systemctl enable mailhog.service |
| 30 | +systemctl start mailhog |
| 31 | + |
| 32 | +echo "Configure nginx" |
| 33 | +cp /var/www/html/pterodactyl/.dev/vagrant/pterodactyl.conf /etc/nginx/sites-available/ |
| 34 | +rm /etc/nginx/sites-available/default |
| 35 | +ln -s /etc/nginx/sites-available/pterodactyl.conf /etc/nginx/sites-enabled/pterodactyl.conf |
| 36 | +service nginx restart |
| 37 | + |
| 38 | +echo "Setup database" |
| 39 | +mysql -u root -ppterodactyl << SQL |
| 40 | +CREATE USER 'pterodactyl'@'localhost' IDENTIFIED BY 'pterodactyl'; |
| 41 | +CREATE DATABASE panel; |
| 42 | +GRANT ALL PRIVILEGES ON panel.* TO 'pterodactyl'@'localhost'; |
| 43 | +FLUSH PRIVILEGES; |
| 44 | +SQL |
| 45 | + |
| 46 | +echo "Setup pterodactyl queue worker service" |
| 47 | +cp /var/www/html/pterodactyl/.dev/vagrant/pteroq.service /etc/systemd/system/ |
| 48 | +systemctl enable pteroq.service |
| 49 | + |
| 50 | + |
| 51 | +echo "Setup panel with base settings" |
| 52 | +cp /var/www/html/pterodactyl/.dev/vagrant/.env.vagrant /var/www/html/pterodactyl/.env |
| 53 | +cd /var/www/html/pterodactyl |
| 54 | +chmod -R 755 storage/* bootstrap/cache |
| 55 | +composer install --no-progress |
| 56 | +php artisan key:generate --force |
| 57 | +php artisan migrate |
| 58 | +php artisan db:seed |
| 59 | +php artisan pterodactyl:user --firstname Test --lastname Admin --username admin --email testadmin@pterodactyl.io --password Ptero123 --admin 1 |
| 60 | +php artisan pterodactyl:user --firstname Test --lastname User --username user --email testuser@pterodactyl.io --password Ptero123 --admin 0 |
| 61 | + |
| 62 | +echo "Add queue cronjob and start queue worker" |
| 63 | +(crontab -l 2>/dev/null; echo "* * * * * php /var/www/html/pterodactyl/artisan schedule:run >> /dev/null 2>&1") | crontab - |
| 64 | +systemctl start pteroq |
| 65 | + |
| 66 | +echo " ----------------" |
| 67 | +echo "Provisioning is completed." |
| 68 | +echo "The panel should be available at http://localhost:50080/" |
| 69 | +echo "You may use the default admin user to login: admin/Ptero123" |
| 70 | +echo "A normal user has also been created: user/Ptero123" |
| 71 | +echo "MailHog is available at http://localhost:58025/" |
0 commit comments