How to make a Minecraft server?

A while ago I was looking through Google to see how to make a Minecraft server, and I saw something about making a Minecraft server with a built-in server file or something.

Is there any easy way to make a server without any odd port-forwarding stuff and buying Minecraft servers? I see some people made a bunch of them for testing worlds. But I just want to play with my friends…