Difference between revisions of "Mono"

From SME Server
Jump to navigationJump to search
(→‎Installation: HowTo for SME8 and mono 2.10.x)
 
(4 intermediate revisions by one other user not shown)
Line 4: Line 4:
  
 
With Mono you can run ASP.NET on many platforms including SMEServer.  
 
With Mono you can run ASP.NET on many platforms including SMEServer.  
 +
 
Mono is also required to use iFolder http://www.ifolder.com
 
Mono is also required to use iFolder http://www.ifolder.com
  
Line 11: Line 12:
 
  To navigate around your server use MidnightComander - just type mc at the commandline.
 
  To navigate around your server use MidnightComander - just type mc at the commandline.
  
__TOC__  
+
__TOC__
  
 
= Mono on SME Server 7=
 
= Mono on SME Server 7=
Line 96: Line 97:
 
=Mono on SME8=
 
=Mono on SME8=
  
mmcarn use info found on this post: http://stackoverflow.com/questions/3510320/install-mono-on-centos5-5-using-yum
+
mmcarn use info found on [this post http://stackoverflow.com/questions/3510320/install-mono-on-centos5-5-using-yum] to answer a post [here  http://forums.contribs.org/index.php/topic,47977.0.html]
  
 
==Install==
 
==Install==
  
[code]/sbin/e-smith/db yum_repositories set mono repository \
+
 
Name 'Mono 2.x for rhel-5-i386 (stable)' \
+
/sbin/e-smith/db yum_repositories set mono repository \
BaseURL 'http://ftp.novell.com/pub/mono/download-stable/RHEL_5/' \
+
Name 'Mono 2.x for rhel-5-i386 (stable)' \
EnableGroups no \
+
BaseURL 'http://ftp.novell.com/pub/mono/download-stable/RHEL_5/' \
GPGCheck yes \
+
EnableGroups no \
GPGKey http://ftp.novell.com/pub/mono/download-stable/RHEL_5/repodata/repomd.xml.key \
+
GPGCheck yes \
Visible yes \
+
GPGKey http://ftp.novell.com/pub/mono/download-stable/RHEL_5/repodata/repomd.xml.key \
status disabled
+
Visible yes \
signal-event yum-modify
+
status disabled
yum --enablerepo=mono install monotools-addon-server mod_mono-addon mono-addon-wcf
+
signal-event yum-modify
[/code]
+
yum --enablerepo=mono install monotools-addon-server mod_mono-addon mono-addon-wcf
 +
 
  
 
Now verify you get happy-looking results from
 
Now verify you get happy-looking results from
[code]source /opt/novell/mono/bin/mono-addon-environment.sh
+
source /opt/novell/mono/bin/mono-addon-environment.sh
mono --version
+
mono --version
[/code]
+
 
  
 
Finally, "If you want the Mono environment to be permanent you can issue the following command.":
 
Finally, "If you want the Mono environment to be permanent you can issue the following command.":
[code]cp /opt/novell/mono/bin/mono-addon-environment.sh /etc/profile.d[/code]
+
cp /opt/novell/mono/bin/mono-addon-environment.sh /etc/profile.d
 
(mmccarn suspect this is irrelevant for web apps)
 
(mmccarn suspect this is irrelevant for web apps)
  
 
Now make the custom template fragment:
 
Now make the custom template fragment:
[code]
+
mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
+
cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
+
echo '  #Template for mod_mono
echo '  #Template for mod_mono
 
 
   LoadModule mono_module /usr/lib/httpd/modules/mod_mono.so
 
   LoadModule mono_module /usr/lib/httpd/modules/mod_mono.so
 
   AddType application/x-asp-net .aspx
 
   AddType application/x-asp-net .aspx
Line 144: Line 145:
 
   
 
   
 
   MonoServerPath /opt/novell/mono/bin/mod-mono-server2
 
   MonoServerPath /opt/novell/mono/bin/mod-mono-server2
' > 20LoadModule80mod_mono
+
' > 20LoadModule80mod_mono
 
+
signal-event remoteaccess-update
signal-event remoteaccess-update
 
 
 
[/code]
 
  
 
==creating space to test app using browser==  
 
==creating space to test app using browser==  
 
Now make the test application accessible in a browser (this is a test app from mono package):
 
Now make the test application accessible in a browser (this is a test app from mono package):
  
[code]
+
mkdir -p /home/e-smith/files/ibays/Primary/html/mono-test
mkdir -p /home/e-smith/files/ibays/Primary/html/mono-test
+
cp -r /opt/novell/mono/lib/xsp/test/* /home/e-smith/files/ibays/Primary/html/mono-test
cp -r /opt/novell/mono/lib/xsp/test/* /home/e-smith/files/ibays/Primary/html/mono-test
+
chown -R admin:shared /home/e-smith/files/ibays/Primary/html/mono-test
chown -R admin:shared /home/e-smith/files/ibays/Primary/html/mono-test
 
[/code]
 
 
(This way you're sticking it in the Primary ibay to avoid needing to create an ibay for testing)
 
(This way you're sticking it in the Primary ibay to avoid needing to create an ibay for testing)
  
After the above steps you'll get a sample page at http://<smeserver>/mono-test
+
After the above steps you'll get a sample page at '''http://<smeserver>/mono-test'''
  
 
If you like to use mono on another place, an ibay for example, you're free to do.
 
If you like to use mono on another place, an ibay for example, you're free to do.
 
You can copy the test files above to another place:
 
You can copy the test files above to another place:
 
Create an ibay "mono" and
 
Create an ibay "mono" and
[code]
+
mkdir -p /home/e-smith/files/ibays/mono/html/sample
mkdir -p /home/e-smith/files/ibays/mono/html/sample
+
cp -r /opt/novell/mono/lib/xsp/test/* /home/e-smith/files/ibays/mono/html/sample
cp -r /opt/novell/mono/lib/xsp/test/* /home/e-smith/files/ibays/mono/html/sample
+
chown -R admin:shared /home/e-smith/files/ibays/mono/html/sample
chown -R admin:shared /home/e-smith/files/ibays/mono/html/sample
 
[/code]
 
 
 
And test pointing an browser to page http://<smeserver>/mono/sample/
 
 
 
 
 
  
 +
And test pointing an browser to page '''http://<smeserver>/mono/sample/'''
  
  

Latest revision as of 06:32, 2 July 2015

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 :)

Mono on SME8

mmcarn use info found on [this post http://stackoverflow.com/questions/3510320/install-mono-on-centos5-5-using-yum] to answer a post [here http://forums.contribs.org/index.php/topic,47977.0.html]

Install

/sbin/e-smith/db yum_repositories set mono repository \
Name 'Mono 2.x for rhel-5-i386 (stable)' \
BaseURL 'http://ftp.novell.com/pub/mono/download-stable/RHEL_5/' \
EnableGroups no \
GPGCheck yes \
GPGKey http://ftp.novell.com/pub/mono/download-stable/RHEL_5/repodata/repomd.xml.key \
Visible yes \
status disabled
signal-event yum-modify
yum --enablerepo=mono install monotools-addon-server mod_mono-addon mono-addon-wcf


Now verify you get happy-looking results from

source /opt/novell/mono/bin/mono-addon-environment.sh
mono --version


Finally, "If you want the Mono environment to be permanent you can issue the following command.":

cp /opt/novell/mono/bin/mono-addon-environment.sh /etc/profile.d

(mmccarn suspect this is irrelevant for web apps)

Now make the custom template fragment:

mkdir -p /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
cd /etc/e-smith/templates-custom/etc/httpd/conf/httpd.conf
echo '   #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 /opt/novell/mono/bin/mod-mono-server2
' > 20LoadModule80mod_mono
signal-event remoteaccess-update

creating space to test app using browser

Now make the test application accessible in a browser (this is a test app from mono package):

mkdir -p /home/e-smith/files/ibays/Primary/html/mono-test
cp -r /opt/novell/mono/lib/xsp/test/* /home/e-smith/files/ibays/Primary/html/mono-test
chown -R admin:shared /home/e-smith/files/ibays/Primary/html/mono-test

(This way you're sticking it in the Primary ibay to avoid needing to create an ibay for testing)

After the above steps you'll get a sample page at http://<smeserver>/mono-test

If you like to use mono on another place, an ibay for example, you're free to do. You can copy the test files above to another place: Create an ibay "mono" and

mkdir -p /home/e-smith/files/ibays/mono/html/sample
cp -r /opt/novell/mono/lib/xsp/test/* /home/e-smith/files/ibays/mono/html/sample
chown -R admin:shared /home/e-smith/files/ibays/mono/html/sample

And test pointing an browser to page http://<smeserver>/mono/sample/