A method for the calculations of the Gilbert damping parameter $alpha$ is presented, which based on the linear response formalism, has been implemented within the fully relativistic Korringa-Kohn-Rostoker band structure method in combination with the coherent potential approximation alloy theory. To account for thermal displacements of atoms as a scattering mechanism, an alloy-analogy model is introduced. This allows the determination of $alpha$ for various types of materials, such as elemental magnetic systems and ordered magnetic compounds at finite temperature, as well as for disordered magnetic alloys at $T = 0$ K and above. The effects of spin-orbit coupling, chemical and temperature induced structural disorder are analyzed. Calculations have been performed for the 3$d$ transition-metals bcc Fe, hcp Co, and fcc Ni, their binary alloys bcc Fe$_{1-x}$Co$_{x}$, fcc Ni$_{1-x}$Fe$_x$, fcc Ni$_{1-x}$Co$_x$ and bcc Fe$_{1-x}$V$_{x}$, and for 5d impurities in transition-metal alloys. All results are in satisfying agreement with experiment.