Basic article on the various ways to store and roast coffee.
Unfortunately, growing coffee is much more difficult, requiring climates which you may not have...
So, you can attempt to store enough coffee to last until you die... That is a lot of coffee.
http://modernsurvivalblog.com/survival-skills/green-coffee-beans-for-long-term-storage/#more-15127The main point, the important point, is that green, unroasted coffee beans have a very long storage life, if properly packaged.
You can readily buy green coffee beans right now.
You will need a way to roast your beans. Be warned, this is not something you should do inside your kitchen. Particularly if you live in an apartment.
You do not want to roast anywhere near a smoke detector. Outdoors is best and it takes some time to do a full roast.
I recommend that you also plan on coffee alternatives. There are other threads about these in this forum.