Centos下安装 .net Core运行程序

首先要进行更新下镜像文件

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc
sudo sh -c 'echo -e "[packages-microsoft-com-prod]\nname=packages-microsoft-com-prod \nbaseurl= https://packages.microsoft.com/yumrepos/microsoft-rhel7.3-prod\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/dotnetdev.repo'

[root@localhost /]# rpm --import https://packages.microsoft.com/keys/microsoft.asc
[root@localhost /]# sh -c 'echo -e "[packages-microsoft-com-prod]\nname=packages-microsoft-com-prod \nbaseurl= https://packages.microsoft.com/yumrepos/microsoft-rhel7.3-prod\nenabled=1\ngpgcheck=1\ngpgkey=https://packages.microsoft.com/keys/microsoft.asc" > /etc/yum.repos.d/dotnetdev.repo'

 

 

 接着就可以直接安装了

Install the .NET SDK

Update the products available for installation, install the components required by .NET, then install the .NET SDK.

In your command prompt, run the following commands:

 

sudo yum update
sudo yum install libunwind libicu
sudo yum install dotnet-sdk-2.1.103

  

A command will be run during the install process that will improve project restore speed and enable offline access. It will take up to a minute to complete.
验证中 : aspnetcore-store-2.0.6-2.0.6-1.x86_64 1/8
验证中 : dotnet-runtime-2.0.6-2.0.6-1.x86_64 2/8
验证中 : dotnet-hostfxr-2.0.6-2.0.6-1.x86_64 3/8
验证中 : aspnetcore-store-2.0.5-2.0.5-1.x86_64 4/8
验证中 : aspnetcore-store-2.0.3-2.0.3-1.x86_64 5/8
验证中 : dotnet-sdk-2.1.103-2.1.103-1.x86_64 6/8
验证中 : dotnet-host-2.1.0_preview1_26216_03-1.x86_64 7/8
验证中 : aspnetcore-store-2.0.0-2.0.0-1.x86_64 8/8

已安装:
dotnet-sdk-2.1.103.x86_64 0:2.1.103-1

作为依赖被安装:
aspnetcore-store-2.0.0.x86_64 0:2.0.0-1 aspnetcore-store-2.0.3.x86_64 0:2.0.3-1 aspnetcore-store-2.0.5.x86_64 0:2.0.5-1 aspnetcore-store-2.0.6.x86_64 0:2.0.6-1
dotnet-host.x86_64 0:2.1.0_preview1_26216_03-1 dotnet-hostfxr-2.0.6.x86_64 0:2.0.6-1 dotnet-runtime-2.0.6.x86_64 0:2.0.6-1

 

好了,现在你可以运行donet命令进行测试了,默认安装目录在/usr/share/dotnet下面

 

dotnet --version#查看版本
dotnet --info #查看安装的信息
dotnet new razor #可以创建一个razorPage项目,

  

转载于:https://www.cnblogs.com/kingkoo/p/8751639.html

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、付费专栏及课程。

余额充值