In order to formally register as a university student in Turkey, as well as be granted a residency permit once you arrive, you must obtain a student visa. You should do this before you leave your home country, as this is the standard procedure and a requirement of Turkish law.
A student visa cannot be granted from inside Turkey. You must visit the Turkish consulate in your home country prior to your departure. You will need to complete an application form for a student visa, and along with a copy of your ‘Letter of Acceptance’ from a Turkish University, must either mail, or take them along in person, to the Turkish Consulate in your country of nationality. An application form for a student visa can be requested from and provided by Turkish Consulate staff. Once you have submitted your application by one of the methods above, you can expect to wait around eight weeks before you receive your visa. This will be stamped into your passport.
Please note, that whilst there will be a time limit displayed on the visa, it will in fact remain valid while ever you are enrolled in university.