Go to this website to download the minecraft jar. You can optionall wget the jar as well.

cd /root/minecraft
wget https://piston-data.mojang.com/v1/objects/f69c284232d7c7580bd89a5a4931c3581eae1378/server.jar
ufw allow 25565
screen
java -Xmx1024M -Xms1024M -jar minecraft_server.1.18.1.jar nogui

Detach from the screen and you should now be able to connect from your client.