mono-3.0.2安裝指南
一見 2012/12/27
目錄
<a href="#_Toc15071%20" target="_blank">1. 前言 1</a>
<a href="#_Toc27468%20" target="_blank">1.1. 什麼是mono? 1</a>
<a href="#_Toc7178%20" target="_blank">1.2. 目的 1</a>
<a href="#_Toc25458%20" target="_blank">2. 下載下傳網址 1</a>
<a href="#_Toc24897%20" target="_blank">3. 依賴關系 2</a>
<a href="#_Toc2290%20" target="_blank">4. 安裝步驟 2</a>
<a href="#_Toc5874%20" target="_blank">4.1. mono 2</a>
<a href="#_Toc25706%20" target="_blank">4.2. xsp 2</a>
<a href="#_Toc16772%20" target="_blank">4.3. mod_mono 2</a>
<a href="#_Toc5604%20" target="_blank">5. 修改Apache的httpd.conf 3</a>
<a href="#_Toc24880%20" target="_blank">6. 附1:一鍵腳本 4</a>
<a href="#_Toc17337%20" target="_blank">6.1. 一鍵腳本前提 4</a>
<a href="#_Toc13766%20" target="_blank">6.2. 一鍵腳本全文 4</a>
<a href="#_Toc7636%20" target="_blank">7. 附2:mod_mono.diff 6</a>
mono是一個由Novell公司主持的一個緻力于開創.net在Linux、FreeBSD、Mac OS X和Solaris上使用的開源工程。
本文檔試圖以最簡單方式闡明mono-3.0.2版本的安裝。mono采用的是automake編譯方式,包括它所依賴的庫,正因為這種依賴,使用得編譯安裝稍變複雜。
mono、xsp和mod_mono的下載下傳網址均為:
<a href="http://download.mono-project.com/sources/" target="_blank">http://download.mono-project.com/sources/</a>
1) mono無依賴;
2) xps依賴mono;
1) ./configure --prefix=/usr/local/mono(注:将mono安裝到/usr/local/mono目錄下)
2) make
3) make install
xps的安裝需要注意一下,如果直接以标準的automake方式編譯,可能會遇到錯誤,以下面的步驟操作,可幫助避免錯誤:
1) export PATH=/usr/local/mono/bin:$PATH(需要用到mono提供的dmcs、gmcs等指令)
2) export PKG_CONFIG_PATH=/usr/local/mono/lib/pkgconfig:$PKG_CONFIG_PATH(XSP依賴mono)
3) sed -i -e 's! test !!' Makefile.am(不編譯test,因為test可能編譯失敗)
4) ./configure --prefix=$XSP_HOME --disable-docs(文檔也不編譯,減少遇到錯誤的機率)
5) make
6) make install
1) ./configure --prefix=/usr/local/mod_mono --with-apxs=/usr/local/httpd/bin/apxs(假設将Apache安裝在/usr/local/httpd目錄下)
成功安裝mono後,需要對Apache的httpd.conf檔案進行修改,修改點包括:
1) 加入:include /usr/local/httpd/conf/mod_mono.conf
2) 加入以下内容(這部分需要根據實際進行修改):
ServerName mono.com
ServerAlias mono.com
ServerAdmin [email protected]
DocumentRoot /usr/local/xsp/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.com "/opt/novell/mono/bin/mod-mono-server2"
# For Mono on openSUSE, uncomment the line below instead:
MonoServerPath mono.com "/usr/local/xsp/bin/mod-mono-server4"
# 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 in the
# application's Web.config
# 2) Uncomment the MonoDebug true directive below to enable mod_mono debugging
MonoDebug mono.com 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.com 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.com MONO_IOMAP=all;MONO_OLD_RX=1
MonoApplications mono.com "/:/usr/local/xsp/lib/xsp/test"
Allow from all
Order allow,deny
MonoSetServerAlias mono.com
SetHandler mono
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
AddOutputFilterByType DEFLATE text/html text/plain text/xml text/javascript
1) 使用root使用者操作;
2) Apache安裝在/usr/local/httpd目錄下;
3) mono、xps和mod_mono安裝包都放在同一個目錄下,如:
~/app # ls
mod_mono-2.10.tar.bz2 mono-3.0.2.tar.bz2 xsp-2.10.2.tar.bz2
4) 如果是Apache2.4,還需要将mod_mono.diff檔案和安裝包放在同一個目錄下。
#!/bin/sh
# Writed by yijian on 2012/12/27
# A key to install mono on linux
export APACHE_HOME=/usr/local/httpd
export MONO_HOME=/usr/local/mono
export XSP_HOME=/usr/local/xsp
export MOD_MONO_HOME=/usr/local/mod_mono
mono=`basename mono-*.tar.bz2 .tar.bz2`
xsp=`basename xsp-*.tar.bz2 .tar.bz2`
mod_mono=`basename mod_mono-*.tar.bz2 .tar.bz2`
basedir=`pwd`
apache_version=`$APACHE_HOME/bin/httpd -V|awk -F"[/ .]" '/Server version/{print $5}'`
echo "Apache version: $apache_version"
# Compile & install mono
echo "tar xjf $mono.tar.bz2"
cd $basedir
#tar xjf $mono.tar.bz2
cd $basedir/$mono
#./configure --prefix=$MONO_HOME
#if test $? -ne 0; then
# exit 1
#fi
#make
#make install
# Compile & install XSP
export PATH=$MONO_HOME/bin:$PATH
export PKG_CONFIG_PATH=$MONO_HOME/lib/pkgconfig:$PKG_CONFIG_PATH
tar xjf $xsp.tar.bz2
cd $basedir/$xsp
sed -i -e 's! test !!' Makefile.am
./configure --prefix=$XSP_HOME --disable-docs
if test $? -ne 0; then
exit 1
fi
make
make install
# Compile & install mod_mono
tar xjf $mod_mono.tar.bz2
if test $apache_version -gt 2; then
if test -f ./mod_mono.diff; then
echo "cp ./mod_mono.diff $mod_mono/src/"
cp ./mod_mono.diff $mod_mono/src/
cd $basedir/$mod_mono/src
echo "patch mod_mono.c mod_mono.diff"
patch mod_mono.c mod_mono.diff
cd $basedir/$mod_mono
./configure --prefix=$MOD_MONO_HOME --with-apxs=$APACHE_HOME/bin/apxs
echo "finished!"
exit 0
389c389
return unixd_config.user_id;
---
> return ap_unixd_config.user_id;
399c399
return unixd_config.group_id;
> return ap_unixd_config.group_id;
409c409
return unixd_config.user_name;
> return ap_unixd_config.user_name;
488c488
rv = unixd_set_global_mutex_perms (xsp->dashboard_mutex);
> rv = ap_unixd_set_global_mutex_perms (xsp->dashboard_mutex);
850,857c850
return c->remote_addr->port;
apr_port_t port;
apr_sockaddr_port_get (&port, c->remote_addr);
return port;
> return c->client_addr->port;
863d855
865,869d856
apr_sockaddr_port_get (&port, r->connection->local_addr);
1981c1968
info.remote_ip_len = strlen (r->connection->remote_ip);
> info.remote_ip_len = strlen (r->connection->client_ip);
2029c2016
ptr += write_string_to_buffer (ptr, 0, r->connection->remote_ip, info.remote_ip_len);
> ptr += write_string_to_buffer (ptr, 0, r->connection->client_ip, info.remote_ip_len);