How to install .NET Core (dotnet) on Ubuntu 22.04 LTS

Learn the commands to install .Net Core SDK and Runtime on Ubuntu 22.04 LTS Jammy JellyFish Linux using the terminal – Apt Repository, Script, or Snap. 

Microsoft DotNet is one of the most popular software development frameworks for several years. The .NET Core is a free and open-source platform for building modern cloud-based web applications on Windows, Linux, and macOS operating systems. It is a cross-platform successor to the .NET Framework. The project is mainly developed by Microsoft and published under an MIT license. Compared to the .Net Framework, the .NET Core is more focused on web, Windows Mobile, and Windows applications.

.NET Core is provided as a series of NUGET packages. It was factored, modularized, and delivered as several NUGET packages. Although the common runtime libraries are still part of the bundle, the developer has the freedom to selectively integrate other libraries as required. This makes .NET Core very lightweight. No additional luggage.


Steps to install .Net Core SDK & Runtime on Ubuntu 22.04 LTS

#1st Method: Using Script

Download Dotnet Installation Script

Well, one of the easiest possible ways to start with Dotnet is to install it with the script officially provided by Microsoft. The user can use it to install both .Net SDK or Core and .Net Runtime.

sudo apt install wget

Get the Script


Make it executable:

chmod +x


Install .Net Core SDK on Ubuntu 22.04 LTS

The given command will execute the downloaded script to install the latest version of Dotnet.

./ -c Current

Whereas the user who is looking for some particular version can replace the ‘Current‘ in the command with that. For example, if you want to install version .Net version 5, the above command will be like:

./ -c 5.0


Note: The installation path will be “/home/$USER/.dotnet“. The $USER  is the one you used to run the above-given script. Also, you can add this path to your system variable to globally access the dotnet command line.

Note: Replace $USER with your current one:

echo 'export PATH="$PATH:/home/$USER/.dotnet/"' >> ~/.bashrc

If you don’t have its folder in your path then you will get “dotnet command not found on your ubuntu”. Hence to solve this user either have to switch its folder or need to mention its folder path every time to run it.

Reload session:

newgrp $User

Check version:


dotnet --list-sdks

For Runtime:

dotnet --list-runtimes


Install .Net Core RunTime on Ubuntu 22.04

If you don’t want the complete .Net Core SDK and only looking for ASP.NET Core Runtime to run existing web/server applications whereas for only dotnet runtime go for the second command:

./ -c Current --runtime aspnetcore

Only for .Net Runtime

./ -c Current --runtime dotnet


#2nd method using APT repository- The best one

If you don’t want to use the script to install Dotnet on Ubuntu 22.04 Linux then another method is by adding the repository. This will give us an easy way to update .Net in the future by using the APT command.

Add .Net Repository

As I said if you want to get easily future updates for this Microsoft developing platform then add its repository manually. Here are the commands to follow:

Add the repo:

wget -O packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb
rm packages-microsoft-prod.deb

Run Update and also install tool for HTTPS support

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


Apt command to install .Net Core SDK on Ubuntu Focal

Finally, we are done with the repository, now it’s time to simply use the APT package manager command for the installation of Microsoft dot net.

sudo apt install dotnet-sdk-6.0


Whereas for only Asp .Net Core runtime use:

sudo apt-get install aspnetcore-runtime-6.0

And for Only .Net Runtime, this one:

sudo apt-get install dotnet-runtime-6.0


Remove or Uninstall SDK (optional)

To remove SDK using APT run:

sudo apt remove dotnet-sdk-6.0


#3rd way: Install using SNAP


Use Snap to install Dotnet on Ubuntu 22.04

Well, if you are interested in SNAP, then here it is. SNAP comes default on Ubuntu as it is available pre-installed.

Next to install the complete .Net SDK using snap go for the given command:

sudo snap install dotnet-sdk --classic --channel=6.0

To access its command line without mentioning the SDK version, set alias:

sudo snap alias dotnet-sdk.dotnet dotnet


To uninstall (optional):

sudo snap remove dotnet-sdk --classic --channel=6.0




Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.