Borrowed from Spanish rancho, from Old French se ranger (“to be quartered, take up a position”).
Practice speaking and memorizing "rancho" and many other words and sentences in Portuguese.