at first how fit you are ? how experienced you are on bike ? what kind of bike you have ? it is ready or enough for that use ?
You should just ride and see for you self what you are capable of. After that you can plan better your training. You can chose a "bike friendly" route around your town better if it have long uphills. It should be longer that your commute. Also a right bike to do the job it would help a lot and it is really important how save is your route. It take some time to get used to drive between cars. Be aware of state of the roads of your route and how fast cars go there and how good it is the visibility. Try get aware of most dangerous points: tight turns whit out visibility, cross roads, thin country roads (where people drive like crazy)...
I did the same that you at first try was breath dead after 400m. But in few weeks I was making 18km around my town few times per week. In my case my institute was just 5km away so it took me 20min to get there but I needed to get in some shape to push the pedals at a decent rithm.
It is said that bike it is the most efficient way of transport but it is un natural for your body. You need to get used to it.