SUSE12Sp3-.NET Core 2.2.1 runtime安装

1、安装libicu依赖

1、在线安装
sudo mkdir /usr/local/dotnet #创建目录 
cd /usr/local/dotnet
sudo wget https://download.visualstudio.microsoft.com/download/pr/53cace8f-2907-487e-84d7-bc7a7ba5de05/326704ffa2ef9d4dcd0db2f1da996ebb/aspnetcore-runtime-2.2.1-linux-x64.tar.gz  # 下载离线安装包
sudo tar -xvf aspnetcore-runtime-2.2.1-linux-x64.tar.gz  # 解压
./dotnet --info #查看 

显示如下信息表示成功

Host (useful for support):
  Version: 2.2.1
  Commit:  878dd11e62 
.NET Core SDKs installed:
  No SDKs were found. 
.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.2.1 [/home/allspark/Downloads/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.2.1 [/home/allspark/Downloads/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.2.1 [/home/allspark/Downloads/shared/Microsoft.NETCore.App] 
To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
2、离线安装
sudo mkdir /usr/local/dotnet #创建目录

将文件aspnetcore-runtime-2.2.1-linux-x64.tar.gz复制到 /usr/local/dotnet

sudo tar -xvf aspnetcore-runtime-2.2.1-linux-x64.tar.gz  # 解压
./dotnet --info #查看
3、添加环境变量
env #查看所有环境变量

这个时候能看到所有的环境变量,找打并复制PATH一行,大概是下面这样。不要直接复制这里的,这里只是例子。PATH=/home/allspark/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games

sudo vi /etc/profile #编辑/etc/profile文件,就是环境变量文件

在最下面追加

export 你刚刚复制的:/usr/local/dotnet #输入,:wq保存退出,

例如:

export PATH=/home/allspark/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games:/usr/local/dotnet
source /etc/profile 	#立即生效环境变量

dotnet --info # 出现以下内容说明安装正确。如果输入没有正确,断掉ssh登录,重新连接,再次输入命令

Host (useful for support):
  Version: 2.2.1
  Commit:  878dd11e62
.NET Core SDKs installed:
  No SDKs were found.
.NET Core runtimes installed:
  Microsoft.AspNetCore.All 2.2.1 [/usr/local/dotnet/shared/Microsoft.AspNetCore.All]
  Microsoft.AspNetCore.App 2.2.1 [/usr/local/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 2.2.1 [/usr/local/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download
4、运行测试代码

将发布好的代码复制到服务器

 dotnet 你的项目.dll

例如我的

dotnet WebApplication1.dll

访问你程序的端口


2019/7/12 更新

最好使用这个脚本,之前上面写的有个小问题。

#!/bin/bash
set -x

#新建目录
sudo mkdir /usr/local/dotnet

# 解压到/usr/local/dotnet目录
sudo tar -zxvf aspnetcore-runtime-2.2.1-linux-x64.tar.gz -C /usr/local/dotnet

# 追加环境变量
cat >>/etc/profile <<-"EOF"
export DOTNET_HOME=/usr/local/dotnet
export PATH=$DOTNET_HOME:$PATH
EOF

# 生效环境变量
source /etc/profile

dotnet --info

SUSE12Sp3 安装配置. net core 生产环境 - 总汇

posted @ 2019-02-18 09:42  HANFAN  阅读(1088)  评论(0编辑  收藏  举报