Menu
User

DropVPS Team

Writer: Cooper Reagan

How to install .NET in Ubuntu?

How to install .NET in Ubuntu?

Publication Date

06/25/2025

Category

Articles

Reading Time

2 Min

Table of Contents

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.

Linux VPS
U
Loading...

Related Posts

How to install .NET in Ubuntu?