If you aren’t using a VPS and are running this on your own hardware, you will have to know how to port forward with your router.
Java11 jdk and jre were used in this video
sudo apt search openjdk
and choose whichever you want to download
server.jar download link: https://launcher.mojang.com/v1/objects/35139deedbd5182953cf1caa23835da59ca3d7cd/server.jar