Installing Pterodactyl on Ubuntu Server

Pterodactyl is a popular web-based game server management panel that provides a simple and easy-to-use interface for managing game servers. This tutorial will guide you through the process of installing Pterodactyl on Ubuntu Server.

Prerequisites

Before you begin, ensure that you have the following prerequisites:

Step 1: Update the system

Before installing any new software, it is always a good idea to update the system to the latest packages available. You can do this by running the following command:

sudo apt update && sudo apt upgrade -y && sudo apt autoremove -y

This will update the package list, upgrade the existing packages to their latest version, and remove any unnecessary packages from the system.

Step 2: Install Dependencies

Pterodactyl requires a few dependencies to be installed before it can be installed itself. You can install the dependencies by running the following command:

sudo apt install -y tar unzip curl git composer bash sqlite3 libsqlite3-dev libcurl4-openssl-dev libssl-dev libzip-dev php php-fpm php-common php-mbstring php-xml php-zip php-tokenizer php-pdo php-mysql php-pgsql php-gd php-curl php-intl php-bcmath php-gmp

This command will install all of the dependencies required by Pterodactyl.

Step 3: Install Pterodactyl

Now that the dependencies have been installed, we can proceed to install Pterodactyl. You can install Pterodactyl by following these steps:

  1. First, download the Pterodactyl installation script by running the following command:
curl -Lo panel.tar.gz https://github.com/pterodactyl/panel/releases/latest/download/panel.tar.gz
  1. Extract the downloaded archive by running the following command:
tar -xzvf panel.tar.gz
  1. Change the directory to the extracted folder:
cd /var/www/pterodactyl
  1. Install the composer packages by running the following command:
composer install --no-dev --optimize-autoloader
  1. Set the permissions for the storage folder:
chmod -R 755 storage/* bootstrap/cache
  1. Generate the application key:
php artisan key:generate --force
  1. Install the assets:
php artisan pterodactyl:publish --force
php artisan view:clear
php artisan config:clear

Step 4: Configure Nginx

Pterodactyl uses Nginx as its web server. You can install Nginx by running the following command:

sudo apt install -y nginx

Once Nginx is installed, you can configure it to serve Pterodactyl. You can do this by creating a new configuration file for Nginx:

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

And then pasting the following configuration:

server {
    listen 80;
    server_name your_domain.com; # Change this to your domain name
    root /var/www/pterodactyl/public;

    index index.html index.htm index.php;

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

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php7.4-fpm.sock; # Change the version to the version of PHP you are running
    }

    location ~ /\.ht {
        deny all;
    }
}

Save and close the file.

Once done, create a symbolic link to the sites-enabled folder:

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

Finally, restart Nginx for the changes to take effect:

sudo systemctl restart nginx

Step 5: Configure MySQL

Pterodactyl requires a database to store its data. You can use MySQL for this purpose. You can install MySQL by running the following command:

sudo apt install -y mysql-server

Once installed, you can create a new database and user for Pterodactyl:

  1. Login to MySQL:
sudo mysql
  1. Create a new database:
CREATE DATABASE pterodactyl;
  1. Create a new user:
CREATE USER 'pterodactyl'@'localhost' IDENTIFIED BY 'your_password'; # Replace "your_password" with your chosen password
  1. Grant the required permissions to the user:
GRANT ALL PRIVILEGES ON pterodactyl.* TO 'pterodactyl'@'localhost';
FLUSH PRIVILEGES;
exit;

Step 6: Run Pterodactyl installer

Now that all the prerequisites have been installed and configured, you can run the Pterodactyl installer to complete the installation. You can do this by running the following command:

php artisan p:environment:setup

Answer the prompts as needed.

Once this command is completed, run the following command:

php artisan p:install

This will install and configure Pterodactyl for use.

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!