I've had great luck storing rice, sugar, and salt in half-gallon mason jars and using a FoodSaver vacuum sealer's mason jar attachment to suck all the air out.
My store-bought rice has lasted 8 years without *any* deterioration in quality, before I got around to eating it.
Freeze the rice for at least 24 hours first to kill any bugs (all store-bought rice is infested with rice weevil eggs). Then wait at least several hours at room temperature before unbagging the rice (or moisture gets on then due to condensation).
For beans, the reason I don't vacuum seal dry beans, is because it's much nicer to have
already cooked food canned up. I have quart jars of canned pinto beans, black beans, red beans, split
pea soup, and chili. This to me is the ideal way to store them, and super easy to do. I forget whether they need to be waterbath-canned or pressure-canned, but you can look that up.
I've never stored corn, but if I did, I'd do the same: I like precooked canned corn from the store, so I'd consider canning your corn cooked (by which I mean, the canning process cooks it).
I strongly encourage learning how to can food. While it may seem dangerous and time consuming at first, it's super easy and convenient to can a seven or eight jars here or there in the mornings or evenings without
alot of fuss.
Once you get used to pressure canning, it's like 15 mins work, then just listen for the timer for 30 mins to adjust temperature, and set a timer again for when to turn it off. It's like doing laundry: put in wash, go do other stuff, put in
dryer for longer, go do other stuff, then come back.
There are some risks/dangers involved, but mostly just from people leaving their house and forgetting they had their stove burning turned on. If you're in the house, you can audibly (and loudly) hear if it's going bad and easily turn it off with plenty of advance warning. You could even just set the timers on your phone instead of the stove, incase you go outside and out of timer range.