When coffee is roasted, an oil is drawn to the surface of the bean. This oil is called coffee essence/coffeol/coffee oil. The oil is what makes coffee have its flavor. Without this oil, coffee would taste like a bitter brown powder.
Coffee oil is very fragile and will evaporate at an accelerated rate when exposed to oxygen or moisture. To prevent coffee from deteriorating, it should be stored in an air tight glass container at room temperature and placed out of direct sunlight. Glass should be used because it will not retain odor from the beans and will prevent contamination if you choose to store another type of bean in the same container.
Storing coffee in the refrigerator will destroy the flavor of the coffee. The moisture will dilute the oils, which are actually delicate water soluble substances. Refrigerators tend to be damp and most contain other odors which will be absorbed by the coffee bean.
Freezing is a better way to store coffee but the beans must be placed in a glass air tight container. Only lighter roasted coffee should be stored in the freezer. The darker roasted coffees tend to be more fragile.