配置mono让Linux上支持.NET

前言:这篇文章是我从网上找来的,刚好作者做的事情和我最近要做的一样,我从当中也得到了帮助,而且我也写了些心得,迟下整理好后也会放上来,大家可以比较一下作为参照,也欢迎提出您的意见。
 
由于有ASP.NET的页面要放到Linux上面,这还满新鲜的,以前没搞过,说是要装mono.装起来没想到这么麻烦,用了一天半的时间.以下就是整个过程,其中很大的篇幅是失败时的调试信息,很希望谁能帮我分析一下
 
环境:
RedHat9,apache2,mysql5,php5
已经配了PHP环境,并能正常工作.
 
安装过程:
保险起见,安装过程中停掉了apache,mysql,所装版本是1.2.4,用rpm安装
1.首先安装mono的rpm包
用rpm –vih *.rpm时停住不动,估计是要加—nodeps
所以用如下的顺序一个一个装
libgdiplus
mono-core
mono-data
mono-data-firebird
mono-data-Oracle
mono-data-postgresql
mono-data-sqlite
mono-data-sybase
ibm-data-db2
mono-nunit
mono-locale-extras
rpm -ivh mono-web-1.2.4-3.novell.i586.rpm –nodeps
//这个和下面的winforms相互依赖,实在不行,所以加上了—nodeps参数
rpm -ivh mono-winforms-1.2.4-3.novell.i586.rpm
rpm -ivh mono-devel-1.2.4-3.novell.i586.rpm
rpm -ivh mono-extras-1.2.4-3.novell.i586.rpm
rpm -ivh mono-jscript-1.2.4-3.novell.i586.rpm
rpm -ivh mono-basic-1.2.4-0.novell.noarch.rpm
rpm -ivh bytefx-data-mysql-1.2.4-3.novell.i586.rpm
rpm -ivh mono-complete-1.2.4-3.novell.i586.rpm
 
2.然后装xsp/mod_mono
(下载页面上面并没有单独的mod_mono的rpm包下载,将这两个软件写在了一起)所以应该是包含在一起了
rpm -ivh xsp-1.2.4-0.novell.noarch.rpm
注:
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测试目录
 
不知道如何修改httpd.conf,因为mod_mono的库文件不知道装哪了,找不到
所以改用源码安装mod_mono,修改了httpd.conf用IE访问测试页面报错
Service Temporarily Unavailable
The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.
--------------------------------------------------------------------------------
Apache/2.0.54 (Unix) mod_ssl/2.0.54 OpenSSL/0.9.7a mod_mono/1.2.4 PHP/5.0.4 Server at 192.168.0.111 Port 80
IE的标题栏显示503错误
没找到解决办法,此时参考到里面写的” 第一次mono和xsp都放到了usr以外的地方,结果apache报503的临时错误。估计是路径的问题,重新编译后就好了。”
 
参考这篇文章采用源码安装,版本也用比较低的,恰好我的apache的安装路径和文章中的一样为/usr/local/apache2/,源码下载路径:
 
1.首先安装libgdiplus-1.1.13.6,但是报错要装glib-2.4.0,装了glib以后make仍然报错
./configue正常,输出为:
……前面省略
cairo will be compiled with the following surface backends:
  Xlib: yes
  Quartz: no
  XCB: no
  Win32: no
  PostScript: no
  PDF: no
  glitz: no
 
the following font backends:
  FreeType: yes
  Win32: no
  ATSUI: no
 
and the following features:
  PNG functions: yes
---
Configuration summary
 
   * Installation prefix = /usr/local
   * Codecs supported:
 
      - TIFF: yes
      - JPEG: yes
      - GIF: yes
      - PNG: yes
 
      NOTE: if any of the above say 'no' you may install the
            corresponding development packages for them, rerun
            autogen.sh to include them in the build.
 
make报错信息为
……前面省略
n file included from ../cairo/src/cairo-ft.h:47,
                 from gdip.h:38,
                 from adjustablearrowcap.c:27:
/usr/include/ft2build.h:55:38: freetype/config/ftheader.h: No such file or directory
In file included from gdip.h:38,
                 from adjustablearrowcap.c:27:
../cairo/src/cairo-ft.h:48:10: #include expects "FILENAME" or
In file included from gdip.h:38,
                 from adjustablearrowcap.c:27:
../cairo/src/cairo-ft.h:60: parse error before "face"
../cairo/src/cairo-ft.h:64: parse error before "cairo_ft_scaled_font_lock_face"
cc1: warnings being treated as errors
../cairo/src/cairo-ft.h:64: warning: type defaults to `int' in declaration of `cairo_ft_scaled_font_lock_face'
../cairo/src/cairo-ft.h:64: warning: data definition has no type or storage class
adjustablearrowcap.c: In function `gdip_adjust_arrowcap_clone_cap':
adjustablearrowcap.c:75: warning: implicit declaration of function `memcpy'
make[2]: *** [adjustablearrowcap.lo] Error 1
make[2]: Leaving directory `/home/yahoon/mono/libgdiplus-1.1.13.6/src'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/yahoon/mono/libgdiplus-1.1.13.6'
make: *** [all] Error 2
查了好像与freetype有关, libgdiplus包里面还有一个cairo文件夹,它的安装说明提示要装freetype-2.1.4但是用src.rpm装freetype-2.1.4提示要symlinks,源码装又报错…受不了放弃了.还是回头用rpm把这个libgdiplus装好(很奇怪这样安装整个过程没报错)

linux

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wypdjx.html