There is nothing you can do in the home to make garlic infused oil safe beyond 10-14 days. Not cooking, boiling, sealing, sterilizing, refrigerating. Nothing. After two weeks, you are courting disaster with the growth of botulism.
I would store the garlic in a cool dark place such as a cellar. Hang it so air can circulate and it will last a long time.
"If you want to make an apple pie from scratch, you must first create the universe." -Carl Sagan