That will be difficult in a country that has not had a functioning government since clan-based commanders toppled in 1991 Mohammed Siad Barre, the then president.
A massive UN relief operation was launched for thousands of Somalis left starving because of fighting after Siad Barre's ouster.
But the commanders soon turned on each other, sinking Somalia's several million people into chaos.
The current transitional government, backed by Ethiopian troops, is facing an armed campaign led by the Islamic Courts' Union that has killed thousands of civilians.
The Security Council's resolution showed the council's determination to support efforts by Ban Ki-moon, the UN secretary-general, to promote a political settlement and improved security in Somalia while holding out the carrot of a UN peacekeeping force.
The British-sponsored resolution was changed at the last minute at South Africa's insistence to strengthen the language on a future UN peacekeeping force.John Sawers, Britain's UN ambassador who is the current council president, called the resolution "a step forward".
He said it encourages the transfer of the UN political office from Nairobi to Somalia and backs UN-supported efforts to broaden the political base of the transitional government.
But he cautioned against immediate results.
"The UN can't bring peace to Somalia overnight. It's a long, hard road to peace in a country that has not known effective government for 17 years," Sawers said.
"Many things can go wrong, but the Security Council is backing those efforts, not just rhetorically but in practical terms as well.
Dumisani Kumalo, South Africa's UN ambassador, said the resolution indicates that "if the political conditions are right, if the security situation on the ground is right, this council will do something".
"It sends a signal to the Somali people that we have heard their cries. It sends a signal that this council is serious," he said.