Magnetic anisotropy and magnetic phase transitions in R2Fe17 with R = Y, Ce, Pr, Nd, Sm, Gd, Tb, Dy, Ho, Er, Tm and Lu