CentOS Linux builds .NET environment

  
 

Mono is a cross-platform, open source .NET development framework. Support for Linux systems, which was developed by Novell based on the SUSE Linux operating system
. Official website: http://mono-project.com/Main_Page

Online check, the web server that uses ASP.NET environment on Linux can use Apache+mod_mono or Mono+Jexus (Jexus is A free software developed by the Chinese), of course, Nginx can also support. http://www.mono-project.com/ASP.NET

Official package download address: http://ftp.novell.com/pub/mono/sources-stable/

Apache+mod_mono way to install the necessary software:

yum install bison make gcc gcc-c++ libstdc++-devel gettext pkgconfig glib2-devel

1, install libgdipluslibgdiplus is the System.Drawing dependency in mono A component for displaying the basic color of a web page, etc. The latest is libgdiplus-2.10.

cd /tmpwget http://ftp.novell.com/pub/mono/sources/libgdiplus/libgdiplus-2.10.tar.bz2tar -xjvf libgdiplus-2.10.tar.bz2cd libgdiplus-2.10./configure - -prefix=/usr/local

Failed when generating a makefile: configure: WARNING: *** TIFF plug-in will not be built (TIFF library not found) ***checking for jpeg_destroy_decompress in -ljpeg. .. noconfigure: WARNING: *** JPEG loader will not be built (JPEG library not found) ***checking for DGifOpenFileName in -lgif... noconfigure: WARNING: *** GIF loader will not be built (giflibrary not found ***checking for DGifOpenFileName in -lungif... noconfigure: WARNING: *** GIF loader will not be built (ungiflibrary not found) ***checking for libpng12... nochecking for png_read_info in -lpng... noconfigure : error: *** libpng12 not found. See http://www.libpng.org/pub/png/libpng.html.

Lack of libtiff, libjpeg, libgif, libpng libraries. After filling these libraries, you will be prompted to have the library missing. Install them together:

yum install libtiff libtiff-devel libjpeg libjpeg-devel giflib giflib-devel libpng libpng-devel libX11 libX11-devel freetype freetype-devel fontconfig fontconfig -devel libexif libexif-devel

Continue to install libgdiplus:

./configure --prefix=/usr/localmakemake install

2, install Mono

Cd /tmpwget http://ftp.novell.com/pub/mono/sources/mono/mono-2.10.2.tar.bz2tar -xjvf mono-2.10.2.tar.bz2cd mono-2.10.2./configure - -prefix=/usr/localmakemake install

After Mono installation, you can use the command mono -V to check the mono installation. If you can see the mono version number and other information, the Mono installation is successful.

3. Install Apache

cd /tmpwget http://labs.renren.com/apache-mirror//httpd/httpd-2.2.21.tar.gztar -xzvf httpd-2.2 .21.tar.gzcd httpd-2.2.21./configure --prefix=/usr/local/apache --enable-mods-shared=mostmakemake install

4, install mod_mono

Cd /tmpwget http://ftp.novell.com/pub/mono/sources/mod_mono/mod_mono-2.10.tar.bz2tar -xjvf mod_mono-2.10.tar.bz2cd mod_mono-2.10./configuremakemake install

5, install xspxsp is mod-mono-server.

cd /tmpwget http://ftp.novell.com/pub/mono/sources/xsp/xsp-2.10.2.tar.bz2tar -xjvf xsp-2.10.2.tar.bz2cd xsp-2.10 .2./configure --prefix=/usr/localmakemake install

If you generate a makefile prompt: checking for MONO_MODULE... configure: error: Package requirements (mono >= 2.10.0) were not met :

No package 'mono' found

Consider adjusting the PKG_CONFIG_PATH environment variable if youinstalled software in a non-standard prefix.

Alternatively, you may set the environment variables MONO_MODULE_CFLAGSand MONO_MODULE_LIBS to avoid the need to call pkg-config.See the pkg-config man page for more details.

You need to set the environment variable to compile it:

export PKG_CONFIG_PATH=/usr /local/lib/pkgconfig

6. Configure Apache to view the mod_mono.conf file in /usr/local/apache/conf.

Edit httpd.conf:

vim /usr/local/apache/conf/httpd.conf

1)Add mod_mono.conf configuration file to find

# Server-pool management (MPM specific)#Include conf/extra/httpd-mpm.conf

Add before:

Include /usr/local/apache/conf/mod_mono.conf

2) Remove the comment before the following sentence:

#ServerName www.example.com:80

Do not set ServerName, Apache will report error due to domain name at startup .

3) Create a test page:

vim /usr/local/apache/htdocs/test.aspx

Online, find one:

<%@ Page Language="C#" %><html><head><title>hello world</title></head><body><%for (int i=1 ; i<=7; i++){Response.Write("<font size=" + i.ToString() + ">");Response.Write("hello world");Response. Write("</font><br />");}%></body></html>

4) Restart Apache:

/usr/local/apache/bin/apachectl restart

5) Access the test page:

http://IP/test.aspx

Show the following to indicate success .

6) Set Apache boot from:

vim /etc/rc.local

Join:

/usr/local/apache/bin/Apachectl start

7) Principle: The asp.net runtime environment built above is apache as the communication framework, mod_mono as the interface bridge (apache plugin), connect apache and xsp communication, xsp is ultimately responsible for asp .net service processing, xsp will listen to the local port used to communicate with mod_mono, the latter will return the processing results to apache, apache and then return to the client.

Copyright © Windows knowledge All Rights Reserved