Tech Talk 3 by Miguel de Icaza
Server Windows to Linux Migration
It's the New Black
April 2008
Features
- Tech Talk 01 With all your data in your OpenOffice.org Base database, how do you access it to help make decisions? Query your database to help you analyze your data
- Tech Talk 02 If you didn't make it to BrainShare or just want a recap of the keynote messages this article is for you. The Novell executives walk you through the latest and greatest in Novell strategy and technology.
- Tech Talk 03 Attention Web enterprise developers: Mono is ready to take on the Microsoft-dominated ASP.NET stack. You can now deploy your software on Linux-based servers without the powers that be feeling a thing.
- Tech Talk 04 Lengthy release cycles are a thing of the past. We want to know what you want, and we want to deliver it to you now.
Departments
- Proof Point As a non-profit organization, Sesame Workshop has a small IT staff with a big job. They've found the extra help they need with Novell ZENworks Asset Management and SUSE Linux Enterprise Server.
- Trend Talk Are tightening budgets forcing you to consider other options? Start considering other office productivity suites (and some are online offerings) to release the strangle hold proprietary vendors might have on you-and your budget.
Some of the ASP.NET applications we have made available include:
- ASP.NET's Blog Starter Kit
- ASP.NET's Classifieds Starter Kit
- ASP.NET's Club Web Site
- ASP.NET's IBuySpyPortal
Some open source packages that support Mono out of the box are:
- MonoBlog
- MonoForums
- dekiwiki
- MojoPortal
Installing our Packages
If you want to take our various Web sites for a test drive, you can use our repositories and the SUSE built-in installation tools to do this.
On OpenSUSE 10.3
1. Add Mono:Community to Zypper:
zypper ar http://download.opensuse.org/repositories/Mono:
/Community/openSUSE_10.3 monocom
2. Search for a package (for example, ?ibuyspy?) to get the full name of the package to install; it's listed in the Name column:
zypper se ibuyspy
3. Install ibuyspy using the full name of the package:
zypper -r in Mono_ASP.NET_IBuySpyPortal
On SUSE Linux Enterprise
1. Add Mono:Community to ZMD
rug sa -t yum http://download.opensuse.org/repositories/Mono:
/Community/SLE_10 monocom
2. Search for ibuyspy to get the full name of the package to install; it's listed in the Name column:
rug se ibuyspy
3. Install ibuyspy using the full name of the package:
rug in Mono_ASP.NET_IBuySpyPortal
Learning from our Ports
Let's explore a well-known ASP.NET application, the ?Classifieds Starter Kit?, originally available from http://www.asp.net/downloads/starter-kits/classifieds/.
You can download our source rpm from: http://download.opensuse.org/repositories/Mono:
/Community/openSUSE_10.3/src.
To explore the port, you will need to install this .src.rpm package. Type the following command as root: rpm -i Mono_ASP.NET_ClassifiedsStarterKit-1.0.0-20.1.src.rpm
Once you do this, RPM will leave the source files in /usr/src/packages/SOURCES. You'll find two files there: a tar file with the original contents, and a patch file that is used to alter the original tar package to port it.
Most of the changes in the patch file are used to port the application from SQL server to PostgreSQL using the Npgsql database provider, which is included with Mono. But it also deals with a few differences between deploying on Linux and deploying on Windows. You can read more about the differences on the Mono Project Web site, http://www.mono-project.com/Guide:_Porting_ASP.NET_Applications.
You will find the file that drives the packaging of the Classifieds Starter Kit in the /usr/src/packages/SPECS directory. The spec file creates a few configuration files. For example, it creates an Apache configuration file that publishes the starter kit on the /ClassifiedsStarterKit directory on the current server, and it provides a few configuration options to Mono to run the application.
One important feature in the Apache launch script is the use of the MONO_IOMAP environment variable. It instructs Mono to emulate the Windows file system semantics on Linux. Windows files are case insensitive and applications tend to depend on the case insensitivity for file names, but Linux files are case sensitive.
If you want to build the software from the spec files, just type this command: rpmbuild -ba Mono-ASP.NET-ClassifiedsStarterKit.spec Wait for a few minutes, and you should have a shiny package built on your very own system that is ready to be modified and deployed.
The Opportunity
The major chunk of code in our port is the database conversion; it has to change the way the database is created and the syntax of the stored procedures. But if you don't need to do this, porting an ASP.NET server application from Windows to Linux only takes a few days for someone with ASP.NET background.
If you ever wanted to consolidate some Windows workloads into your Linux systems and depended on ASP.NET or .NET to be available on Linux, it is!
In future articles, we will examine some of the technical issues involved in porting applications and some of the tools that we use to port. We'll also show more of our roadmap for various technologies that Web developers use.
Figure 1
Figure 2
Figure 3
Figure 4
Figure 5










