How to Install Microsoft .NET 7 on Ubuntu?

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

Hello, friends. In this post, you will learn how to install Microsoft .NET 7 on Ubuntu.

Although Microsoft has always been reluctant to port its applications to Linux, lately we have seen changes and a sign of this is the possibility that we have to install .NET 7.

.NET is an application platform that allows the creation and execution of web services and Internet applications. It is owned by Microsoft, who are responsible for its development and maintenance.

The innovation behind .NET consists in integrating all the Microsoft development tools, libraries, languages, technologies, purposes, under the same platform.

In short, with .NET, you will have a framework where you will be able to create cross-platform tools.

Let’s go to

Install Microsoft .NET 7 on Ubuntu 22.04 | 20.04

NET 7 is not present in the official Ubuntu repositories, but this does not make it difficult to install.

To achieve this, open a terminal and completely update the system

sudo apt update
sudo apt upgrade

Then, add the GPG key from the official Microsoft repository for Linux

curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo dd of=/usr/share/keyrings/microsoft.gpg

In case you don’t have curl installed, just run

sudo apt install curl

The next step is to add the repository

echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft.gpg] https://packages.microsoft.com/ubuntu/22.04/prod jammy main' | sudo tee /etc/apt/sources.list.d/microsoft.list >/dev/null

In the case of Ubuntu 20.04

echo 'deb [arch=amd64 signed-by=/usr/share/keyrings/microsoft.gpg] https://packages.microsoft.com/ubuntu/20.04/prod focal main' | sudo tee /etc/apt/sources.list.d/microsoft.list >/dev/null

Now, install the packages that together make up .NET 7

sudo apt update
sudo apt install dotnet-sdk-7.0 dotnet-runtime-7.0 aspnetcore-runtime-7.0
Install Microsoft .NET 7 on Ubuntu
Install Microsoft .NET 7 on Ubuntu

When the process is finished, you can run this command to check the information about .NET 7

dotnet --info

You will get an output screen like this

.NET SDK:
 Version:   7.0.202
 Commit:    6c74320bc3

Runtime Environment:
 OS Name:     ubuntu
 OS Version:  22.04
 OS Platform: Linux
 RID:         ubuntu.22.04-x64
 Base Path:   /usr/share/dotnet/sdk/7.0.202/

Host:
  Version:      7.0.4
  Architecture: x64
  Commit:       0a396acafe

.NET SDKs installed:
  7.0.202 [/usr/share/dotnet/sdk]

.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.4 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 7.0.4 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
.
.
.
.

So, it’s ready! .NET 7 is ready to use.

Conclusion

Learning how to install .NET 7 is an important step to using it on Linux. Now, Microsoft’s support has become good and allows without too many problems to use it.

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Angelo
Angelo
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook