US President Barack Obama on Wednesday warned his successor Donald Trump not to make deals with Russia for the sake of political convenience, as the outgoing head of state tried to reassure allies on a European farewell tour.

Trump should not "take a realpolitik approach and suggest that if we just cut some deals with Russia, even if it hurts people or even if it violates international norms or leaves smaller countries vulnerable ... that we just do whatever's convenient at the time," Obama said.

Trump, who will be sworn into office early next year, has spoken favourably about Russian President Vladimir Putin but no one knows how he plans to approach the bilateral relationship between Washington and Moscow.

Obama was speaking at the German chancellery after his last official meeting with Chancellor Angela Merkel, whom he recently referred to as "probably his closest international partner these past eight years."

Both leaders spoke glowingly about each other's leadership, with Merkel thanking Obama for "eight years of close and friendly cooperation" and admitting it was "hard ... to say goodbye."

The relationship between Obama and Merkel has been characterized for the most part by mutual appreciation, though spying revelations caused some upheaval in 2013.

Merkel said that although they had not always seen eye-to-eye, they had worked together on a series of issues including protecting privacy in the fight against terrorism and pushing for trade deals.

She admitted that one of those deals - the TTIP free trade agreement between the US and the EU - was currently on ice, but that "we will hold on to what we have achieved" and "return to it one day."

The leaders also addressed the controversial topic of whether Merkel will run for a fourth term in next year's general election. While Merkel remained tight-lipped, Obama said that if he were German and had a vote he would support her.

Ahead of the press conference, Merkel and Obama talked about Trump's surprise victory in the US election, the Ukraine crisis, international terrorism and populist movements in Europe.

The European Union is "one of the world's greatest political achievements and should not be taken for granted," Obama said, adding that these achievements "need to be nurtured and cultivated and fought for."

Obama arrived in Germany late Wednesday after meeting Greek leaders and speaking in Athens about the value of democracy. He will visit Peru on the last leg of his final international tour as president.

The US president is scheduled to remain in Germany until Friday, when he will meet European leaders including Merkel, British Prime Minister Theresa May, French President Francois Hollande, Spanish Prime Minister Mariano Rajoy and Italian Prime Minister Matteo Renzi.