Update 2020 : This article was written in Feb 2018. Lot of things have changed and we have updated it accordingly. so this is all about net core linux.
For readers convenience , we have added a supported .NET Core releases and the versions of Ubuntu they’re supported on in the article. For Latest 2020 article keep reading and follow direction as mentioned below.
This article is still valid for Ubuntu 16.04 to install .Net core 2.1 and .NET Core 3.1 .
install dotnet core linux
Install .NET Core for Ubuntu 16.04, Ubuntu 18.04, Ubuntu 19.10 & Linux Mint 17, Linux Mint 18 (64 bit)
Road map to install dotnet core
net core linux
- install Visual studio code as a code editor – (skip to step#5 if already have any kind of code editor)
- install dotnet core Linux runtime
- Create/run a basic hello world app
NET Core 2.x is supported on the following Linux 64-bit (x86_64
or amd64
) distributions/versions:
- Red Hat Enterprise Linux 7
- CentOS 7
- Oracle Linux 7
- Fedora 25, Fedora 26
- Debian 8.7 or later versions
- Ubuntu 17.04, Ubuntu 16.04(I have this on my machine), Ubuntu 14.04
- Linux Mint 18, Linux Mint 17
- openSUSE 42.2 or later versions
- SUSE Enterprise Linux (SLES) 12 SP2 or later versions
ubuntu visual studio code install
step#1
Download Visual Studio Code deb format as shown in image below using this https://code.visualstudio.com/download to have ubuntu visual studio code install
Step#2
Navigate to the Download directory and install visual studio Code using these commands.
cd downloads
sudo dpkg -i filename.deb
Step#3 check if the visual studio is installed by typing word
code
in the search bar. you can see visual studio code is installed.
Step#4
install curl. open terminal and type commands
sudo apt install curl
Step#5 Register the Microsoft Product key as trusted. Run the following two commands
curl https://packages.microsoft.com/keys/microsoft.asc | gpg –dearmor > microsoft.gpg
sudo cp ./microsoft.gpg /etc/apt/trusted.gpg.d/
Step#6 Set up the desired version host package feed. Based on Operating system run the respective command. I am using Ubuntu 16.04 so I will use the third option – see the command in image below
Ubuntu 17.10
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-artful-prod artful main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-get update
Ubuntu 17.04
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-zesty-prod zesty main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-get update
Ubuntu 16.04 / Linux Mint 18
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-xenial-prod xenial main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-get update
Ubuntu 14.04 / Linux Mint 17
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-trusty-prod trusty main" > /etc/apt/sources.list.d/dotnetdev.list'
sudo apt-get update
Step#7 Install.NET Core
sudo apt-get install dotnet-sdk-2.1.4
Step# 8 check.NET core installed Version
dotnet --version
Step# 9 Create a sample console app using CLI command below
dotnet new console -o hellowordap
Step# 10 Let’s run this console app
cd helloworldapp dotnet run
Step#11 Open the folder in Visual Studio and you can see program.cs
Finally , we learned how to run .net core on linux
you can read more about history of .NET Core below.
The software development industry is constantly evolving. Everything is changed and improved, from languages to frameworks to tools to methodologies. The Framework has reached a point where it’s too rigid and monolithic to keep up with competitors. .NET Core is the necessary next step in the evolution of .NET. .NET core combines the best of the .NET Framework with the practices used in modern software development. some of the features of .NET Core:
Libraries that can function on multiple frameworks and operating system
Simple deployment for containers
High-performance web services with ASP.NET Core
Strong CLI support that enables developers to use their preferred tools
Here is a nice info about When to choose Microsoft .NET Core ?