天天看點

CentOS 7下安裝Mono

最近的項目中需要用到Linux作為伺服器,而我們的開發技術是基于.NET的,是以隻能在CentOS 7上嘗試着安裝一下Mono,下面是具體的安裝步驟:

1、安裝一些必備的依賴項

yum -y install wget glib2-devel libtiff libtiff-devel libjpeg libjpeg-devel giflib giflib-devel libpng libpng-devel libX11 libX11-devel freetype freetype-devel fontconfig fontconfig-devel libexif libexif-devel gcc-c++ gettext unzip zip bzip2 bzip2-devel curl-devel gtk2-devel boost-devel cairo-devel

2、下載下傳libgdiplus-3.8 并安裝

注意:此處2)步驟下載下傳這個軟體包可能下載下傳不成功,可以代理配合下載下傳工具将這個連結下的檔案下載下傳下來,然後拷貝到系統中1)步驟的路徑下,然後直接執行3)步驟即可。

1)cd /usr/local/src

2)wget http://origin-download.mono-project.com/sources/libgdiplus/libgdiplus-3.8.tar.gz  (如果這個位址不能用或者有更新版本位址,請自行更換)

3)tar -xvf libgdiplus-3.8.tar.gz

4)cd libgdiplus-3.8

5)./configure --prefix=/usr

6)make

7)make install

ps:mono-project 沒有3.8的源碼

3、下載下傳mono3.8.0 并安裝

2)wget http://download.mono-project.com/sources/mono/mono-3.8.0.tar.bz2 (如果這個位址不能用或者有更新版本位址,請自行更換)

3)tar -jxvf mono-3.8.0.tar.bz2

4)cd mono-3.8.0

4、使用Mono運作C#程式

1)将需要運作的C#程式的EXE和所需動态庫拷貝到/usr/src/csharpTest下;

2)使用指令:mono *.exe,其中,*.exe代表要驅動的應用程式;

3)如果用mono運作remoting程式,在使用Remoting中的TCP通道時,會碰到一個問題:Channel tcp is not securable while ensureSecurity is specified as true,是因為RemotingServer中在注冊通道的時候将ensureSecurity設定為TRUE造成的,改為FALSE即可;