You should start your preparations from the end of 2nd year i.e from 4th semester or beginning of 3rd year i.e 5th semester. You can either learn online or join coaching classes like GATEFORUm, GATE ACADEMY etc.