centos7安装 .netcore

.NET CORE的官方(http://dotnet.github.io/getting-started/)只提供了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

  1. 配置环境变量

      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

本文永久更新链接地址:http://www.linuxidc.com/Linux/2016-04/129960.htm

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Centos7发布说明 环境说明: 服务器系统:CentOS 7.2.1511 相关工具:Xshel、Xftp 服务器软件软件:.netcore、nginx、supervisor 准备好发布的程序 安装.NET Core SDK for CentOS7 打开网址:https://www.microsoft.com/net/core#linuxcentos 复制如下命令,单步执行: sudo yum install libunwind libicu curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=835019 sudo mkdir -p /opt/dotnet && sudo tar zxf dotnet.tar.gz -C /opt/dotnet sudo ln -s /opt/dotnet/dotnet /usr/local/bin 输入 dotnet –info 来查看是否安装成功 配置Nginx 下载安装Nginx,单步执行如下命令: curl -o nginx.rpm http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm rpm -ivh nginx.rpm yum install nginx systemctl start nginx 来启动nginx systemctl enable nginx 来设置nginx的开机启动(linux宕机、重启会自动运行nginx不需要连上去输入命令)。 配置防火墙 命令:firewall-cmd --zone=public --add-port=80/tcp --permanent(开放80端口) 命令:systemctl restart firewalld(重启防火墙以使配置即时生效) 测试nginx是否可以访问。 配置nginx对ASP.NET Core应用的转发 修改 /etc/nginx/conf.d/default.conf 文件,将文件内容替换为: server { listen 80; location / { proxy_pass http://localhost:5000; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection keep-alive; proxy_set_header Host $host; proxy_cache_bypass $http_upgrade; } }
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值