Lots of great tips here. Have you been active in other activities? Or are you going from zero activity to running? I would start slow... even if your race was tomorrow you could finish it but the point is how miserable you would feel during and after it... so the secret is to train and eat right! I would plan a schedule and include lots of stretching and some minor weights too to get your legs stronger.
I would also do the 5k and then be motivated to find a 10k after. That way you will have another goal to look forward to!