歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux綜合 >> Linux安裝 >> CentOS 7.1下安裝dotnet core

CentOS 7.1下安裝dotnet core

日期:2017/4/19 13:54:21   编辑:Linux安裝

.NET CORE的官方()只提供了Windows, Ubuntu14.04, 及Docker(也是基於Ubuntu14.04做的Image). 但鑒於微軟已經把RedHat做為參考平台而且用Ubuntu14.04做Server我心裡還是沒底的. 所以想著在CentOS下配置.NET CORE的環境

開始我也是走的編譯源碼的路線,然後....搞編譯環境實在是不是我強項,難道木有簡單無腦的辦法,我是個懶人

忽然的靈感是Ubuntu,Mac下打印的信息是

.NET Command Line Tools (1.0.0-beta-001598)

於是在github在找這個項目(https://github.com/dotnet/cli), 找到這個項目後一看README,賓果,我想要的包找到了.

可以下載最新的包:https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/Latest/dotnet-centos-x64.latest.tar.gz

但是因為官網上ubuntu及docker等等推薦的都是1.0.0.001598這個版本號,尴尬癌... 好吧, 試了一下

https://dotnetcli.blob.core.windows.net/dotnet/beta/Binaries/1.0.0.001598/dotnet-centos-x64.1.0.0.001598.tar.gz

成功了.

於是可以開始了.

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

CentOS 7.1下安裝dotnet core

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

Copyright © Linux教程網 All Rights Reserved