DEV Community

kokodev
kokodev

Posted on

How to install pterodactyl on oracle instance

Hi there! You might be wondering why am i doing this? Well, it's because that i tried multiple tutorials and they don't seem to work. So that's why i'm making my own!

I'm not going to cover over creating the instance.

Link your domain to the oracle instance (if you want. otherwise you can use ip)

I use cloudflare.

Go to dns records:

DNS Records

Create a new record:

add a record

Turn off proxy (if your using cloudflare)

Set the record type to A then set the name to the subdomain you want pterodactyl to run on. (node/panel/both) You will choose later.

Then set the ip address to your oracle instance's public ip

Lastly, Click save.

Step 1a: Firewall

After ssh-ing into your instance, you first need to configure the firewall to open all ports. Because then you can access the ports of your pterodactyl servers. Aswell as the pterodactyl panel itself.

First you have to figure out what is blocking the things. So run:

sudo iptables -L -n --line-numbers
Enter fullscreen mode Exit fullscreen mode

I got something like this:

ubuntu@instance-20241001-1002-nocost-wing:~$ sudo iptables -L -n --line-numbers
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination         
1    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0            state RELATED,ESTABLISHED
2    ACCEPT     icmp --  0.0.0.0/0            0.0.0.0/0           
3    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           
4    ACCEPT     udp  --  0.0.0.0/0            0.0.0.0/0            udp spt:123
5    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0            state NEW tcp dpt:22
6    REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited
7    ACCEPT     all  --  0.0.0.0/0            0.0.0.0/0           

Chain FORWARD (policy ACCEPT)
num  target     prot opt source               destination         
1    REJECT     all  --  0.0.0.0/0            0.0.0.0/0            reject-with icmp-host-prohibited

Chain OUTPUT (policy ACCEPT)
num  target     prot opt source               destination         
1    InstanceServices  all  --  0.0.0.0/0            169.254.0.0/16      

Chain InstanceServices (1 references)
num  target     prot opt source               destination         
1    ACCEPT     tcp  --  0.0.0.0/0            169.254.0.2          owner UID match 0 tcp dpt:3260 /* See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule */
2    ACCEPT     tcp  --  0.0.0.0/0            169.254.2.0/24       owner UID match 0 tcp dpt:3260 /* See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule */
3    ACCEPT     tcp  --  0.0.0.0/0            169.254.4.0/24       owner UID match 0 tcp dpt:3260 /* See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule */
4    ACCEPT     tcp  --  0.0.0.0/0            169.254.5.0/24       owner UID match 0 tcp dpt:3260 /* See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule */
5    ACCEPT     tcp  --  0.0.0.0/0            169.254.0.2          tcp dpt:80 /* See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule */
6    ACCEPT     udp  --  0.0.0.0/0            169.254.169.254      udp dpt:53 /* See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule */
7    ACCEPT     tcp  --  0.0.0.0/0            169.254.169.254      tcp dpt:53 /* See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule */
8    ACCEPT     tcp  --  0.0.0.0/0            169.254.0.3          owner UID match 0 tcp dpt:80 /* See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule */
9    ACCEPT     tcp  --  0.0.0.0/0            169.254.0.4          tcp dpt:80 /* See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule */
10   ACCEPT     tcp  --  0.0.0.0/0            169.254.169.254      tcp dpt:80 /* See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule */
11   ACCEPT     udp  --  0.0.0.0/0            169.254.169.254      udp dpt:67 /* See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule */
12   ACCEPT     udp  --  0.0.0.0/0            169.254.169.254      udp dpt:69 /* See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule */
13   ACCEPT     udp  --  0.0.0.0/0            169.254.169.254      udp dpt:123 /* See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule */
14   REJECT     tcp  --  0.0.0.0/0            169.254.0.0/16       tcp /* See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule */ reject-with tcp-reset
15   REJECT     udp  --  0.0.0.0/0            169.254.0.0/16       udp /* See the Oracle-Provided Images section in the Oracle Cloud Infrastructure documentation for security impact of modifying or removing this rule */ reject-with icmp-port-unreachable

Enter fullscreen mode Exit fullscreen mode

If you don't see any REJECT rules, you're good to go!
But in my case, I do.
So, if you do, figure out the numbers that have REJECT Only in chains input, output, forward.

Then, remove these. for example, I have a REJECT in line number 6 in INPUT
So, I would run:

sudo iptables -D INPUT 6
Enter fullscreen mode Exit fullscreen mode

Then repeat for all REJECT in INPUT, OUTPUT, FORWARD

Step 1b: Add allow to firewall.

This step is easy! Just run the following:

sudo iptables -A INPUT -j ACCEPT
Enter fullscreen mode Exit fullscreen mode

This will make an firewall rule to ACCEPT all incoming traffic.
Then, save your changes:

sudo iptables-save | sudo tee /etc/iptables/rules.v4
sudo netfilter-persistent save
Enter fullscreen mode Exit fullscreen mode

Step 2a: Use wget to get the pterodactyl install script.

I use this script because it is so easy to install! Just answer a few questions and then it installs everything for you!
Run:

wget pterodactyl-installer.se
Enter fullscreen mode Exit fullscreen mode

for some reason, it saves as index.html so run:

mv index.html pterodactyl-installer.sh
chmod +x pterodactyl-installer.sh
Enter fullscreen mode Exit fullscreen mode

The last line chmod +x pterodactyl-installer.sh makes the file executable so that you can run it.

Step 3: Run the script and install!

This step will install pterodactyl! Whether you want to install wings or the panel or both on the same machine, this script will do it!

Run the script with sudo:

sudo ./pterodactyl-installer.sh
Enter fullscreen mode Exit fullscreen mode

And answer the questions!

Step 2b: Answer the questions:

At first when you run the script, you will see:

ubuntu@instance-20240930-2144-wing-highperf:~$ sudo ./pterodactyl-installer.sh
* Retrieving release information...
######################################################################
* Pterodactyl panel installation script @ v1.1.0
* 
* Copyright (C) 2018 - 2024, Vilhelm Prytz, <vilhelm@prytznet.se>
* https://github.com/pterodactyl-installer/pterodactyl-installer
* 
* This script is not associated with the official Pterodactyl Project.
* 
* Running ubuntu version 22.04.
######################################################################
* What would you like to do?
* [0] Install the panel
* [1] Install Wings
* [2] Install both [0] and [1] on the same machine (wings script runs after panel)
* [3] Install panel with canary version of the script (the versions that lives in master, may be broken!)
* [4] Install Wings with canary version of the script (the versions that lives in master, may be broken!)
* [5] Install both [3] and [4] on the same machine (wings script runs after panel)
* [6] Uninstall panel or wings with canary version of the script (the versions that lives in master, may be broken!)
* Input 0-6: 
Enter fullscreen mode Exit fullscreen mode

Which option depends on what you want to install. If you want to install the panel then run 0. If you want to install the wings (node) then run 1. If you want to install both on the same machine, run 2. I would recommend 2 if you haven't got a panel running yet.

I chose 1 Because i already have a panel on another machine.

After you choose your option, it will start installing some dependencies.
Then, it will ask some more questions:

* Do you want to automatically configure UFW (firewall)? (y/N): 
* Do you want to automatically configure a user for database hosts? (y/N): 
* Do you want to configure MySQL to be accessed externally? (y/N): 
* Enter the panel address (blank for any address): 
Enter fullscreen mode Exit fullscreen mode

I would leave the first question to N as we already configured the firewall. Then put y for the second quesion as it will not work without it. For some reason, without setting the Do you want to configure MySQL to be accessed externally? to y it doesn't work for me. So... set it to y. Then leave the last question blank.

More questions:

* WARNING: Allow incoming traffic to port 3306 (MySQL) can potentially be a security risk, unless you know what you are doing!

* Would you like to allow incoming traffic to port 3306? (y/N): y
* Database host username (pterodactyluser): 
* Database host password: **********************************

* WARNING: You cannot use Let's Encrypt with your hostname as an IP address! It must be a FQDN (e.g. node.example.org).

* Do you want to automatically configure HTTPS using Let's Encrypt? (y/N): y
* Set the FQDN to use for Let's Encrypt (node.example.com): 

Enter fullscreen mode Exit fullscreen mode

I put y as the first question.
and left the 2th question blank.
Then i typed in a password that i would remember in the 3th question.

If you want to use a domain, I recommand you put the y in the 4th question to request a certificate from let's encrypt. If you don't use a domain, put n.

If you chose y, to request a domain, Put in the domain you want the pterodactyl service to run on (panel/node/both)

Then it will start installing!
If you chose to use ssl, then you will later need to accept Let's Encrypt's TOS:

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Please read the Terms of Service at
https://letsencrypt.org/documents/LE-SA-v1.4-April-3-2024.pdf. You must agree in
order to register with the ACME server. Do you agree?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Enter fullscreen mode Exit fullscreen mode

Just put y and it will continue.

Then,

######################################################################
* Wings installation completed
*
* To continue, you need to configure Wings to run with your panel
* Please refer to the official guide, https://pterodactyl.io/wings/1.0/installing.html#configure
* 
* You can either copy the configuration file from the panel manually to /etc/pterodactyl/config.yml
* or, you can use the "auto deploy" button from the panel and simply paste the command in this terminal
* 
* You can then start Wings manually to verify that it's working
*
* sudo wings
*
* Once you have verified that it is working, use CTRL+C and then start Wings as a service (runs in the background)
*
* systemctl start wings
*
* Note: It is recommended to enable swap (for Docker, read more about it in official documentation).
######################################################################
Enter fullscreen mode Exit fullscreen mode

Great job! Wings/Panel is successfully installed! For the panel, it's already running! You can already access it at your domain (if you set it up) or instance's public ip. If your installing wings: there are just a few more things before you can run it!

Wings setup (if you installed wings or chose install both wings and panel on same machine)

Go into your panel, login, you will see something like that:
Actually you won't. I already installed a custom theme.

Panel

Go into the admin panel and on the side bar click Locations:

admin sidebar

then click create new:

create location

Then put in a random short code. In this case, i put in Oracle and left the description blank. Then click create.

Then click nodes in the sidebar and click Create New fill in the details:

  • FQDN: The domain or ip the node is on. If the panel has SSL, your node must use domain and also have SSL. If you selected install both on same machine then it is the url the panel is on.
  • Total Memory: The total memory in MIB the node has.
  • Total disk: Default for oracle is 50000 MIB I belive.
  • Memory Over Allocation: set to 0
  • Disk Over Allocation: also set to 0

Then go into configuration. Click generate token and paste into the instance running the node.

Lastly go into the Allocation tab, Put the ip to the private ip from the oracle console instance details, and put alias as the public ip. the ports I set as 10000-10999 And you should be done!

Then, boot up your wings!
First test if it works:

sudo wings
Enter fullscreen mode Exit fullscreen mode

If it does, Enable and run it!

sudo systemctl enable wings
sudo systemctl start wings
Enter fullscreen mode Exit fullscreen mode

Great job! You've successfully configured and installed pterodactyl!

If you have any questions, feel free to leave them in the comments!

Top comments (0)