Learn how to get the Mono beta up and running for deploying .NET applications to Linux and other platforms.

The Mono Project has to be one of the most eagerly awaited open source projects for developers, bringing the .NET framework to Linux and other platforms, opening up a range of possibilities for application deployment.

Recently, Beta3 of the Mono project was released and in this article we are going to look at how to get the beta up and running on Linux, and how to deploy your first .NET application to the Mono platform.

If you are Windows developer who is considering using Linux to host your .NET applications, the Mono beta provides a good way to test and tweak your applications before making the move.


Editor's Note:
Mono Beta 3 (like all betas) should only be used for testing purposes only and is not recommended for production use.

For this walk-through we are going to use Red Hat 9.0 as our platform to install and configure Mono. If you don't have a Red Hat or other Linux server available, you can download the Red Hat installation ISO's from here

If you don't have a spare computer or server to load RedHat, you can turn your existing machine into a dual-boot machine but it may be easier to use a virtual machine like VMWare but make sure you read through any installation notes for installing Red Hat.

Once you have Red Hat up and running, you will need to download the Mono Beta3 from the the Go-Mono Web site. There are different versions depending on the operating system you are using, including:

  •  Red Hat 9.0/x86
  •  Fedora Core 1/x86
  •  Fedora Core 2/x86
  •  SLES 8/x86
  •  SUSE 9/x86
  •  SUSE 9.1/x86
  •  Windows (2000 and above)
  •  Mac OS X

For this article we are going to download the Red Hat 9.0/x86 version.There are two different ways you can download the beta-either one large zip file with everything in it or as individual RPM files.


About RPM
If you are new to Linux, RPM stands for "Red Hat Package Manager" and is a standard file format used to deploy software packages on Linux using the RPM Package Manager. You can find more information on RPM here.

The easiest way to install the Mono beta is to download the zip file that contains all of the RPM files that you need. Once you have unzipped the RPM files, you may try to install each of the individual packages by double-clicking each package to launch the installer, but there may be dependencies or other applications that need to be installed first. The easiest way to install all of the RPM files at once is from the command line.

Make sure you are logged in as the root user and then use the command line below to install all of the packages at once:

rpm -Uvh --nodeps *.rpm

If you already jumped ahead and installed a couple of the packages or if you already had some of these packages installed, you can force the installation of all of the Mono packages using:

rpm -Uvh --nodeps --force *.rpm


Tip: For more options when using RPM at the command line, type RPM -help or visit the RPM "How-To" document here.

Once you have installed all of the RPM packages, we need to go do some testing to make sure that all of the Mono components are running. Mono has it's own light-weight Web server called XSP which was written using C# and ships with a number of test pages you can use to determine if the Mono beta is installed and working.

To start the XSP Web server, open a terminal and run:

mono /usr/bin/xsp.exe --port 80

With the Web server up and running, you can now view the test .ASPX pages that ship with the Mono beta by navigating to http://127.0.0.1/test/ where you should see the default Web page shown below:


Figure 1: Sample .ASPX pages

There are a number of sample .ASPX pages that you can use see how Mono handles different ASP.NET features, including user interface controls, code-behind and different techniques for data binding and some sample Web services and documentation.


Note: Some the samples require additional setup. For example, some of the data binding examples require a database table to be created. In most examples, the instructions will be included in the error message that is returned when you attempt to view the page.

Now that you have confirmed that Mono is installed and that the Web server is up and running, we can start testing out your own .NET applications. One of the RPM files in the zip file provided with Beta 3 contains a copy of MonoDevelop, an open source IDE that you can use to develop applications based on the Mono framework. You can find the Mono Develop icon in the program menu under Programming > More Programming Tools > MonoDevelop.


Figure 2: The MonoDevelop IDE

Once you are in the MonoDevelop IDE, you can use the import option under the File menu to import a Visual Studio project and then compile and run it from within the MonoDevelop IDE. And don't forget, Mono supports C# but not VB.NET, so make sure any apps you want to test are written in C# before attempting to port them over.

Whether you are a Linux developer who is looking for a new toolset or a .NET developer looking for a new platform, Mono Beta 3 has a little bit of something for everyone.


Discuss this in the Builder Forums
Do you have a related question or comment? You can access our C# forum from here and post your questions, reply to other users, search for answers and more.

Additional Resources:
Mono Web Site
Mono Beta 3 Download
Mono Kick Start
Mono, Portable .NET and .NET: Cross-Platform Coding

Do you need help with .Net? Gain advice from Builder AU forums

Related links

Comments

1

Greg Shaw - 01/07/04

Thanks for the article. I was wondering how to get started.
Some feedback though. To run xsp.exe you need to be
in /usr/share/doc/xsp beforehand. And the port option is actually --port
not -port.

» Report offensive content

2

John Bonnett - 02/07/04

The line should be
mono /usr/bin/xsp.exe --port 80
not
mono /usr/bin/xsp.exe -port 80

» Report offensive content

3

David McAmis - 02/07/04

Well spotted! Word automatically converts double-dashes to a single "em" dash. I have corrected the article code.

» Report offensive content

4

Stanley Mitra - 09/03/05

Can i run my .NET program on Linux operating sytem?

Can I state that .NET is copmletely OS independent?

» Report offensive content

5

Ngoni Munyikwa - 11/09/05

100%.This is Excellent.Man i don't know how to thank you.I've been battling this for over 3 weeks now.God Bless.If only other Linux newbies out there could land themselves on this article,it will save them from premature hair loss!!.Thanks again

» Report offensive content

6

Dwight Walker - 09/01/06

I have been upgrading DotNetNuke which runs on .NET Framework and ASP.NET 2.0. It involved finding tools to query SQL Server to do backups and minor patches to get the new version running - I found MSDE.biz has a good little simple tool to do this. I would welcome a Linux IDE for .NET like Mono - I will try it once I know my version of Gtk will run it - I have an old version of Red Hat Linux running. Currently Microsoft provide Visual Web Developer 2005 Express but it has bugs. I also found sharpdevelop.net which is an open source Windows based IDE which looks very cool. The trouble with Microsoft is it is so big it can afford to have 1/2 baked products because people just have to wait for upgrades because they have so much at stake. I have 3 different systems: Linux, FreeBSD and XP. So if one is down or doesn't have tools I can rely on another one. Warning: have plenty of money if you want to develop using Microsoft. It takes tons of time to maintain the middleware - you need to be a DBA - compared to phpMyAdmin which is so easy for PHP and MySQL. I only had to get MSDE.biz because I could not find an equivalent of phpMyAdmin for SQL Server running on PHP or ASP.NET. I wrote some lines of PHP and accessed SQL Server fine. There is more to be done in PHP for SQL Server administration I think. PHP is cross platform.

» Report offensive content

Leave a comment

You must read and type the 6 chars within 0..9 and A..F

* indicates mandatory fields.

6

Dwight Walker - 01/09/06

I have been upgrading DotNetNuke which runs on .NET Framework and ASP.NET 2.0. It involved finding tools to query SQL Server ... more

5

Ngoni Munyikwa - 09/11/05

100%.This is Excellent.Man i don't know how to thank you.I've been battling this for over 3 weeks now.God Bless.If only other ... more

4

Stanley Mitra - 03/09/05

Can i run my .NET program on Linux operating sytem? Can I state that .NET is copmletely OS independent? ... more

Log in


Sign up | Forgot your password?

  • Staff Microsoft shows off IE9 preview

    This week, highlights from Microsoft's MIX10 conference and more in the Roundup. Read more »

    -- posted by Staff

  • Chris Duckett IE9's H.264 vote killed Ogg

    In a split decision by the judges, the winner of the W3C/WHATWG video codec consensus is H.264, taking home the future of video playback on the internet while loser Ogg goes home with nothing but thoughts of what might have been. Read more »

    -- posted by Chris Duckett

  • Staff Google launches Apps Marketplace

    Google launches and app store, while Mozilla plans to re-write its open-source license. More of this week's news in the Roundup. Read more »

    -- posted by Staff

What's on?

  • Optus Deal

    Broadband + home phone + PlayStation®3 in a single package price!