yum安装

依赖

  • krb5-libs
  • libicu
  • openssl-libs
  • zlib
#查看是否安装过依赖
yum list installed |grep krb5-libs

#联网安装依赖
yum install krb5-libs

安装

#1.注册Microsoft密钥
sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm

#2.安装SDK(可不安装)
sudo yum install dotnet-sdk-3.1

#3.安装Aspnetcore运行时
sudo yum install aspnetcore-runtime-3.1

#4.可选安装netcore
sudo yum install dotnet-runtime-3.1

#5.启动项目报错 Couldn't find a valid ICU package installed on the system. 可下载libicu库
yum install libicu

手动安装

依赖

  • krb5-libs
  • libicu
  • openssl-libs
  • zlib

依赖包可以通过yum下载,或者通过手动安装安装包

#查看是否安装过依赖
yum list installed |grep krb5-libs

#离线安装,通过以下网站找到对应的安装包,Ctrl+F搜索即可
#http://mirror.centos.org/centos/7/os/x86_64/Packages/

# 本地安装yum安装包
yum localinstall krb5-libs-1.15.1-50.el7.x86_64.rpm

安装

#1.下载运行时二进制包 
#https://dotnet.microsoft.com/en-us/download/dotnet/3.1

#2.将aspnetcore-runtime-3.1.28-linux-x64.tar.gz放入dotnet目录
mkdir /usr/local/dotnet

#3.解压二进制包(根据下载的二进制包名进行解压)
tar zxf aspnetcore-runtime-3.1.28-linux-x64.tar.gz

#4.设置环境变量
vim /etc/profile
#--------------------------
export DOTNET_ROOT=/usr/local/dotnet
export PATH=$PATH:$DOTNET_ROOT:$DOTNET_ROOT/tools
#--------------------------

#5.重载配置文件
source /etc/profile

#6.测试运行时是否安装成功
dotnet --info

#7.启动项目报错 Couldn't find a valid ICU package installed on the system. 可下载libicu库,可下载http://mirror.centos.org/centos/7/os/x86_64/Packages/libicu-50.2-4.el7_7.x86_64.rpm
yum localinstall libicu-50.2-4.el7_7.x86_64.rpm

多运行时手动安装

下载dotnet runtime

按照手动安装方式,先安装一个dotnet运行时版本,再安装其他版本运行时

简易方式(适用所有运行时都是手动安装)

#1.下载运行时二进制包 
#https://dotnet.microsoft.com/zh-cn/download/dotnet/6.0

#2.将aspnetcore-runtime-6.0.28-linux-x64.tar.gz放入dotnet目录
cd /usr/local/dotnet

#3.解压二进制包(根据下载的二进制包名进行解压),解压后文件会自动放入各自目录
tar zxf aspnetcore-runtime-6.0.28-linux-x64.tar.gz

#4.查看dotnet信息
dotnet --info

#5.查看dotnet运行时
dotnet --list-runtimes

详细方式

#1.下载运行时二进制包 
#https://dotnet.microsoft.com/zh-cn/download/dotnet/6.0

#2.创建dotnet6目录,将aspnetcore-runtime-6.0.28-linux-x64.tar.gz放入dotnet6目录
mkdir /root/dotnet6

#3.解压二进制包(根据下载的二进制包名进行解压)
tar zxf aspnetcore-runtime-6.0.28-linux-x64.tar.gz

#4.进入dotnet目录
cd /usr/local/dotnet

#5.查看dotnet目录内容
ll /usr/local/dotnet
-rwxr-xr-x 1 1001 116 72160 Jul 14  2022 dotnet
drwxr-xr-x 3 1001 116  4096 Jul 14  2022 host
-rw-r--r-- 1 1001 116  1116 Mar 22 16:29 LICENSE.txt
drwxr-xr-x 4 1001 116  4096 Jul 14  2022 shared
-rw-r--r-- 1 1001 116 78479 Mar 22 16:29 ThirdPartyNotices.txt

#6.将host/fxr/x.x.xx移动到/usr/local/dotnet/host/fxr/目录下
mv /root/dotnet6/host/fxr/6.0.28 /usr/local/dotnet/host/fxr/6.0.28

#7.shared/Microsoft.AspNetCore.App/x.x.xx移动到/usr/local/dotnet/shared/Microsoft.AspNetCore.App/目录下
mv /root/dotnet6/shared/Microsoft.AspNetCore.App/6.0.28 /usr/local/dotnet/shared/Microsoft.AspNetCore.App/6.0.28

#8.shared/Microsoft.NETCore.App/x.x.xx移动到/usr/local/dotnet/shared/Microsoft.NETCore.App/目录下
mv /root/dotnet6/shared/Microsoft.NETCore.App/6.0.28 /usr/local/dotnet/shared/Microsoft.NETCore.App/6.0.28

#9.查看dotnet信息
dotnet --info

#10.查看dotnet运行时
dotnet --list-runtimes
文章作者: Willxup
版权声明: 本站所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来自 Willxup
.Net .Net
喜欢就支持一下吧