> CentOS > CentOS教程 >

CentOS支持asp.net

Linux和Microsoft向来是水不容,这些年Microsft和Novell合作后情况有了些许的改观。但是想要各自的应用程序能无缝地迁移估计 都是比较困难的事情。而MONO是由Novell公司发起的一个开源项目,用于在Linux环境中提供ASP.NET支持。

在CentOS 5 linux(注:目前只兼容32位系统)上源码的安装依赖相应的开发包,所以在安装mono之前需先安装apache组件。

#yum -y install http*

Mono的安装有多种方式,Redhat Linux下最简单直接 yum 安装,在CentOS5下面,可以通过下面的方式来 yum 安装

# 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

#

安装后应该得到:
# 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
然后配置mod_mono,测试能否与apache整合:
# vi /etc/httpd/conf.d/mod_mono.conf
添加:
Alias /test “/usr/lib/xsp/test”
MonoApplications “/test:/usr/lib/xsp/test”
<Location /test>
SetHandler mono
</Location>

测试httpd:
# /usr/sbin/httpd -t
Syntax OK
# chown -R apache.apache /usr/lib/mono/
# chown -R apache.apache /usr/lib/xsp/
# service httpd restart
停止 httpd: [确定]
启动 httpd: [确定]

现在就可以访问 http://localhost/test/


(责任编辑:IT)