There is uncertainty about the information whether Lord Rama worshipped Lord Shiva and installed Shiva Lingam at Rameswaram.
Valmiki Ramayana does not specify to the fact directly.
But it states Rama worshipped Shiva at Rameswaram.
That Rama installed a Shiva lingam is referred to in Adhyatma Ramayana,Shiva Purana,Linga Purana,Skanda Purana, Padma Purana,Ramacharitamanas by Tulsidas and Shiva Daridra Dahana Stotra.
etat = this; (is the island); kukShau = located in the middle; samudrasya = of the ocean; skandhaavaara niveshanam = where my troops were stationed; atra = at this place; puurvam = formerly; prabhuH = the Lord; mahaadevaH = Shiva (the supreme deity); akarot = bestowed; prasaadam = his grace; (on me).
“See this island, located in the middle of the ocean, where my troops were stationed. At this place, the lord Shiva (the supreme deity) formerly bestowed his grace on me.”
Valmiki Ramayana,Yuddha Kanda,Sarga 123,Sloka 19.
Here is how Yuddha Kanda of Adhyatma Ramayana of Brahmanda Purana narrates the event:
सेतुमारभमाणस्तु तत्र रामेश्वरं शिवम् ।
संस्थाप्य पूजयित्वाह रामो लोकहिताय च ॥ १॥
प्रणमेत्सेतुबन्धं यो दृष्ट्वा रामेश्वरं शिवम् ।
ब्रह्महत्यादिपापेभ्यो मुच्यते मदनुग्रहात् ॥ २॥
सेतुबन्धे नरः स्नात्वा दृष्ट्वा रामेश्वरं हरम् ।
सङ्कल्पनियतो भूत्वा गत्वा वाराणसीं नरः ॥ ३॥
आनीय गङ्गासलिलं रामेशमभिषिच्य च ।
समुद्रे क्षिप्ततद्भारो ब्रह्म प्राप्नोत्यसंशयम् ॥ ४॥
During the construction of bridge, Rama installed Mahadev and worshipped him calling by the name Rameshwar Mahadev. He described his glory, “If someone visits the bridge (setubandh), and prostrates to Rameshwar mahadev he is liberated of the severest of sin of killing Brahmins.” Rama stated, “One should bathe here in sea, and having darshan of Rameshwar Mahadev, he should go to kashi, to fetch ganga water. Offering the Ganga water of Kashi over Rameshwar Mahadev, he should throw the pot in sea. Thus, he is bound to get salvation.”
One may get confused whether Rama installed idol form or Linga form. But it is Linga form and Lord Rama himself states it in Padma Purana Patala Khanda chapter 104:
विभिषणः कथमसौबद्धः श्रृंखलयानृभि: । मत्स्थापितंशिवलिङ्गंदृष्ट्वारामेश्वरंत्वहो ।।
Oh, how is it that Vibhisana seeing the Linga of Shiva, (called) Ramesvara and installed by me, is bound with chains.
In the above verse Rama tells “Mat Sthapitam Shiva Linga”… ie. That Shiva Linga installed by me.
In the Chapter 3 of Brahma Kund (3rd Canto of Skanda Purana)
“Describing how Sri Ram had installed Rameshwar linga, Sutji said–‘ After killing Ravan, Sri Ram enthroned Vibhishan as the king of Lanka. While returning to Ayodhya he made a brief stop at Gandhamadan mountain. Since the thought of having killed a brahmin (Ravan) kept on tormenting him, he decided to atone for his sins. In consultation with sages, Sri Ram decided to perform the ‘Pratishtha’ of Shiva Linga at the most auspicious ‘Muhurat’ and commissioned Hanuman to bring the Linga from Maha Deva at Kailasa Mountain. But Unfortunately however Hunuman could not meet the deadline of the Muhurat for the Consecration of the Linga and Devi Sita had to prepare a Sand Linga that was set up as a temporary stop-gap but in reality that became the real Linga . Meanwhile Hanuman returned from Kailasa but was highly disappointed and felt that all his efforts proved futile. Sri Rama consoled Hanuman also did the Pratishtha of the Linga brought by Hanuma.”
Rama instructed that Hanuma lingam should be worshipped first since it was brought by Lord Hanuman – the tradition continues even today.
In Chapter 18 of Koti Rudra Samhita of Shiva Purana It is said that
“Lord Rama After reaching Rameswaram beach and he was thirsty. When he was drinking water there he heard a celestial voice “you are drinking water here without worshipping me”’. Rama recognized that voice was of Lord Siva. Then he made a Sivalingam with beach sand and worshipped Lord Siva. He prayed Lord Siva to bless him to win the war, and vanquish Ravana. Lord Siva blessed Rama accordingly. He also prayed Lord Siva to reside eternally at Rameswaram so that entire mankind should benefit from it. Lord Siva agreed to Rama’s prayer and manifested Himself as Ramanatha Jyothirlingam and stayed there for eternity.”
According to a legend from Linga Purana,
“on the advice of Rishis, Rama wanted to consecrate at Rameswaram a shrine for Lord Siva to wash off the Brahmahatsya dosha – the sin of killing Ravana, a Brahmin. An auspicious time for the ceremony was fixed. Rama rushed Hanuman to Kasi to bring a Sivalingam. The auspicious time for the installation had neared, but Hanuman had not returned, Sita made a Sivalingam out of sand and the puja was performed to this Lingam at the stipulated time. It was consecrated as Ramalinga. Meanwhile, Hanuman returned from Kasi with two Lingams. He was disappointed that the ceremony was already over. In anger, he tried to uproot the sand Sivalingam with his tail, but in vain. Rama pacified Hanuman and installed one of the Lingams brought by Hanuman from Kasi to the left of Ramalinga, and ordered that all pujas be first performed for this Sivalingam, called Kasilingam or Viswanathalingam.”
This priority in puja is followed even today.
Reference in Shiva Daridra Dahana Stotram” composed by Rishi Vasistha.
“Ramapriyaya Raghu nada Vara Pradhaya,” meaning “Who is dear to Rama ,Who granted boons to Rama’
सैल बिसाल आनि कपि देहीं। कंदुक इव नल नील ते लेहीं।।
देखि सेतु अति सुंदर रचना। बिहसि कृपानिधि बोले बचना।।
परम रम्य उत्तम यह धरनी। महिमा अमित जाइ नहिं बरनी।।
करिहउँ इहाँ संभु थापना। मोरे हृदयँ परम कलपना।।
सुनि कपीस बहु दूत पठाए। मुनिबर सकल बोलि लै आए।।
लिंग थापि बिधिवत करि पूजा। सिव समान प्रिय मोहि न दूजा।।
सिव द्रोही मम भगत कहावा। सो नर सपनेहुँ मोहि न पावा।।
संकर बिमुख भगति चह मोरी। सो नारकी मूढ़ मति थोरी।।
The monkeys brought huge mountains, which were received like playballs by Nala and Nila. When the All-merciful saw the exceedingly beautiful construction of the bridge, He smiled and observed thus: ìThis is a most delightful and excellent spot; its glory is immeasurable and cannot be described in words. I will install (an emblem of) Lord Sambhu here: it is the crowning ambition of My heart. Hearing this the lord of the monkeys despatched a number of messengers, who invited and fetched all the great sages. Having installed an linga of Lord Shiva and worshipped It with due solemnity, He said, “No one else is so dear to Me as Shiva. An enemy of Shiva although he calls himself a devotee of Mine, cannot attain to Me even in a dream. He who is opposed to Shankara and yet aspires for devotion to Me, is doomed to perdition, stupid and dull-witted as he is.”
Then the 2nd Doha states:
संकर प्रिय मम द्रोही सिव द्रोही मम दास।
ते नर करहि कलप भरि घोर नरक महुँ बास।।2।।
Men, who, though devoted to Shankara, are hostile to Me and even so those who are enemies of Shiva but votaries of Mine shall have their abode in the most frightful hell till the end of creation.
Then the Chaupai of 2nd Doha states:
जे रामेस्वर दरसनु करिहहिं। ते तनु तजि मम लोक सिधरिहहिं।।
जो गंगाजलु आनि चढ़ाइहि। सो साजुज्य मुक्ति नर पाइहि।।
होइ अकाम जो छल तजि सेइहि। भगति मोरि तेहि संकर देइहि।।
मम कृत सेतु जो दरसनु करिही। सो बिनु श्रम भवसागर तरिही।।
राम बचन सब के जिय भाए। मुनिबर निज निज आश्रम आए।।
गिरिजा रघुपति कै यह रीती। संतत करहिं प्रनत पर प्रीती।।
बाँधा सेतु नील नल नागर। राम कृपाँ जसु भयउ उजागर।।
बूड़हिं आनहि बोरहिं जेई। भए उपल बोहित सम तेई।।
महिमा यह न जलधि कइ बरनी। पाहन गुन न कपिन्ह कइ करनी।।
They who will behold Lord Ramesvara will, on quitting the body, go direct to My sphere in heaven. And a man who takes the water of the Gangå and pours it on the Lord will attain liberation in the form of absorption into My being. Again, whosoever adores the Lord in a disinterested spirit and without guile, will be blessed by Sankara with devotion to Me. And he who sees the bridge erected by me will be able to cross the ocean of worldly existence without any exertion. Ramas words gladdened the heart of all and the great sages returned each to his own hermitage. Girijå, (says Sankara,) such is the way of the Lord of the Raghus: He ever loves those who take refuge in Him. The clever Nala and Nila constructed the bridge and by Råma’s grace their renown spread far and wide. Those very rocks that not only sink themselves but cause even other things to sink alongwith them floated like so many rafts. This is, however, not ascribed to any miraculous power of the ocean, nor to a virtue of the rocks themselves, nor again to any skill of the monkeys.
Source.The Lanka Kanda 1st Dohas