First... use the search tool.. lots of guides out there for you answering your question.
Second, check out the stickies, like 3 posts above your question is a complete guide on everything you need to know about making your own server, including security posted by Bane.
In there is another link..
Read through it, understand and learn it...