CentOS 5 yum Mono 2.4 (实战成功)

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=Mono Stack (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

====================================================================================================================================
Package                                Arch                   Version                               Repository                Size
====================================================================================================================================
Installing:
mod_mono                               i386                   1.2.1-1.el5.centos                    extras                    36 k
mono-core                              i386                   2.4-4.3                               Mono                      14 M
mono-data                              i386                   2.4-4.3                               Mono                     1.5 M
mono-data-firebird                     i386                   2.4-4.3                               Mono                     252 k
mono-data-oracle                       i386                   2.4-4.3                               Mono                     184 k
mono-data-postgresql                   i386                   2.4-4.3                               Mono                     203 k
mono-data-sqlite                       i386                   2.4-4.3                               Mono                     157 k
mono-data-sybase                       i386                   2.4-4.3                               Mono                     160 k
mono-devel                             i386                   2.4-4.3                               Mono                     1.8 M
mono-extras                            i386                   2.4-4.3                               Mono                     1.5 M
mono-jscript                           i386                   2.4-4.3                               Mono                     410 k
mono-locale-extras                     i386                   2.4-4.3                               Mono                     783 k
mono-moonlight                         i386                   2.4-4.3                               Mono                     1.5 M
mono-nunit                             i386                   2.4-4.3                               Mono                     223 k
mono-nunit-devel                       i386                   2.4-4.3                               Mono                      14 k
mono-web                               i386                   2.4-4.3                               Mono                     3.1 M
mono-web-devel                         i386                   2.4-4.3                               Mono                      14 k
mono-winforms                          i386                   2.4-4.3                               Mono                     3.0 M
monodoc                                i386                   2.4-4.3                               Mono                     7.3 M
monodoc-devel                          i386                   2.4-4.3                               Mono                      14 k
xsp                                    i386                   1.2.1-1.el5.centos                    extras                   233 k
Installing for dependencies:
giflib                                 i386                   4.1.3-7.1.el5_3.1                     base                      39 k
httpd                                  i386                   2.2.3-43.el5.centos                   base                     1.2 M
libgdiplus                             i386                   2.4-5.3                               Mono                     1.3 M

Transaction Summary
====================================================================================================================================
Install     24 Package(s)        
Update       0 Package(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 'include mod_mono.conf' from other configuration file
# 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
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
</IfModule>

 


Alias /mono "/usr/lib/xsp/test"
# MonoServerPath can be changed to specify which version of ASP.NET is hosted
# mod-mono-server1 = ASP.NET 1.1 / mod-mono-server2 = ASP.NET 2.0
# For SUSE Linux Enterprise Mono Extension, uncomment the line below:
# MonoServerPath mono "/opt/novell/mono/bin/mod-mono-server2"
# For Mono on openSUSE, uncomment the line below instead:
MonoServerPath mono "/usr/bin/mod-mono-server2"

# To obtain line numbers in stack traces you need to do two things:
# 1) Enable Debug code generation in your page by using the Debug="true"
#    page directive, or by setting <compilation debug="true" /> in the
#    application's Web.config
# 2) Uncomment the MonoDebug true directive below to enable mod_mono debugging
MonoDebug mono true

# The MONO_IOMAP environment variable can be configured to provide platform abstraction
# for file access in Linux.  Valid values for MONO_IOMAP are:
#    case
#    drive
#    all
# Uncomment the line below to alter file access behavior for the configured application
MonoSetEnv mono MONO_IOMAP=all
#
# Additional environtment variables can be set for this server instance using
# the MonoSetEnv directive.  MonoSetEnv takes a string of 'name=value' pairs
# separated by semicolons.  For instance, to enable platform abstraction *and*
# use Mono's old regular expression interpreter (which is slower, but has a
# shorter setup time), uncomment the line below instead:
# MonoSetEnv mono MONO_IOMAP=all;MONO_OLD_RX=1

MonoApplications mono "/mono:/usr/lib/xsp/test"
<Location "/mono">
Allow from all
Order allow,deny
MonoSetServerAlias mono
SetHandler mono
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
</Location>
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript
</IfModule>

重启httpd服务器:
service httpd restart

/etc/init.d/httpd restart

rpm安装的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测试目录


 

你可能感兴趣的:(linux,.net,centos,asp.net,asp)