Installing Pterodactyl on Elementary OS

Pterodactyl is an open-source game server management system that offers gamers a powerful and intuitive gaming experience. In this tutorial, we will go through the process of installing Pterodactyl on Elementary OS.

Prerequisites

Before we begin, you will need to make sure that your system meets the following requirements:

Step 1 - Installing Dependencies

First, we need to install some dependencies required for Pterodactyl to function properly. Open your terminal and enter the following command:

sudo apt update && sudo apt upgrade
sudo apt install -y curl tar unzip git make gcc g++ python2.7 python3 python3-pip mysql-server libcurl4-openssl-dev libssl-dev libzip-dev sqlite3 libpng-dev nginx

This will update your system, install necessary dependencies and packages required for building Pterodactyl.

Next, we need to install the composer package manager to manage Pterodactyl PHP dependencies. You can install Composer by running the following command:

curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer

Step 2 - Creating a Database

Before installing Pterodactyl, we need to create a database for it to use.

Open the MySQL shell by entering the following command in the terminal:

sudo mysql

Inside the MySQL shell, create a new database named pterodactyl by running:

CREATE DATABASE pterodactyl;

Create a new MySQL user and grant all privileges to it for the pterodactyl database by running:

CREATE USER 'pterodactyluser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON pterodactyl.* TO 'pterodactyluser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Make sure to replace password with a strong, unique password.

Step 3 - Installing Pterodactyl

Now that we have installed all the dependencies and created a database, we can proceed with installing Pterodactyl.

First, create a new directory for Pterodactyl by running:

mkdir -p /var/www/pterodactyl
cd /var/www/pterodactyl

Next, we need to download the Pterodactyl installation files from Github using the following command:

curl -Lo panel.tar.gz https://github.com/pterodactyl/panel/releases/latest/download/panel.tar.gz
tar --strip-components=1 -xzvf panel.tar.gz

Pterodactyl requires a set of configuration files that need to be customized according to your server's configuration. In this step, we will copy the example configuration files and make necessary changes.

Copy the example environment file by running:

cp .env.example .env

Then, open the .env file in your preferred editor and make the following changes:

APP_URL=https://your-domain.com
DB_HOST=localhost
DB_PORT=3306
DB_DATABASE=pterodactyl
DB_USERNAME=pterodactyluser
DB_PASSWORD=your_db_password

Save and close the file.

Next, install the PHP dependencies required for the Pterodactyl panel using Composer by running:

composer install --no-dev --optimize-autoloader

This process may take some time to complete.

Once the installation is complete, generate the Laravel application key by running:

php artisan key:generate --force

Next, we need to migrate the Pterodactyl database schema to our MySQL database by running:

php artisan migrate --seed --force

This may take some time to complete.

Step 4 - Configuring Nginx

Now that we have installed Pterodactyl, we need to configure Nginx to serve the application.

Create a new Nginx server block by running:

sudo nano /etc/nginx/sites-available/pterodactyl.conf

Copy and paste the following configuration to the file:

server {
    listen 80;
    listen [::]:80;
    server_name your-domain.com;

    root /var/www/pterodactyl/public;
    index index.html index.htm index.php;

    access_log /var/log/nginx/pterodactyl-access.log;
    error_log  /var/log/nginx/pterodactyl-error.log error;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_intercept_errors off;
        fastcgi_pass unix:/run/php/php7.4-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_buffers 8 16k;
        fastcgi_buffer_size 32k;
    }

    location ~ /\.ht {
        deny all;
    }

    client_max_body_size 100M;
}

Make sure to replace your-domain.com with your actual domain name.

Save and close the file.

Next, enable the new server block by creating a symbolic link to the sites-enabled directory:

sudo ln -s /etc/nginx/sites-available/pterodactyl.conf /etc/nginx/sites-enabled/

Remove the default Nginx server block:

sudo rm /etc/nginx/sites-enabled/default

Restart Nginx for the changes to take effect:

sudo systemctl restart nginx

Step 5 - Setting up SSL/TLS (Optional)

If you want to secure your Pterodactyl panel with SSL/TLS, you can use Let's Encrypt to obtain a free SSL certificate for your domain.

Install the Certbot tool by running the following command:

sudo apt install certbot

Obtain a new SSL certificate by running:

sudo certbot --nginx -d your-domain.com

Follow the prompts to obtain a new SSL certificate. Once the process is complete, Certbot will automatically configure Nginx to serve your Pterodactyl panel over HTTPS.

Step 6 - Done!

Congratulations, you have successfully installed Pterodactyl on Elementary OS! You can now access your Pterodactyl panel by opening your web browser and navigating to https://your-domain.com.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!