You will have to apply for a 3 months or a 1-year Non-B visa with your local Thai embassy before travel to Thailand. Unfortunately, Thai law prevents anyone from getting a Visa within Thailand, so you will have to apply outside.
Document Preparations and Visa Procedure, Request for teaching permit without a License for Teaching Profession, Applications for Visa and Work Permit.
Application for Non Immigrant B Visa
Before applying for Work Permit, a foreign teacher needs to apply for Non-b visa at the Royal Thai Consulate abroad only. The nearest and most convenient in this case would be the Royal Thai Consulate in Penang, Malaysia.