(Reuters) - IBM Corp is nearing an agreement to acquire software company Red Hat Inc in a deal that could exceed $30 billion (23.4 billion pounds) and help diversify its business away from technology hardware and consulting, people familiar with the matter said on Sunday.

The deal would be by far IBM's biggest acquisition. It underscores IBM CEO Ginni Rometty's efforts to expand the company's subscription-based software offerings, as it faces slowing software sales and waning demand for mainframe servers.

An agreement between IBM and Red Hat is expected to be announced later on Sunday, the sources said, asking not to be identified because the matter is confidential. IBM and Red Hat did not immediately respond to requests for comment.

Red Hat specializes in Linux operating systems, the most popular type of open-source software, which was developed as an alternative to proprietary software made by Microsoft Corp .

Red Hat charges fees to its corporate customers for custom features, maintenance and technical support. It has a market capitalisation of $20.5 billion. IBM has a market capitalisation of $114 billion.

To be sure, IBM is no stranger to acquisitions. It acquired cloud infrastructure provider Softlayer in 2013 for $2 billion, and the Weather Channel's data assets for more than $2 billion in 2015. It also acquired Canadian business software maker Cognos in 2008 for $5 billion.

IBM has faced years of revenue declines as it transitions its legacy computer maker business into new technology offerings and services. It posted a bigger than expected drop in quarterly profit earlier this month.

(Reporting by Liana B. Baker and Greg Roumeliotis in New York; Editing by Cynthia Osterman)

euronews provides breaking news articles from reuters as a service to its readers, but does not edit the articles it publishes. Articles appear on euronews.com for a limited time.