From the National Coffee Association:
Keep beans airtight and cool
Your beans’ greatest enemies are air, moisture, heat, and light.
To preserve your beans’ fresh roasted flavor as long as possible, store them in an opaque, air-tight container at room temperature. Coffee beans can be beautiful, but avoid clear canisters which will allow light to compromise the taste of your coffee.
Keep your beans in a dark and cool location. A cabinet near the oven is often too warm, and so is a spot on the kitchen counter that gets strong afternoon sun.
Coffee’s retail packaging is generally not ideal for long-term storage. If possible, invest in storage canisters with an airtight seal.
Buy the right amount
Coffee begins to lose freshness almost immediately after roasting. Try to buy smaller batches of freshly roasted coffee more frequently – enough for one or two weeks.
Exposure to air is bad for your beans. If you prefer to keep your beans in an accessible and/or attractive container, it may be a good good idea to divide your coffee supply into several smaller portions, with the larger, unused portion in an air-tight container.
This is especially important when buying pre-ground coffee, because of the increased exposure to oxygen. If you buy whole beans, grind the amount you need immediately before brewing.
Freezing your beans?
Freshness is critical to a quality cup of coffee. Experts agree that coffee should be consumed as quickly as possible after it is roasted, especially once the original packaging seal has been broken.
While there are different views on whether or not coffee should be frozen or refrigerated, the main consideration is that coffee absorbs moisture – and odors, and tastes – from the air around it, since it is hygroscopic (bonus vocabulary word for all the coffee geeks out there).
Most home storage containers still let in small amounts of oxygen, which is why food stored a long time in the freezer can suffer freezer burn. Therefore, if you do refrigerate or freeze your beans, be sure to use a truly airtight container.
If you choose to freeze your coffee, quickly remove as much as you need for no more than a week at a time, and return the rest to the freezer before any condensation forms on the frozen coffee.
Freezing your beans does not not change the basic brewing process.