Tech

dotnet linux : How to Install .NET core 3.1 on Ubuntu 20.04 LTS (Focal)

THIS ARTICLE HAS ASSOCIATED UPDATE as of 2023 JAN – if you want to install Latest .NET CORE 6 ON Ubuntu 22.04...

· 2 min read >
Ubuntu 20.04 LTS support for .Net core 3.1
Ubuntu 20.04 LTS support for .NET Core
.NET Core releases and versions of Ubuntu they are supported on.

THIS ARTICLE HAS ASSOCIATED UPDATE as of 2023 JAN – if you want to install Latest .NET CORE 6 ON Ubuntu 22.04 here is the link to latest article.

https://decatechlabs.com/dotnet-linux-how-to-install-net-core-6-on-ubuntu-22-04-1-lts

How do I install dotnet linux Ubuntu?

Before starting our journey dotnet linux or dotnet core linux .

First please check your ubuntu version and verify that it is compatible with .NET Core version you are planning to target by looking into the support table mentioned at start of the article.

Check your ubuntu version by using this command

lsb_release -a
check  dotnet core for linux
How to check the Ubuntu version for dotnet linux ?

Step# 1 First , Check if .NET Core is already installed. Skip to next step if you are sure you don’t have dotnet core for linux on your system.

Open terminal or .NET core CLI and run command mentioned below to find out if we don’t already have .NET core installed on system.

Purpose : Check SDK version              

dotnet --list-sdk

OUTPUT should be something similar like below with no errors truncated for readability

2.1.500 [/home/user/dotnet/sdk]
2.1.502 [/home/user/dotnet/sdk]
2.1.504 [/home/user/dotnet/sdk] 2.1.600 [/home/user/dotnet/sdk]

Purpose : Check .NET Core runtime version            

dotnet --list-runtimes

out put for dotnet --list-runtimes
output for dotnet –list-runtimes

Purpose: Check for install folders.

It’s possible that .NET Core 3.1 or other version is installed but not added to the PATH variable for your operating system or user profile. 

  •dotnet executable
/home/user/share/dotnet/dotnet

NET SDK
/home/user/share/dotnet/sdk/{version}/

NET Runtime
/home/user/share/dotnet/shared/{runtime-type}/{version}/

Step# 2 Now Let’s Add the Microsoft package signing key by running the Command specific to your ubuntu version .

  • Linux Ubuntu 20.04 (Focal Fossa)
  • Linux Ubuntu 19.10
  • Linux Ubuntu 18.04
-- For Ubuntu 20.04 run this command.
wget https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb 


-- For Ubuntu 19.10 run this command.
wget https://packages.microsoft.com/config/ubuntu/19.10/packages-microsoft-prod.deb -O packages-microsoft-prod.deb 


-- For Ubuntu 18.04 run this command.
wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb 
wget dotnet core for linux

Now run the command below.

sudo dpkg -i packages-microsoft-prod.deb
sudo dpkg

Step# 3 After that , Install .NET core 3.1 or .NET Core 2.1 on Ubuntu 20.04 LTS (Focal Fossa) we have this latest version in our case.

sudo apt-get install -y apt-transport-https
sudo apt-get update 

--For .net core 3.1 run this.
sudo apt-get install -y dotnet-sdk-3.1

-- For .net Core 2.1 run this.
sudo apt-get install -y dotnet-sdk-2.1
install transport layer apt-transport-https
install dotnet 3.1 sdk
installing .Net Core Using CLI Command : sudo apt-get install -y dotnet-sdk-3.1

Step#4 Finally , Verify the installation by using the command below

dotnet --info
how to check .net core version ?
How to check the dotnet core linux version ? command in the image above

Step# 5 Create a dotnet test project and run it.


-- Create a sample console app using CLI command below

dotnet new console -o hellowordapplication
create .net core console project

Optionally Make a change n Program.CS as listed in the image above. Now let’s run the dotnet core application. you might have to cd into the folder where project was created. Run the command below to run the dotnet core sample project.

dotnet run

you will see helloworld in the output.

dotnet run dotnet core for linux
dotnet run

You are all set. Sharing is caring so If it was helpful please comment and share. you can also read about when to choose .net core.

Next

Recommended system requirements:

  • 2 GHz dual core processor or better
  • 4 GB system memory
  • 25 GB of free hard drive space
  • Either a DVD drive or a USB port for the installer media
  • Internet access is helpful

Ubuntu 20.04 LTS includes the latest OpenStack release, Ussuri, as a preview with final release coming in the 20.04.1 LTS,

Please refer to the OpenStack Ussuri release notes for full details of this release of OpenStack.

net core six article

ASP.NET CORE 6 JWT Authentication

Apollo11 in Tech
  ·   9 min read
>