Easy Steps To Install Dotnet Core on AlmaLinux 9

This guide intends to teach you to Install Dotnet Core on AlmaLinux 9. The .NET is a free and open-source development platform created by Microsoft. It is used for building a wide range of applications by providing various tools, programming languages, and libraries. The .NET Core is a cross-platform framework for websites and servers on Windows, Linux, and macOS.

It includes SDK and Runtime packages. The .NET Runtime, Handles running applications, including memory management, thread management, and compilation. And .NET SDK (Software Development Kit), provides tools and libraries for development and compilation.

Steps To Install Dotnet Core on AlmaLinux 9

Before you start your installation process, you must log in to your server as a non-root user with sudo privileges. For this purpose, you can check the Initial Server Setup with AlmaLinux 9.

Now follow the steps below to complete this guide.

Step 1 – List Available Versions of dotnet on AlmaLinux 9

First, run the system update with the command below:

sudo dnf update -y

Then, use the command below to list the variable versions you can install:

sudo dnf search dotnet
List Available Versions of dotnet on AlmaLinux 9

Step 2 – Installing .NET Core on AlmaLinux 9

At this point, you can easily install your desired version on dotnet on your server.

You can install the targeting pack with the following command:

sudo dnf install dotnet-apphost-pack-8.0.x86_64

For installing only .NET Runtime, you can use the following command:

sudo dnf install dotnet-runtime-8.0

If you want to install the .Net Software Development Kit (.Net SDK), you can use the command below:

sudo dnf install dotnet-sdk-8.0

In this guide, we installed the SDK packages. Once your dotnet installation on AlmaLinux 9 is completed, you can verify it by using the command below:

dotnet --info
Install Dotnet Core on AlmaLinux 9

Now you can test your .NET installation by creating a sample project.

Step 3 – Create a Sample Project with dotnet on AlmaLinux 9

At this point, we want to show you how to create a sample program with .NET. To do this, you need to create a new console app with the command below:

dotnet new console -o MyApp -f net8.0

In your output, you will see:

Dotnet sample project

Next, navigate to your project directory:

cd MyApp

There is already a demo program inside the created project directory called program.cs. To run the demo program, use the following command:

dotnet run

In your output, you should see the Hello World message.

Step 4 – Uninstall and Remove .NET from AlmaLinux 9

If you plan to remove dotnet from your AlmaLinux 9 server, you can simply use the following commands:

sudo dnf remove dotnet-apphost-pack-8.0.x86_64

For Runtime and SDK, you can use:

# sudo dnf remove dotnet-sdk-8.0
# sudo dnf remove dotnet-runtime-8.0

Note: You can replace your exact packages.

For more information, you can visit the Microsoft Dotnet Docs page.

Conclusion

Dotnet (.NET) is a powerful and complete framework that is suitable for various programming needs. It provides high performance, security, amazing features, and many more options for app development. At this point, you have learned to Install Dotnet Core on AlmaLinux 9 and test your installation with a sample project.

Hope you enjoy it. Also, you may like to read the following articles:

Install Scala 3 in RHEL 9 using Terminal

Set up Node.js on AlmaLinux 9

Install Rust Programming Language on AlmaLinux 9

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Stay informed and not overwhelmed, subscribe now!