Shares in Linux software developer and services provider Red Hat (NYSE: RHT) surged more than 7 percent early Monday after a Wall Street analyst upgraded its stock to a "buy" with a target price as high as $32. The stock rally continued on Tuesday with shares closing at $18.16, up another 22 cents or 1.23 percent.

Shares ended the day up 4.8 percent, or 82 cents, to close at $17.94 on Monday.

UBS analyst Heather Bellin, who had listed as a hold with a price of $16, said the possibility of a “takeout” increased the potential value of RHT shares. Takeout refers to a potential buyout or merger and acquisition.

“To be clear, our upgrade to Buy is not based on the prospect of the company getting acquired, although we see that as a very likely end result as we look out over the next 12-24 months,” Bellin said.

Bellin noted that Oracle’s $7 billion-plus deal for Sun Microsystems factored into her analysis.

“While many see a takeout as no longer likely, we see RHT as now an even more strategic asset,” Bellin wrote. “Although our upgrade is not based on a takeout (although likely 1-2 yrs out), we see M&A valuation of 7-10x EV/LTM [valuation of its financial metres] subscription [revenue] implying $23-$32.”

Red Hat shares have ranged as high as $24.36 to as low as $7.89 over the past year. The company also has been the subject of takeover rumors on numerous occasions. Two weeks ago, TheFlyOnTheWall Web site and a Barron’s blogger speculated that a rally in Raleigh-based Red Hat shares this week is a reaction to the Oracle-Sun deal that left IBM on the outside looking in for open source opportunities. IBM pulled out of talks to acquire Sun before Oracle moved in.

Red Hat Chief Executive Officer Jim Whitehurst recently told the U.K.’s CIO Web site that the Oracle-Sun deal could helpRed Hat . He also said Red Hat has no plans to buy anyone as a counter to Oracle’s move.

"We were a bit surprised like everybody else [by the deal]," Whitehurst told CIO. "We’ve got good relationships with both and we assume that will continue going forward."

He stressed that Red Hat wants to be the “Switzerland” for enterprise software – in other words, a partner to all.

Bellin pointed out that Red Hate shares had declined in value in March on news that Chairman Matthew Szulik had sold some 115,000 shares.

However, Bellined to cite three reasons for upgrading the Raleigh-based firm’s stock.

“1) We view CFO guidance for [calendar year] 09 as conservative w/upside to [calendar year] 10,

“2) Despite negative sentiment post last week’s IDC server trends [report], there is data that suggests RHT’s deferred signings will be more resilient than the server trends and

“3) We view Oracle/JAVA as increasing the strategic value of Linux, and by default RHT.”

Red Hat’s Enterprise Linux product competes with Oracle and Sun (Java) products.”

“[O]ur view that Linux, and by default Red Hat, has seen its strategic value rise as a result of Oracle’s acquisition of Java (both from a customer and a competitor perspective),” Bellin added.