Run .NET programs on Amazon Linux AMI

2019-07-25 15:22发布

问题:

How can I run a .NET program on an Amazon Linux AMI, either by installing Mono or .NET Core? Or is the runtime already installed?

I tried yum -y install mono but got No package mono available, and yum -y install mono-complete doesn't work either.

I couldn't find any way to install .NET core either - there are no packages listed when I run yum search dotnet (or yum search mono for that matter).

回答1:

I managed to install .NET Core by following this tutorial - Deploy ASP.NET Core Application On EC2 Amazon Linux Instance.

I needed to run these commands:

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

After that I could start my application by running dotnet MyApplication.exe.