Ubuntu 14.04 安装 Mono

sudo apt-get install mono-gmcs mono-devel
mono -V

sudo service apache2 stop
sudo apt-get install libapache2-mod-mono libmono-i18n2.0-cil

# For .NET 2.0
sudo apt-get install mono-apache-server2
# For .NET 4.0
sudo apt-get install mono-apache-server4

sudo a2enmod mod_mono
sudo service apache2 restart

hostname
hostname -f

http://go-mono.com/config-mod-mono/Default.aspx
sudo vi /etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80>
  ServerName localserver127.com
  ServerAdmin web-admin@li-ubuntu
  DocumentRoot /home/li/WebDoc/
  # 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 li-ubuntu "/opt/novell/mono/bin/mod-mono-server2"
  # For Mono on openSUSE, uncomment the line below instead:
  MonoServerPath li-ubuntu "/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 li-ubuntu 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 li-ubuntu 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 li-ubuntu MONO_IOMAP=all;MONO_OLD_RX=1

  MonoApplications li-ubuntu "/:/home/li/WebDoc/"
  <Location "/">
    Allow from all
    Order allow,deny
    MonoSetServerAlias li-ubuntu
    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>
</VirtualHost>

vi /home/li/WebDoc/index.aspx
<%@ Page Language="C#" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
  <head>
    <title>ASP Test Page</title>
  </head>
  <body>
        <form id="form1" runat="server">
          <asp:label id="lbl1" runat="server">ASP Test Page</asp:label>
        </form>
  </body>
</html>