12

I cannot find a straightforward way of installing dotnet 2.2 on a AWS Linux 2 AMI.

There was some announcements that there was pre-built AMI's with it installed, but the ones I see, also have different versions of MSSQL Server.

Isn't there a way to install dotnet core 2.2 using yum or getting an AMI without SQL Server?

I found Run .NET programs on Amazon Linux AMI but I wonder if it is still valid, and if there is not an easier way.

Vlad
  • 802
  • 1
  • 10
  • 23

4 Answers4

13

Have you tried the following:

sudo yum update 
sudo yum install dotnet-sdk-2.2

Also this link might help: https://dotnet.microsoft.com/download/linux-package-manager/centos/sdk-current

  • 3
    Before this worked, I had to add the Microsoft signing key as detailed here: https://learn.microsoft.com/en-us/dotnet/core/install/linux-centos#centos-7- – Will Aug 07 '20 at 08:44
10

The following works for .NET Core 3.1 on Amazon Linux 2:

sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
sudo yum install dotnet-sdk-3.1

(or dotnet-sdk-5.0 for .NET 5)

More detail here: https://learn.microsoft.com/en-us/dotnet/core/install/linux-centos#centos-7-

If you're using AWS Elastic Beanstalk, and you only need the runtime (not the SDK) then you can just use the .NET Core / Linux platform.

Will
  • 2,086
  • 23
  • 30
5

Since the Amazon Linux is more akin to open-source Centos than RedHat, you can attempt to follow the yum instructions provided for Centos/Oracle linux.

https://dotnet.microsoft.com/download/linux-package-manager/centos/sdk-current

JD Williams
  • 395
  • 1
  • 8
  • Thanks for your answer, you are right, it works. But since @Jose A answered first I will accept his. Cheers. – Vlad May 09 '19 at 19:39
1

Here's what worked for me:

  • Download dotnet sdk manually from https://dotnet.microsoft.com/download/dotnet-core/3.1 (pick x64 binaries)
  • Extract downloaded tar with mkdir -p "$HOME/dotnet" && tar zxf dotnet-sdk-3.1.301-linux-x64.tar.gz -C "$HOME/dotnet" (you may have to adjust the tar file name)
  • Export dotnet root and update path export DOTNET_ROOT=$HOME/dotnet && export PATH=$PATH:$HOME/dotnet

Afterwards check installation with dotnet --version, it should work.

source: https://learn.microsoft.com/en-us/dotnet/core/install/linux-centos

Odin
  • 11
  • 1