Set clear groundrules and without labouring the point outline why adherence is necessary. Be sure to follow your own rules and expect the students to do likewise. Be prepared to express controlled irritation when rules are not being followed. Do this early and you will not need to do it often. Attentive students will appreciate you for this.
Unruly students are likely to change their behaviour or leave.
Get to know at least some of your students. Be able to address them by name. Anonymity mitigates against control. More positively, rapport enables greater understanding of the students' learning needs and an earlier identification of difficulties. Be strategic in dealing with difficult situations arising with students.