How do you talk to your children about telling you things

How do you get children to talk about things especially when they think they will get in trouble if they say any thing?

How do kids open up about school?

How do you get kids to understand about not letting others touch you, not touching others or watching anything inappropriate or to not be alone with someone closed doors. That if anything bothers they can speak to a parent.