Buy freshly roasted beans. Coffee begins to age the moment it hits the roaster's cooling tray.
Use the proper grind for the brewing method of your choice.
Use fresh, cold water, preferably filtered. Chlorine makes your coffee taste bad.
Make sure that your brewing water has reached an optimum temperature of 200°-205°.
Always store your coffee in an air tight container.