SUSE12Sp3-.NET Core 2.2.1 runtime安裝

一、安裝libicu依賴html

一、在線安裝
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 #查看

顯示以下信息表示成功linux

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
二、離線安裝
sudo mkdir /usr/local/dotnet #建立目錄

將文件aspnetcore-runtime-2.2.1-linux-x64.tar.gz複製到 /usr/local/dotnetbash

sudo tar -xvf aspnetcore-runtime-2.2.1-linux-x64.tar.gz  # 解壓
./dotnet --info #查看
三、添加環境變量
env #查看全部環境變量

這個時候能看到全部的環境變量,找打併複製PATH一行,大概是下面這樣。不要直接複製這裏的,這裏只是例子。PATH=/home/allspark/bin:/usr/local/bin:/usr/bin:/bin:/usr/bin/X11:/usr/games服務器

sudo vi /etc/profile #編輯/etc/profile文件,就是環境變量文件

在最下面追加ssh

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
四、運行測試代碼

將發佈好的代碼複製到服務器spa

dotnet 你的項目.dll

例如個人code

dotnet WebApplication1.dll

訪問你程序的端口htm


2019/7/12 更新

最好使用這個腳本,以前上面寫的有個小問題。blog

#!/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 生產環境 - 總彙

相關文章
相關標籤/搜索