Coffee as it turns out is a complicated and VERY subtle process. Here's an overview of what can affect your final outcome:
Growing Location --> Time of Season --> Rain --> Quality of picked beans --> Handling --> Shipping conditions --> Storage conditions --> Roasting Style --> Time from roasting to grinding --> Time from grinding to brewing --> Temperature of water --> Brewing method --> Temperature of drinking.
Seriously, it's ridiculous! But, assuming you've bought your beans from a reputable source, what you do starts with the roasting/storing part of the process.
So, First things first:
Buy Freshly Roasted Coffee Beans
Look around on the internet and you're likely to find some coffee roasters in the area! I get my beans for $6 a 1/2 lb (0.23kg) at my local farmer's market. She roasts every day, and so I get them hours after they've been roasted! Now, as an aside, all roasting is not equal. There are darker roasts, lighter roasts, and different roast styles (drum roasted vs air roasted). You'll need to decide what YOU like and find a location, color roast, and your preferred roast style. Fortunately you can help weed out poor quality coffee by seeing if the roaster is passionate about what they do. If they are, and you feel like giving it a shot, then ask them for a suggestion! I guarantee that just about anything you get freshly roasted will be better than something sitting on a shelf for a month at the store.
Store Your Beans Properly
What's cool about coffee is that the chemical reactions of the coffee isn't done once you roast it. Coffee actually can take up to a week to mature (depending on blend/roasting style). When you first get your beans they won't smell like much and are pretty dry. Over the next few days you'll find that the beans start to bead up with volatile oils, and will eventually be glistening and soaked in it. I'll try to post some day by day pictures of coffee beans as they mature, but this is essentially the point where the coffee is at it's peak. After this your coffee will start to get more bland as the volatiles continue to evaporate out.
So, take your fresh beans and keep them at room temperature. If you put them in the fridge or freezer, you'll risk moisture ingress from condensation when you open the bag. The freezer can also damage the flavors, so in my opinion it's not worth it. Just buy what you're going to use in less than 2 weeks. You can always try another blend if you run out ;)
Grind Your Beans When You're Ready to Brew
Don't grind your beans until you're completely ready to start brewing, IE the water is heating and you've got <5 minutes before you're going to pour the water. Grinding exposes the flavors, and like an apple, the coffee will start to oxidize right away! Now, mere mortals like you and I may not tell the difference between 1 or 2 minutes delay, it's just good habit to be ready to pour once you're done grinding.
Use a Burr Grinder
Coffee is a steeping process. You are attempting to extract specific flavors from a coffee bean without extracting too little (weak and bland coffee) or too much (very acidic and astringent). Whatever method you use, in the end you're trying to get a consistent coffee grind that each particulate has the same surface area to volume ratio so they all extract evenly, ideally the same size as well. When you have grind that is too fine, it over steeps very quickly. When you have coarse grind, it takes significantly longer to pull out the desirable flavors and you need to modify the water temperature accordingly. When you have a large variety of grind size, you will result in under extracted large particulates, and over extracted fine particulates with the resultant brew both weak and astringent. Burr grinders are the defacto standard as they generally produce consistent desireable grind sizes as opposed to blade grinders that typically results in inconsistent grind. Blade grinders also heat up the coffee significantly more and drive out the tasty volatiles!
Note that while most good burr grinders are expensive, you can get a manual Hario Skerton grinder for <$35 online.
Seriously, The grinding part of coffee is one of the most important steps. Good coffee ground poorly will result in poor coffee.
Use a Thermometer
The brewing process does matter, but more importantly, the water temperature needs to be appropriate for how you're brewing. In general you should be making sure your water is at ~191°F (~88.5°C). Brewing at the right temperature will prevent you from dissolving flavors that you don't want! It also means you can extract the flavors you do want! It may seem silly that a few degrees either direction makes a difference, but I've gotten results with all else equal, from bitter and undrinkably strong, to weak and bland. If you're using water that was just boiling, you probably shouldn't.