Skip to content
Follow
Ubuntu Linux

How to Install .NET 7 on Ubuntu Linux

Richard
Written by
Richard
Nov 11, 2022 Updated Sep 15, 2026 3 min read
How to Enable or Disable Microsoft Defender Cloud Protection
How to Enable or Disable Microsoft Defender Cloud Protection

.NET 7 is a Microsoft software platform that lets you run and build apps on Ubuntu Linux 22.04 or 20.04. Ubuntu does not include this platform in its standard software list by default, so you need to set up the official Microsoft package repository first to get the files.

Advertisement

You can complete the setup using a few terminal commands to add the software keys and run the install tool. This process gives you access to the latest developer tools and performance updates for your projects without extra software bloat.

⚡ Quick Answer

Install .NET 7 on Ubuntu by adding the official Microsoft repository. First, get the Microsoft GPG key, then create a repository file specific to your Ubuntu version. Finally, update apt and install dotnet-sdk-7.0, dotnet-runtime-7.0, and aspnetcore-runtime-7.0.

Advertisement

How to install .NET 7 on Ubuntu Linux

As described above, Microsoft announced the release of .NET 7 with enhanced Linux and native ARM64 support.

Below is how to install it on Ubuntu Linux.

Install .NET 6

To install .NET 6 on Ubuntu, you can use the built-in package manager to get the software quickly. Running two quick commands in your terminal adds the required development tools and runtime files to your system without needing any extra download sources.

To install .NET 6, run the commands below.

Advertisement
sudo apt update
sudo apt install dotnet6

The commands above will install all the SDK, Runtime, and ASP.NET packages.

You can install each of the features separately using the commands below.

sudo apt install dotnet-sdk-6.0
sudo apt install dotnet-runtime-6.O
sudo apt install aspnetcore-runtime-6.0

Install .NET 7

The .NET 7 Ubuntu installation requires setting up Microsoft's official software repository first because the package is not available in the default Ubuntu app lists. You need to download the security key and configure your system to trust the official Microsoft download source before running the install command.

📝Good to KnowFirst, run the commands below to add the Microsoft repository's GPG key.

First, run the commands below to add the Microsoft repository's GPG key.

Advertisement
sudo apt install curl
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | sudo dd of=/usr/share/keyrings/microsoft.gpg
📝Good to KnowOnce the repository GPG key is installed, run the commands below to create a repository file for each version of Ubuntu.

For version 22.04:

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

For version 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

For version 18.04:

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

After adding the repository's key and file, run the commands below to install .NET 7.

sudo apt update
sudo apt install dotnet-sdk-7.0
sudo apt install dotnet-runtime-7.0 
sudo apt install aspnetcore-runtime-7.0

To see information about .NET, run the commands below.

dotnet --info

That should output similar lines as below:

.NET SDK:

 Version:   7.0.100
 Commit:    e12b7af219
Runtime Environment:
 OS Name:     ubuntu
 OS Version:  22.10
 OS Platform: Linux
 RID:         linux-x64
 Base Path:   /usr/share/dotnet/sdk/7.0.100/
Host:
  Version:      7.0.0
  Architecture: x64
  Commit:       d099f075e4
.NET SDKs installed:
  7.0.100 [/usr/share/dotnet/sdk]
.NET runtimes installed:
  Microsoft.AspNetCore.App 7.0.0 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 7.0.0 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
Other architectures found:
  None
Environment variables:
  Not set
global.json file:
  Not found
Learn more:
  https://aka.ms/dotnet/info
Download .NET:
  https://aka.ms/dotnet/download

That should do it!

Advertisement

Reference:

Conclusion:

  • This guide outlines the step-by-step process to install Microsoft .NET 7 on Ubuntu Linux, leveraging the official Microsoft .NET repository.
  • Following the described procedures, users can easily set up the latest version of .NET on their Ubuntu systems despite the current absence of .NET 7 packages in the default repositories.
  • The thorough instructions covering the installation of .NET 6 and .NET 7, enable developers to leverage the full capabilities of the new features and performance enhancements brought by .NET 7.
  • For further details and discussions, please utilize the comment section in the reference link.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

Advertisement

📚 Related Tutorials

How to Install .NET Core (dotnet) SDK on Ubuntu Linux
Ubuntu Linux How to Install .NET Core (dotnet) SDK on Ubuntu Linux
How to Install Apache on Ubuntu Linux
Ubuntu Linux How to Install Apache on Ubuntu Linux
How to Install Nginx on Ubuntu Linux
Ubuntu Linux How to Install Nginx on Ubuntu Linux
How to Install Ghost on Ubuntu Linux with Nginx
CMS How to Install Ghost on Ubuntu Linux with Nginx

No comments yet — be the first to share your thoughts!

Leave a Comment

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