How to install .NET in Ubuntu?

Installing .NET on Ubuntu is straightforward using Microsoft’s official package repositories. Here’s how to get it done safely and quickly.

Step 1: Install Prerequisites

First, update your system and install required dependencies:

sudo apt update
sudo apt install -y wget apt-transport-https software-properties-common

Step 2: Add Microsoft Package Repository

Download and install the Microsoft GPG key:

wget https://packages.microsoft.com/config/ubuntu/$(lsb_release -rs)/packages-microsoft-prod.deb
sudo dpkg -i packages-microsoft-prod.deb

Update the package index:

sudo apt update

Step 3: Install the .NET SDK

To install the full .NET SDK (which includes runtime + CLI tools):

sudo apt install -y dotnet-sdk-8.0

You can replace 8.0 with other versions if needed (e.g. 7.0, 6.0, etc.), depending on what version you want.

Step 4: Install the .NET Runtime Only (Optional)

If you only need to run .NET apps and not develop them:

sudo apt install -y dotnet-runtime-8.0

Step 5: Verify Installation

To confirm everything is installed correctly:

dotnet --version

You should see the version number of the installed .NET SDK or runtime.

Step 6: Create a Sample Console App (Optional)

To make sure .NET is working, try creating a test app:

dotnet new console -o testapp
cd testapp
dotnet run

This should output Hello, World! if everything is working properly.

Share:

More Posts

How to Install Maven on macOS 2025

What you will read?1 Check for Java Installation2 Install Homebrew (If Not Installed)3 Install Maven via Homebrew4 Verify Environment Variables (Optional)5 Create a Sample Maven

How to Use Google SMTP Server

What you will read?1 Step 1: Enable SMTP Access in Gmail2 Step 2: Secure Connection with TLS3 Step 3: Send an Email via SMTP4 Step

how to install wine on RHEL

What you will read?1 Check RHEL version and CPU architecture2 Update system and install base tools3 Verify subscription and enable CodeReady Builder4 Enable EPEL repository5

Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments