I have recently decided that I'd rather have base ingredients that I am store in my pantry in order to make more meals from scratch as opposed to getting things premade. A friend of mine told me there's no way that they would store flour anywhere but the fridge, otherwise it would eventually get bugs in it. I have looked around and found these two related questions: Is it okay to keep flour in the freezer? What is the best way to store the whole wheat flour for daily usage? However I don't think that either really addresses specifically the concern of bugs, or the preferred storage location of pantry vs. fridge vs. freezer. I don't do much baking, but I wouldn't be opposed to starting (provided that my flour doesn't get bugs in it!) For now though, most of my uses of flour would be in small amounts for stovetop recipes and the occasional breading, so I'm not too concerned about my flour not rising properly (mentioned here), or throwing off the baking time because of a temperature difference (mentioned here). Is the fridge enough to stop the bugs? Or is a freezer necessary? Is the container being airtight the only thing that matters? EDIT: In response to a comment, I am located in Minnesota, in the United States Midwest region. 
Based on my personal experience of living in a 100-year-old apartment building, where both pantry moths and flour beetles were basically chronic: The freezer will prevent bugs more effectively than the fridge, which also works better than the pantry.  Particularly, the fridge only keeps bugs from hatching, but the freezer will often kill the eggs.  Both the freezer and the fridge (per the other questions) also have the benefit of making whole grains last longer. However, a lot of us simply don't have the space to put all of our grains and legumes in the fridge or freezer.  If you need to put them in the pantry, here's a guide:  Store all grain items, including flour, pasta, crackers, rice, etc., and all dried legumes in airtight thick-walled containers.  Glass jars are ideal for this, but heavy hard-walled plastic containers will also work.  Plastic bags are insufficient, as flour beetles can tunnel through a freezer bag. Yes, this means removing even new, unopened items from store packaging and putting it into a hard-walled container. Regularly, at least 3 or 4 times a year, take your whole pantry apart, scrub all surfaces, walls, and cracks, and inspect all containers for infestation.  If anything is infested, throw it out outside and clean the container with boiling hot water (or the dishwasher).  If you notice moths or beetles, do this cleaning step immediately.  This works because pantry moths, flour beetles, roaches, and other pantry pests come from three sources:  They're already in the product. Bugs often infest grain products in the warehouse or at the store, since they have an effectively infinite food source there.  While strong AC at markets will prevent the eggs from hatching, it doesn't kill them and they hatch once you get them into your nice, warm pantry. They're already in your home.  Pantry pests are able to survive on very little food or water and are legendarily difficult to permanently eradicate, since eggs can survive in tiny crevices. They enter your home from outside in search of food.  This is more true of moths and roaches than it is of beetles.  Airtight, thick-walled containers keep pests isolated on either side of the container, so the pests infesting a store product don't get out, and the ones in your home don't get in. The combination of containers and keeping your pantry scrubbed removes temptation for nearby pests, so they don't have a reason to crawl/fly to your pantry in the first place. 