This guide will show you how to install .NET 8.0 on Ubuntu 24.04. .NET is a free, open-source platform used for building different types of applications, like web apps, mobile apps, and desktop apps. With .NET, you can create powerful and flexible software.

For example, you can build a website using ASP.NET, develop mobile apps with Xamarin, or create desktop applications with Windows Forms or WPF. Installing .NET on your Ubuntu system will allow you to start developing these types of applications quickly.

Steps to Install .NET 8 on Ubuntu 24.04

Follow the steps below to set up .NET 8.0 on your Ubuntu 24.04 machine. Let’s get started!

Prerequisites

Before we start, you need to have a few things ready:

  • An Ubuntu 24.04 system.
  • A user account with sudo (admin) permissions.
  • An internet connection.

Step 1: Update Your System

First, we need to make sure your system is up-to-date. Open your terminal and type these commands:

sudo apt update
sudo apt upgrade -y

Step 2: Install Required Dependencies

.NET required some extra software to work properly. You can install them by executing the following command:

sudo apt install -y apt-transport-https ca-certificates gnupg

Step 3: Add Microsoft Package Repository

Next, we will add the Microsoft package repository to your system. This will help us download and install .NET 8.0.

  1. Download the Microsoft signing key:
    wget https://packages.microsoft.com/config/ubuntu/24.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb
    
  2. Install the downloaded package:
    sudo dpkg -i packages-microsoft-prod.deb
    
  3. Update the package list again:
    sudo apt update
    

Step 4: Install .NET SDK

Now, we will install the .NET SDK, which has everything you need to build and run .NET applications.

  1. Install the .NET SDK:
    sudo apt install -y dotnet-sdk-8.0
    

    To install previous version, You can simply replace dotnet-sdk-8.0 with that version like dotnet-sdk-6.0.

  2. Check the installation:
    dotnet --version
    

    You should see the .NET 8.0 version number on your screen.

Step 5: Install .NET Runtime (Optional)

If you only need to run .NET applications, you can install just the runtime.

  1. Install the .NET Runtime:
    sudo apt install -y dotnet-runtime-8.0
    
  2. Check the runtime installation:
    dotnet --list-runtimes
    

    This command should list the installed runtimes, including .NET 8.0.

Step 6: Create a Simple .NET Application

Let’s create a simple .NET application to verify that everything is working correctly.

  1. Create a new console application:
    dotnet new console -o dotnet-app
    
  2. Navigate to the application directory:
    cd dotnet-app
    
  3. Run the application:
    dotnet run
    

    You should see the output “Hello, World!” in your terminal.

Conclusion

Congratulations! You have successfully installed .NET 8.0 on Ubuntu 24.04. With .NET, you can build a wide range of applications, from web apps with ASP.NET to mobile apps using Xamarin and desktop applications with Windows Forms or WPF. This setup will allow you to create robust and flexible software solutions efficiently.

For further learning, you can explore these resources:

By following this guide, you are now ready to start your journey with .NET 8.0 on Ubuntu 24.04, enabling you to develop various applications seamlessly on your Linux system.