CentOS 5.1下跑Mono和Asp.net的實現(xiàn)方法分享
下載編譯環(huán)境:
yum install gcc bison pkgconfig glib2-devel gettext make httpd-devel gcc-c++ libstdc++-devel
下載并解壓源代碼:
wget http://ftp.novell.com/pub/mono/sources/mono/mono-2.6.3.tar.bz2
wget http://ftp.novell.com/pub/mono/sources/mod_mono/mod_mono-2.6.3.tar.bz2
wget http://ftp.novell.com/pub/mono/sources/xsp/xsp-2.6.3.tar.bz2
tar -jxvf mono-2.6.3.tar.bz2
tar -jxvf xsp-2.6.3.tar.bz2
tar -jxvf mod_mono-2.6.3.tar.bz2
安裝mono環(huán)境:
cd /root/mydir/mono-2.6.3
./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
安裝xsp:
cd /root/mydir/xsp-2.6.3
./configure --prefix=/opt/mono; make ; make install
安裝mod_mono:
先用find / -iname apr*config命令查找出“--with-apr-config=/usr/bin/apr-1-config”(不知道--with-apr-config=/usr/bin/apr-1-config有什么用,好像不要也可以,麻煩知道的告訴一下小弟)
再執(zhí)行下面的命令:
cd /root/mydir/mod_mono-2.6.3
./configure --prefix=/opt/mono --with-mono-prefix=/opt/mono --with-apr-config=/usr/bin/apr-1-config; make ; make install
cp /etc/httpd/conf.d/ /etc/httpd/conf/mod_mono.conf
selinux阻止了httpd對mod-mono-server的訪問,所以執(zhí)行下面的語句:
setsebool -P httpd_disable_trans=1
重啟httpd服務(wù)器:
service httpd restart
在防火墻中開啟80端口,允許同一個Lan的其他機器訪問:
方法1.在不使用圖形界面工具的時候,通過關(guān)閉防火墻來實現(xiàn)允許開放80端口
service iptables stop
(PS:我嘗試過下面的方法,
vi /etc/sysconfig/iptables
添加:-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
service iptables restart
雖然在iptables -L中看到http
但無法從其他機器訪問該服務(wù)器。
如果有誰成功,請告知小弟):
方法2.在安裝有圖形界面工具的情況下,用startx進入圖形界面,用“Security Level and Firewall”開啟80端口。
安裝libgdiplus(xsp的測試頁面中,有很多都需要libgdiplus):
yum install httpd build-essential gcc bzip bison pkgconfig glib-devel \
glib2-devel httpd-devel libpng-devel libX11-devel freetype fontconfig \
pango-devel ruby ruby-rdoc gtkhtml38-devel wget
wget http://ftp.novell.com/pub/mono/sources/libgdiplus/libgdiplus-2.6.2.tar.bz2
tar -jxvf libgdiplus-2.6.2.tar.bz2
cd /root/mydir/libgdiplus-2.6.2
./configure
make ; make install
echo export LD_LIBRARY_PATH=/usr/local/lib/:$LD_LIBRARY_PATH >>~/.bash_profile
source ~/.bash_profile
vi /opt/mono/etc/mono/config
添加節(jié)點:<dllmap dll="gdiplus.dll" target="/usr/lib/libgdiplus.so.0" />
否則會出現(xiàn)DllNotFoundException的異常。
測試:
一、測試mono
a.運行mono -V輸出:
Mono JIT compiler version 2.6.3 (tarball Fri Apr 2 06:13:46 CST 2010)
Copyright (C) 2002-2010 Novell, Inc and Contributors. http://www.mono-project.com/
TLS: __thread
GC: Included Boehm (with typed GC and Parallel Mark)
SIGSEGV: altstack
Notifications: epoll
Architecture: x86
Disabled: none
b.運行mono-test-install輸出:
Active Mono: /opt/mono/bin/mono
Your have a working System.Drawing setup
Your file system watcher is: System.IO.InotifyWatcher
二、測試Asp.Net服務(wù)器
a.測試是否能夠執(zhí)行aspx:
在/var/www/html/目錄下建一個test.aspx頁面,內(nèi)容為
<%="Hello World!"%>
通過wget http://localhost/test.aspx來下載該頁面的內(nèi)容。
b.測試同一個Lan下其他機器能否訪問:
用其他機器的瀏覽器打開http://ip/test.aspx
c.跑xsp自帶的測試程序(多點幾個頁面,查看是否會出現(xiàn)gdiplus.dll DllNotFoundException的一場):
1.修改Apache的配置,開放防火墻8080端口
Listen 8080
NameVirtualHost *:8080
<VirtualHost *:8080>
ServerAdmin hlfstephen@gmail.com
DocumentRoot /var/www/test/
ServerName local.mydomain.com
ErrorLog logs/local.mydomain.com-error_log
CustomLog logs/local.mydomain.com common
</VirtualHost>
2.復(fù)制/opt/mono/lib/xsp/test目錄到var/www/下
3.service httpd restart
4.用瀏覽器打開http://ip:8080/
參考:
http://blog.rubypdf.com/2009/10/23/how-to-install-mono-2-4-2-3-on-centos-5/
http://blog.rubypdf.com/2009/10/23/how-to-install-xsp-and-integrate-xsp-with-apache-2-under-centos-5/
http://blog.bennyland.com/2010/02/06/serving-asp-net-pages-in-apache-on-centos-5/
http://mingster.com/site/?q=content/mono-2x-centos-5
http://mono-project.com/DllNotFoundException
http://mono-project.com/Config_DllMap
轉(zhuǎn)載請保留鏈接: CentOS 5.1下跑Mono和Asp.net的實現(xiàn)方法
- 詳解CentOS 7.4下如何部署Asp.Net Core結(jié)合consul
- Centos7+Docker+Jenkins+ASP.NET Core 2.0自動化發(fā)布與部署的實現(xiàn)
- .Net Core部署到CentOS的圖文教程
- CentOS上搭建Nginx+Mono運行asp.net環(huán)境的配置方法
- 詳解將ASP.NET Core應(yīng)用程序部署至生產(chǎn)環(huán)境中(CentOS7)
- 在CentOS6.5上使用Jexus安裝部署ASP.NET MVC4和WebApi
- CentOS 5.1下跑Mono和Asp.net的實現(xiàn)方法
- Centos7系統(tǒng)下搭建.NET Core2.0+Nginx+Supervisor環(huán)境
相關(guān)文章
Linux?服務(wù)器硬件數(shù)據(jù)的收集及使用案例
這篇文章主要介紹了Linux?服務(wù)器硬件數(shù)據(jù)的收集,本文通過示例代碼給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有一定的參考借鑒價值,需要的朋友可以參考下2023-05-05CentOS 7.2配置Apache服務(wù)httpd(下)
這篇文章主要為大家詳細介紹了CentOS 7.2配置Apache服務(wù) httpd上篇,具有一定的參考價值,感興趣的小伙伴們可以參考一下2016-11-11Ubuntu12.04建立內(nèi)核樹實現(xiàn)過程詳解
這篇文章主要介紹了Ubuntu12.04建立內(nèi)核樹實現(xiàn)過程詳解,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友可以參考下2020-09-09Linux環(huán)境搭建之安裝/配置Tomcat的方法
本篇文章主要介紹了Linux環(huán)境搭建之安裝/配置Tomcat的方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-06-06Linux執(zhí)行可執(zhí)行文件提示No such file or directory的解決方法
這篇文章主要介紹了Linux執(zhí)行可執(zhí)行文件提示No such file or directory的解決方法,文中通過示例代碼介紹的非常詳細,對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2020-05-05Linux系統(tǒng)中KafKa安裝和使用方法 java客戶端連接kafka過程
這篇文章主要介紹了Linux系統(tǒng)中KafKa安裝和使用方法 java客戶端連接kafka過程,具有很好的參考價值,希望對大家有所幫助,如有錯誤或未考慮完全的地方,望不吝賜教2023-08-08