Install DotNet on Rocky Linux 8 with Easy Steps – OrcaCore
In this guide, we’ll walk you through the process of how to Install DotNet on Rocky Linux 8. Dot NET Core is the latest general-purpose development platform maintained by Microsoft. It boasts cross-platform compatibility and has been redesigned to be fast, flexible, and modern. This represents a significant contribution from Microsoft, enabling developers to build Android, iOS, Linux, Mac, and Windows applications with .NET, all under an open-source license.
You can now proceed to the Guide steps below on the Orcacore website to complete the DotNet Core setup on Rocky Linux 8.
Steps To Install .NET Core on Rocky Linux 8
Before you begin the process to Install DotNet on Rocky Linux 8, ensure you are logged in to your server as a non-root user with sudo privileges. If you need assistance with this, refer to our guide on Initial Server Setup with Rocky Linux 8.
1. Install DotNet on Rocky Linux 8
First, update your local package index using the following command:
sudo dnf update -y
The .NET packages are readily available in the default Rocky Linux repository.
You can install .Net tools, runtime, and SDK with the command below:
sudo dnf install dotnet
For installing only .NET Runtime, use the following command:
sudo dnf install dotnet-runtime-7.0
If you want to install the Net Software Development Kit (.Net SDK), use the command below:
sudo dnf install dotnet-sdk-7.0
Verify DotNet Setup
Note: To see the available versions for installation, run:
sudo dnf search dotnet
After the installation is complete, verify your Dotnet (.NET) installation on Rocky Linux 8 with the following command:
dotnet --info

Now, let’s explore how to use Dotnet core by creating a sample project on Rocky Linux.
2. Create a Sample Project with the .NET
First, create a new console application with the following command (named ‘MyApp’ in this example):
dotnet new console -o MyApp -f net7.0
**Output**
The template "Console App" was created successfully.
Processing post-creation actions...
Restoring /root/MyApp/MyApp.csproj:
Determining projects to restore...
Restored /root/MyApp/MyApp.csproj (in 167 ms).
Restore succeeded.
Next, navigate to your project directory:
cd MyApp
A demo program named program.cs
already exists within the created project directory. To execute this demo program, use the command:
dotnet run
**Output**
Hello, World!
3. Uninstall .Net from Rocky Linux 8
If you no longer need .NET, you can easily remove it using the command:
sudo dnf remove dotnet
To remove the SDK and runtime specifically, use these commands:
sudo dnf remove dotnet-sdk-<your-version>
sudo dnf remove dotnet-runtime-<your-version>
For example, if the version is 7.0, the command will be:
sudo dnf remove dotnet-sdk-7.0
For more information, consult the .NET Documentation page.
Conclusion
At this point, you have successfully learned how to Install Dotnet on Rocky Linux 8. .NET Core is a free, cross-platform framework ideal for building modern applications for Windows, Linux, and macOS. It’s well-suited for web, desktop, cloud, and mobile applications requiring high performance and scalability.
Hope you enjoy it. You may also like these articles:
Install and Use Iptables on Rocky Linux 8
Install PostgreSQL 14 on Rocky Linux 8
Extend Sudo Session Timeout in Linux
Understanding /etc/passwd File Format
Create Hidden Files and Folders in Linux
How to do input/output redirection in Linux
How to make a permanent alias in Linux?
How to create and run a shell script in Linux
FD Linux Command with Examples
Alternative Installation Methods
While dnf
provides a straightforward method for installing .NET on Rocky Linux 8, alternative methods exist that can be useful in specific scenarios. Here are two such methods:
1. Using Microsoft Package Repositories
Microsoft provides its own package repositories specifically designed for installing .NET. This method ensures you receive the latest updates directly from Microsoft. This method is particularly useful if you need a specific version of .NET that may not be available in the default Rocky Linux repositories, or if you want to ensure timely updates.
Steps:
-
Register the Microsoft Product Feed: First, you’ll need to register the Microsoft product feed. The exact command might vary slightly depending on the specific .NET version you intend to install. Consult the official Microsoft documentation for the most up-to-date registration command. An example for .NET 7 is shown below:
sudo rpm -Uvh https://packages.microsoft.com/config/rocky/8/packages-microsoft-prod.rpm
-
Install .NET SDK or Runtime: Once the repository is registered, you can install the .NET SDK or runtime using
dnf
. The package names are typicallydotnet-sdk-<version>
ordotnet-runtime-<version>
.sudo dnf install dotnet-sdk-7.0
or
sudo dnf install dotnet-runtime-7.0
-
Verify Installation: Verify the installation using
dotnet --info
as described in the original guide.
Advantages:
- Direct updates from Microsoft.
- Potential access to more recent versions.
Disadvantages:
- Requires adding an external repository.
- Might require manual configuration updates if Microsoft changes the repository structure.
2. Using Snap (unofficial)
While less common, the Snap package manager offers another way to install .NET on Rocky Linux 8. Note that this is an unofficial method, meaning the packages are maintained by the Snap community, not directly by Microsoft. Therefore, proceed with caution and ensure the Snap package is from a reputable source.
Steps:
-
Install Snapd: If Snapd is not already installed on your Rocky Linux 8 system, you’ll need to install it first.
sudo dnf install snapd sudo systemctl enable --now snapd.socket sudo ln -s /var/lib/snapd/snap /snap
-
Install .NET Core via Snap: Use the
snap install
command to install the desired .NET Core version. You may need to search for the appropriate Snap package name.sudo snap install dotnet-sdk --classic
Note: The
--classic
flag is needed because .NET requires access to system resources. -
Verify Installation: After installation, verify the .NET Core installation by running the
dotnet --info
command in a new terminal or after logging out and back in. Snap installs often modify the PATH variable, and a new session might be needed for the command to be recognized.
Advantages:
- Easy installation process (assuming Snapd is already installed).
- Provides a sandboxed environment.
Disadvantages:
- Unofficial packages, potential security risks.
- Snap packages tend to be larger in size.
- Performance might be slightly impacted due to sandboxing.
- Snap package might lag behind the official releases in terms of versions.
These alternative methods provide flexibility when installing .NET on Rocky Linux 8, allowing you to choose the approach that best suits your needs and preferences. However, the dnf
method using the default repositories is generally recommended for its simplicity and stability. To properly Install DotNet on Rocky Linux 8, you should always be aware of the various methods available.