Can someone tell me how to secure the server from pottential hackers?

All my server will use is the ports needed for regular website access and a Java chat room.

I believe all other ports need not be open.

So, How do I lock/close all unused ports?
What else do I need to make it hacker proof as much as possible?

Thankx in advance.