The first is to can it. You might not have access to a canner so that's not realistic, but if you do, look into it.
The other way is 5 or 6 gallon buckets. You can buy buckets and lids (always get #2 plastic) at Home Depot or Lowe's. If you're enterprising and willing to clean them, you can get them at bakery shops or italian restaurants that use feta cheese.
You put mylar bags ($2 apiece) in the buckets and the rice/wheat/beans/etc. inside that. There are 2 ways to go here.
The first is to fill it up and put a chunk of dry ice on top, then seal the bag with an iron or hair crimper. The dry ice will suck out the air and replace it with carbon dioxide, which will serve to both allow the food to last longer and keep the critters out because there's no oxygen.
The way we did it is fill the bags part way, put in some bay leaves and food-grade diatomaceous earth in layers. The critters hate bay leaves and the earth (my thanks to Steve888 for that) because it dissolves their exoskeleton (and it's healthy to eat). Put some oxygen absorbers on top, suck out as much air as you can, and seal it.
Studies have shown canned food can last up to 30 years if you keep it in a cool basement with minimal moisture (ie. don't let the can rust through). We do have some canned food. In the buckets they don't last as long - 10 years tops. 10 years will be more than enough time.