Novell Home

Taking the Leap Without the .NET (Part 2)

Novell Cool Solutions: Feature
By Gordon Mathis, Richard Smith

Digg This - Slashdot This

Posted: 14 Jan 2004
 

Gordon Mathis is a Senior Software Engineer at Novell, and Richard Smith is the Developer Content Manager.

In the first article in this series we discussed the installation and testing of the basic installation of a working Mono system. In order to effectively use this article you will need to have completed the steps from that article and have a fully functional Mono installation.

In this article we will work through the following:

  • Installation and testing of MonoDoc
  • Installing and configuration of Apache to server Mono

Please note that these articles were developed using a SUSE Linux Server 9 system. In many cases the instructions here will translate directly to your Linux distribution of choice. If you find that they do not work on your system and you determine the correct methods for other distributions please send the information to us and we will publish it, crediting you for the solution.

Installing and building MonoDoc

MonoDoc will provide you with a valuable resource in learning and using Mono on whatever platform you choose.

The first step is to download MonoDoc from the Mono web site . For purposes of this article we are using MonoDoc 0.7, you may find a more up-to-date version available when you download. To go directly to the Mono download page go to http://www.go-mono.com/download.html and download monodoc-0.7.tar.gz. If you are not logged in as the root user enter "su -" at the console and login as the root user. Change to the directory where you downloaded the MonoDoc 0.7 (monodoc-0.7.tar.gz) and type in the following command to extract the MonoDoc files:

tar -zxvf monodoc-0.7.tar.gz

This screenshot shows the files located in /root/monodoc-0.7

After the MonoDoc files are all expanded (into /root/monodoc-0.7) change in directory monodoc-0.7. To configure and install MonoDoc type in the following commands:

export PATH=$PATH:/opt/gnome2/bin
cp /usr/lib/*.dll /opt/gnome2/lib
./configure --prefix=/opt/gnome2
make
make install

This screenshot illustrates the results of some of these commands:

Note If you get cs-error messages you should delete the monodoc-0.7 directory and repeat this session again. If you switched to the root user, exit as the root user by typing exit before running the monodoc

exit
monodoc

The following 2 screenshots show the MonoDoc browser.


As you can see MonoDoc contains a wealth of information to help get you going using Mono. Spend time exploring and learning about Mono's capabilities using MonoDoc.

Apache 2 Installation and configuration

In our first article we covered installing and configuring the XSP server to provide a way to serve Active Server Pages from Mono. While this is a useful tool to help get up and running with Mono and perhaps for software development and testing purposes, it is not designed for production environments. Since the Apache web server is used on a large number of Linux system as the default web server, using it to serve the ASP pages from Mono makes good sense.

Note: Apache2 may already be installed on your SUSE Linux system. However, it more than likely does not include the required associated Apache extensions (apxs) which are required to compile the mod_mono. If you have Apache running you should go to the YaST Control Center and disable it at this time.

  1. Download Apache 2.x.xx
    Download Apache2 from www.apache.org/download.cgi (i.e. httpd-2.0.48.tar.gz)
  2. Unzip Apache2
  3. tar -zxvf httpd-2.0.48.tar.gz
  4. Build and install Apache2
    Change directory to httpd-2.0.48
  5. ./configure --prefix=/usr
    make
    make install

Installing and configuring mod_mono

The following are instructions on getting mod_mono working with Apache 2. Once you have completed these steps Apache will be able to serve ASP.NET pages. You should already have XSP up and running based on the previous article in this series. The next steps are to install mod_mono to allow Apache to be used for serving ASP pages.

  • Install mod_mono
    • Go to the YaST Control Center and select software then Install and Remove software. Pick the search filter and enter pkgconfig and press search. Check the pkgconfig on the right. You will be prompted for CD4.
    • From the page http://www.go-mono.com/download.html download the following: mod_mono
    • Change directory to the directory where you downloaded the mod_mono (mod_mono-0.5.tar.gz)
    • tar zxvf mod_mono-0.5.tar.gz
    • Change directory to mod_mono-0.5
    • export PKG_CONFIG_PATH=/opt/gnome2/lib/pkgconfig:/opt/gnome/lib/pkgconfig
      ./configure -prefix=/opt/gnome2
      make 
      make install
      (NOTE: You may get some warnings which is okay)

  • Configure apache
    • Edit the /usr/conf/httpd.conf add the following lines to the end of the file
      AddType application/x-asp-net .aspx .ashx .asmx .ascx .asax .config .ascx
      LoadModule mono_module /usr/modules/mod_mono.so
      MonoUnixSocket /tmp/mod_mono_server
      Alias /mono "/opt/gnome2/share/doc/xsp/test"

Now we have everything configured to test Apache serving the sample ASP pages that we used in the previous article. Enter the following commands:

  • cd /opt/gnome2/bin
  • mono mod-mono-server.exe --root /opt/gnome2/share/doc/xsp/test --applications /mono:

    NOTE: If you get a sanity check error while loading the mod-mono-server.exe you can resolve this by deleting the ~/.wapi directory.
    The --root argument tells mod-mono-server to change the directory to this one before anything else and the --applications argument makes mod-mono-server set up an application that will be seen from apache as if it was in /mono/ virtual directory.
    NOTE: mod-mono-server.exe re-creates the /tmp/mod_mono_server file every time it is started so you must set the file permissions using the following:


  • Setting file permissions: chmod 666 /tmp/mod_mono_server
  • Restart apache: /usr/bin/httpd -k start or restart
  • Point your browser to http://127.0.0.1/mono/index.aspx

This gives you a fully functioning system, serving ASP pages via Mono using Apache as the web server.

This takes us one step closer to be able to use Mono as part of functional, production environment.

What's coming up

The next article in this series will deal with installation and configuration of MySQL and how to use it to complete a complete Linux-based alternative to using Microsoft products in order to deliver .NET solutions. In future articles we plan to look at a number of open source solutions for .NET and how they can be used with Mono. If you have any ideas or suggestion for content for this series please e-mail (cooldev@novell.com) us so we can consider them for publication.

Useful Links


Novell Cool Solutions (corporate web communities) are produced by WebWise Solutions. www.webwiseone.com

© 2014 Novell