In order to make sure they would always be free did the Romans establish an army or build a wall around their city?

They did both -- built a wall around Rome and established an army.