Yes, it is an obligation. Throughout Islamic history and beyond, jurists discussed the issue of the caliphate (khilafah) and concluded it to be an obligation without which the Islamic way of life, i.e. Islam, would not be possible.
A few quotes of the scholars:
Ad-Darami said in his Sunan:
"On the authority of Tamim Ad-Dari who said: 'People were ...