Mono

From SME Server
Revision as of 18:51, 15 October 2011 by Jader (talk | contribs) (→‎Mono on SME Server 7: inserting space to Mono 2.x on SME8)
Jump to navigation Jump to search

Mono on SME

Mono is a cross platform, open source .NET development framework. See http://mono-project.com

With Mono you can run ASP.NET on many platforms including SMEServer. Mono is also required to use iFolder http://www.ifolder.com

Note to Windows users:
Use PuTTY to get acces to your SMEServer Box, login as root. 
Execute the steps hereunder by copy-pasting them to PuTTY - to paste in PuTTY right click with the mouse (not working  under mc!).
To navigate around your server use MidnightComander - just type mc at the commandline.

Mono on SME Server 7

Installation

To setup a repository where yum can get Mono from issue following:

/sbin/e-smith/db yum_repositories set mono repository \
Name 'Mono for rhel-4-i386 (stable)' \
BaseURL 'http://ftp.novell.com/pub/mono/download-stable/rhel-4-i386/' \
EnableGroups no \
GPGCheck no \
Visible yes \
status disabled

Then:

signal-event yum-modify

This is equivalent to adding a .repo file (this was not working before SMEServer 7.4). The info above comes from http://ftp.novell.com/pub/mono/download-stable/rhel-4-i386/mono.repo - the source of Mono. It is the only place I have found xsp and mod_mono required to run ASP.NET pages.

install mono, xsp and mod_mono:

yum --enablerepo=mono install mono-complete xsp mod_mono


Restart the system:

signal-event post-upgrade; signal-event reboot


Create a file in the SMEServer custom templates dir (create dir first)

mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf

Create file:

pico 20LoadModule80mod_mono

Add following to the file:

   #Template for mod_mono
   LoadModule mono_module /usr/lib/httpd/modules/mod_mono.so
   AddType application/x-asp-net .aspx
   AddType application/x-asp-net .asmx
   AddType application/x-asp-net .ashx
   AddType application/x-asp-net .asax
   AddType application/x-asp-net .ascx
   AddType application/x-asp-net .soap
   AddType application/x-asp-net .rem
   AddType application/x-asp-net .axd
   AddType application/x-asp-net .cs
   AddType application/x-asp-net .config
   AddType application/x-asp-net .Config
   AddType application/x-asp-net .dll
   DirectoryIndex index.aspx
   DirectoryIndex Default.aspx
   DirectoryIndex default.aspx
 
   MonoServerPath /usr/bin/mod-mono-server2

Save and exit (ctrl-x)

The template sets mimetypes and sets the server to be ASP.NET 2.0 instead of the default 1.1. The mimetypes are the same as in the mod_mono configuration file (/conf.d/mod_mono.conf).

Reparse the templates:

expand-template /etc/httpd/conf/httpd.conf

restart the webserver

/etc/init.d/httpd-e-smith restart

You are done! Add a .aspx file to an iBay and point your browser to it. You may have authorization issues if your ASP.NET code reads or writes files - but that is another matter solved by granting some rights :)