.NET CORE的官方(http://dotnet.github.io/getting-started/)只提供了Windows, Ubuntu14.04, 及Docker(也是基於Ubuntu14.04作的Image). 但鑑於微軟已經把RedHat作爲參考平臺並且用Ubuntu14.04作Server我內心仍是沒底的. 因此想着在CentOS下配置.NET CORE的環境git
開始我也是走的編譯源碼的路線,而後....搞編譯環境實在是否是我強項,難道木有簡單無腦的辦法,我是個懶人github
突然的靈感是ubuntu,mac下打印的信息是docker
.NET Command Line Tools (1.0.0-beta-001598)ubuntu
因而在github在找這個項目(https://github.com/dotnet/cli), 找到這個項目後一看README,賓果,我想要的包找到了.windows
能夠下載最新的包:https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/Latest/dotnet-centos-x64.latest.tar.gzcentos
可是由於官網上ubuntu及docker等等推薦的都是1.0.0.001598這個版本號,尷尬癌... 好吧, 試了一下socket
https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/1.0.0.001598/dotnet-centos-x64.1.0.0.001598.tar.gzide
成功了.測試
因而能夠開始了.centos7
1. virtualbox 安裝最小化的centos7.1, 安裝wget
2. 安裝.NET CORE
1). #:cd ~
2). #:mkdir dotnet
3). #:cd dotnet
2). #:wget https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/1.0.0.001598/dotnet-centos-x64.1.0.0.001598.tar.gz
3). #:tar -zxf dotnet-centos-x64.1.0.0.001598.tar.gz
3. 測試、運行:
接上面步驟
1). #:cd bin
2). #:./dotnet
提示錯誤:
Failed to load /root/dotnet/bin/libcoreclr.so, error: libunwind.so.8: cannot open shared object file: No such file or directory
fix: yum install libunwind
3). #:./dotnet
Failed to initialize CoreCLR, HRESULT: 0x80131500
fix: yum install icu (別問我爲何知道,嘿嘿)
4). #:./dotnet
4. 配置環境變量
1). #:vi /etc/profile
在最後面添加
PATH=~/dotnet/bin:$PATH
export PATH
2). #:source /etc/profile
如今能夠和ubuntu, mac, docker下同樣使用.net core編譯、運行,發佈你的項目啦
玩.NET CORE, 如今會遇到各類各樣的問題如MySql的provider, Redis的Provider... 在沒有官方版的狀況下只能本身改或徹底重寫了
附: 修改可用的MySql.Data, 我只記得改了SHA1驗證, socket鏈接的API也不同了, 爲了容易經過, 像Pipeline, File等鏈接方式也去掉了,只保留了TCP, 其它可能還有改動, 因此僅供娛樂, 開心就好
https://git.coding.net/zlzforever/share.git