说明:本篇文章参考CentOS 6.0 安装 MONO 2.10.6 一文,结合自己实际安装后遇到的一些问题,对原文进行了一些mark。
1.更新系统
yum update
2.安装必要的相关库
yum install gcc gcc-c++ bison pkgconfig glib2-devel gettext make libpng-devel libjpeg-devel libtiff-devel libexif-devel giflib-devel libX11-devel freetype-devel fontconfig-devel cairo-devel httpd httpd-devel
3.升级sqlite(安装mono xsp-2.10时需要sqlite3.5以上版本)
wget -c http://dl.atrpms.net/el5-i386/atrpms/testing/sqlite-3.6.20-1.el5.i386.rpm
rpm -Uvh sqlite-3.6.20-1.el5.i386.rpm
4.安装 libgdiplus
cd /usr/local/src/
wget http://download.mono-project.com/sources/libgdiplus/libgdiplus-2.10.tar.bz2
tar -jxvf libgdiplus-2.10.tar.bz2
cd libgdiplus-2.10
./configure --prefix=/opt/mono
make
make install
echo "/opt/mono/lib" > /etc/ld.so.conf.d/mono.conf
ldconfig
5.安装 mono
cd /usr/local/src/
wget http://download.mono-project.com/sources/mono/mono-2.10.6.tar.bz2
tar -jxvf mono-2.10.6.tar.bz2
cd mono-2.10.6
./configure --prefix=/opt/mono
make
make install
echo export 'PKG_CONFIG_PATH=/opt/mono/lib/pkgconfig:$PKG_CONFIG_PATH'>>~/.bash_profile
echo export 'PATH=/opt/mono/bin:$PATH'>>~/.bash_profile
source ~/.bash_profile
输入 mono -V 如有mono版本信息,则安装成功.
6.安装mono xsp-2.10
cd /usr/local/src/
wget http://download.mono-project.com/sources/xsp/xsp-2.10.tar.bz2
tar jxvf xsp-2.10.tar.bz2
cd xsp-2.10
./configure -prefix=/opt/mono
make
make install
7.安装mod_mono-2.10
cd /usr/local/src/
wget http://download.mono-project.com/sources/mod_mono/mod_mono-2.10.tar.bz2
tar jxvf mod_mono-2.10.tar.bz2
cd mod_mono-2.10
./configure -prefix=/opt/mono
make;
make install
注意:安装完mod_mono模块之后,配置文件mod_mono.conf 默认会被拷贝到/etc/httpd/conf/ 目录下,但是由于apache默认只会加载/etc/httpd/conf.d/目录下的配置,这就需要将mod_mono.conf 移到/etc/httpd/conf.d/目录下。
mv /etc/httpd/conf/mod_mono.conf /etc/httpd/conf.d/mod_mono.conf
测试能否运行aspx,由于mono xsp自带了一个demo,位于opt/mono/lib/xsp/test目录下,我们就依此为例。
修改mod_mono.conf
vi /etc/httpd/conf.d/mod_mono.conf
在文件末尾加上以下几行:
Alias /demo "/opt/mono/lib/xsp/test"
MonoApplications "/demo:/opt/mono/lib/xsp/test"
MonoServerPath /opt/mono/bin/mod-mono-server2
<Location /demo>
SetHandler mono
</Location>
重启apache
service httpd restart
在浏览器输入:http://localhost/demo/
若出现 Welcome to Mono XSP! 提示信息说明成功。