Pterodactyl is a free, open-source game server panel that allows you to manage game servers with ease. In this tutorial, we will guide you through the steps of installing Pterodactyl on NixOS latest.
Before we can start installing Pterodactyl, we need to make sure that some essential packages are installed in our system. Open your terminal and run the following command:
$ sudo nix-env -i php mariadb-server nginx certbot
This command will install the required packages for Pterodactyl.
Now that we have installed the necessary packages, we can proceed with the installation of Pterodactyl. Follow these steps to install Pterodactyl:
Open your terminal and navigate to your preferred installation directory. You can download the latest release of Pterodactyl by running this command:
$ curl -Lo panel.tar.gz https://github.com/pterodactyl/panel/releases/latest/download/panel.tar.gz
Now, extract the panel tar file that you just downloaded using this command:
$ tar --strip-components=1 -xzvf panel.tar.gz
To install the required dependencies for Pterodactyl, navigate to the extracted panel directory and run this command:
$ sudo php artisan p:environment:setup
This command will install all the dependencies required by Pterodactyl.
The next step is to configure the Pterodactyl panel environment. To do this, run the following command:
$ sudo php artisan p:environment:configure
You will be asked a series of questions about your environment. Answer them accordingly.
Run the following command to generate an application key:
$ sudo php artisan key:generate
Before you can start using Pterodactyl, you need to migrate and seed the database. Run the following command to do this:
$ sudo php artisan migrate --seed
To configure Nginx, navigate to the Nginx configuration directory and create a new configuration file:
$ cd /etc/nginx/conf.d
$ sudo nano pterodactyl.conf
Add the following content to the configuration file:
server {
listen 80;
listen [::]:80;
server_name panel.example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name panel.example.com;
ssl_certificate /etc/letsencrypt/live/panel.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/panel.example.com/privkey.pem;
root /var/www/html/pterodactyl/public;
index index.php;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
Save the configuration file and exit the editor.
Restart Nginx to apply the changes:
$ sudo systemctl restart nginx
To allow external connections to Pterodactyl, we need to configure the firewall. Run the following command to allow HTTP, HTTPS and SSH:
$ sudo firewall-cmd --permanent --add-service=http
$ sudo firewall-cmd --permanent --add-service=https
$ sudo firewall-cmd --permanent --add-service=ssh
$ sudo firewall-cmd --reload
To secure your Pterodactyl installation, you can install a free SSL certificate from Let’s Encrypt. Run the following command to install Certbot:
$ sudo nix-env -i certbot
Now, run the following command to install the SSL certificate:
$ sudo certbot certonly --webroot -w /var/www/html/pterodactyl/public -d panel.example.com
Replace panel.example.com with your domain name.
Once the certificate is installed, you need to configure Nginx to use it. Open the Nginx configuration file we created earlier and update the SSL certificate paths to the following:
ssl_certificate /etc/letsencrypt/live/panel.example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/panel.example.com/privkey.pem;
Save the configuration file and restart Nginx.
To start Pterodactyl, navigate to the Pterodactyl directory and run the following command:
$ sudo php artisan serve
You can also use a process manager like Systemd to manage Pterodactyl.
Congratulations! You have successfully installed Pterodactyl on NixOS latest!
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!