TahoeCentOS 2011-04-17
Linux和Microsoft向来是水不容,这些年Microsft和Novell合作后情况有了些许的改观。但是想要各自的应用程序能无缝地迁移估计 都是比较困难的事情。而MONO是由Novell公司发起的一个开源项目,用于在Linux环境中提供ASP.NET支持。
#
源码的安装依赖相应的开发包,所以在安装mono之装需先安装apache组件。
#
#yum -y install http*
Mono的安装有多种方式,Redhat Linux下最简单直接 yum 安装,在CentOS5下面,可以通过下面的方式来 yum 安装,建立Mono的更新源
#
#vim /etc/yum.repos.d/Mono.repo
[Mono]
name=MonoStack(CentOS_5)
type=rpm-md
baseurl=http://download.opensuse.org/repositories/home:/mindtouch:/Mono/CentOS_5/
gpgcheck=1
gpgkey=http://download.opensuse.org/repositories/home:/mindtouch:/Mono/CentOS_5/repodata/repomd.xml.key
enabled=1[root@localhost yum.repos.d]# rpm -qa|grep mono
[root@localhost yum.repos.d]# yum install mono* xsp mod_mono
Dependencies Resolved
====================================================================================================================================
PackageArchVersionRepositorySize
====================================================================================================================================
Installing:
mod_monoi3861.2.1-1.el5.centosextras36k
mono-corei3862.4-4.3Mono14M
mono-datai3862.4-4.3Mono1.5M
mono-data-firebirdi3862.4-4.3Mono252k
mono-data-oraclei3862.4-4.3Mono184k
mono-data-postgresqli3862.4-4.3Mono203k
mono-data-sqlitei3862.4-4.3Mono157k
mono-data-sybasei3862.4-4.3Mono160k
mono-develi3862.4-4.3Mono1.8M
mono-extrasi3862.4-4.3Mono1.5M
mono-jscripti3862.4-4.3Mono410k
mono-locale-extrasi3862.4-4.3Mono783k
mono-moonlighti3862.4-4.3Mono1.5M
mono-nuniti3862.4-4.3Mono223k
mono-nunit-develi3862.4-4.3Mono14k
mono-webi3862.4-4.3Mono3.1M
mono-web-develi3862.4-4.3Mono14k
mono-winformsi3862.4-4.3Mono3.0M
monodoci3862.4-4.3Mono7.3M
monodoc-develi3862.4-4.3Mono14k
xspi3861.2.1-1.el5.centosextras233k
Installingfordependencies:
giflibi3864.1.3-7.1.el5_3.1base39k
httpdi3862.2.3-43.el5.centosbase1.2M
libgdiplus i386 2.4-5.3 Mono 1.3 MTransaction Summary
====================================================================================================================================
Install24Package(s)
Update0Package(s)
Remove 0 Package(s)Total download size: 39 M
#
安装后应该得到:[root@magic yum.repos.d]$ rpm -qa|grep mono
mono-winforms-2.4-4.3
mono-data-sqlite-2.4-4.3
mono-locale-extras-2.4-4.3
mono-moonlight-2.4-4.3
mono-nunit-2.4-4.3
mono-data-2.4-4.3
mono-core-2.4-4.3
monodoc-2.4-4.3
monodoc-devel-2.4-4.3
mono-data-sybase-2.4-4.3
mono-data-oracle-2.4-4.3
mono-devel-2.4-4.3
mono-extras-2.4-4.3
mono-nunit-devel-2.4-4.3
mono-web-devel-2.4-4.3
mod_mono-1.2.1-1.el5.centos
mono-data-firebird-2.4-4.3
mono-data-postgresql-2.4-4.3
mono-web-2.4-4.3
mono-jscript-2.4-4.3#
虎子哥说 :对应到虚拟机的例子,你需要查看vim /etc/httpd/conf.d/mono.conf 里的配置写法,
注意这一条:MonoServerPath/usr/bin/mod-mono-server2
这一条就是要求你配置的mono的2.0.50727方式运行,否则默认会以1.1的方式运行。[root@goosns conf.d]# cat mod_mono.conf # mod_mono.conf
# Acthung! This file may be overwritten
#Use'includemod_mono.conf'fromotherconfigurationfile
# to load mod_mono module.<IfModule !mod_mono.c>LoadModule mono_module /usr/lib/httpd/modules/mod_mono.so
AddType application/x-asp-net .aspx
AddTypeapplication/x-asp-net.asmx
AddTypeapplication/x-asp-net.ashx
AddTypeapplication/x-asp-net.asax
AddTypeapplication/x-asp-net.ascx
AddTypeapplication/x-asp-net.soap
AddTypeapplication/x-asp-net.rem
AddTypeapplication/x-asp-net.axd
AddTypeapplication/x-asp-net.cs
AddTypeapplication/x-asp-net.config
AddTypeapplication/x-asp-net.Config
AddTypeapplication/x-asp-net.dll
DirectoryIndexindex.aspx
DirectoryIndexDefault.aspx
DirectoryIndexdefault.aspx
</IfModule>Alias/mono"/usr/lib/xsp/test"
#MonoServerPathcanbechangedtospecifywhichversionofASP.NETishosted
#mod-mono-server1=ASP.NET1.1/mod-mono-server2=ASP.NET2.0
#ForSUSELinuxEnterpriseMonoExtension,uncommentthelinebelow:
#MonoServerPathmono"/opt/novell/mono/bin/mod-mono-server2"
#ForMonoonopenSUSE,uncommentthelinebelowinstead:
MonoServerPath mono "/usr/bin/mod-mono-server2"# To obtain line numbers in stack traces you need to do two things:
#1)EnableDebugcodegenerationinyourpagebyusingtheDebug="true"
#pagedirective,orbysetting<compilationdebug="true"/>inthe
#application'sWeb.config
#2)UncommenttheMonoDebugtruedirectivebelowtoenablemod_monodebugging
MonoDebug mono true# The MONO_IOMAP environment variable can be configured to provide platform abstraction
#forfileaccessinLinux.ValidvaluesforMONO_IOMAPare:
#case
#drive
#all
#Uncommentthelinebelowtoalterfileaccessbehaviorfortheconfiguredapplication
MonoSetEnvmonoMONO_IOMAP=all
#
#Additionalenvirontmentvariablescanbesetforthisserverinstanceusing
#theMonoSetEnvdirective.MonoSetEnvtakesastringof'name=value'pairs
#separatedbysemicolons.Forinstance,toenableplatformabstraction*and*
#useMono'soldregularexpressioninterpreter(whichisslower,buthasa
#shortersetuptime),uncommentthelinebelowinstead:
# MonoSetEnv mono MONO_IOMAP=all;MONO_OLD_RX=1MonoApplications mono "/mono:/usr/lib/xsp/test"
<Location"/mono">
Allowfromall
Orderallow,deny
MonoSetServerAliasmono
SetHandlermono
SetOutputFilterDEFLATE
SetEnvIfNoCaseRequest_URI"\.(?:gif|jpe?g|png)$"no-gzipdont-vary
</Location>
<IfModulemod_deflate.c>
AddOutputFilterByTypeDEFLATEtext/htmltext/plaintext/xmltext/javascript
</IfModule>重启httpd服务器:
servicehttpdrestart
或
/etc/init.d/httpd restartrpm安装的XSP的目录结构
/usr/bin/xsp
/usr/lib/mono/gac/xsp
/usr/lib/xsp
/usr/share/doc/packages/xsp
rpm 安装 mono 的目录结构
/etc/mono
/usr/bin/mono
/usr/lib/mono
/usr/share/mono-1.0/mono
/usr/include/mono-1.0/mono
/usr/lib/xsp/test测试目录