How to Install DotNet Core On Ubuntu

How to install .Net Core On Ubuntu

In this article, you’ll understand how to install .NET Core on Linux. and We will discuss the step by step implementation process of the below points.

1] Install Visual Studio code as a code editor

2] Install .NET core Linux runtime

3] Create/run a basic “Welcome App” app

The .NET Core 2.x is supported on the following Linux 64-bit versions:

Fedora 25, Fedora 26
Debian 8.7 or later versions
Ubuntu 17.04, Ubuntu 16.04 , Ubuntu 14.04
Linux Mint 18, Linux Mint 17
Red Hat Enterprise Linux 7
CentOS 7
Oracle Linux 7
openSUSE 42.2 or later versions
SUSE Enterprise Linux

Step 1
Let’s go and Download the Visual Studio Code deb format as shown in the image below using this

Download Visual Studio Code

Step 2
Then Open the terminal by clicking this icon, and type terminal.

open terminal in ubuntu

Step 3
Navigate to the directory and install Visual Studio code using these commands.

cd downloads sudo dpkg -i filename.deb
cd downloads
sudo dpkg - i filename . deb

Step 5
Install curl. After that, open terminal and type the command

sudo apt install curl

Step 6
Register the Microsoft trusted Product key. Run the following two commands

curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg

sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg

Step 7
Set up the intended version host package feed. Based on the operating system, then run the respective command.

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 8
Install.NET Core.

sudo apt-get install dotnet-sdk-2.1.4

Step 9
Check the .NET core installed version.

dotnet --version

Create the sample console app using CLI command below.

dotnet new console -o hellowordapp

Step 11
Let’s run this console app.

~$ cd helloworldapp
 $ dotnet run

Step 12
Let’s Open a folder in Visual Studio and you can see the program.cs.

//program.cs

using System;

namespace HelloWorld
{
  class Program
  {
     static void Main(string[] args)
	 {
	   Console.writeline("Hello World");
	 }
  }
}

One Comment

Leave a Reply

Your email address will not be published. Required fields are marked *