首页 > 解决方案 > 如何在基于 linux 的 ec2 实例中安装 .net core 3.1

问题描述

我正在尝试使用 aws 实例配置。

因为我是新手。我试图安装 .net 3.1 核心。

遵循以下代码

sudo su -
yum install -y libunwind libicu
curl -sSL -o dotnet.tar.gz https://go.microsoft.com/fwlink/?LinkID=835019
mkdir -p /opt/dotnet && sudo tar zxf dotnet.tar.gz -C /opt/dotnet
ln -s /opt/dotnet/dotnet /usr/local/bin/dotnet

但没有任何效果。不完全了解上述代码的工作原理,想知道它。

并且还想在我的 ec2 实例上安装 .net3.1 核心。

你能帮我解决这个问题吗?

标签: .netamazon-web-servicesamazon-ec2

解决方案


最好以原生 Linux 方式安装软件包。

由于 Amazon Linux 基于 RHEL,您可以参考以下命令。

SDK

sudo yum install scl-utils
subscription-manager repos --enable=rhel-7-server-dotnet-rpms
yum install rh-dotnet31 -y
scl enable rh-dotnet31 bash
source scl_source enable rh-dotnet31

运行

subscription-manager repos --enable=rhel-7-server-dotnet-rpms
yum install rh-dotnet31-aspnetcore-runtime-3.1 -y
scl enable rh-dotnet31-aspnetcore-runtime-3.1 bash
source scl_source enable rh-dotnet31-aspnetcore-runtime-3.1

参考: https ://docs.microsoft.com/en-us/dotnet/core/install/linux-rhel#rhel-7-


推荐阅读