How to ordain and last long in the monk life?

Was that what the laypeople usually did in the time of the Buddha or after according to the texts?