Home Tutorials How to Install (.NET Core) Dotnet Core on Linux Distributions

How to Install (.NET Core) Dotnet Core on Linux Distributions

Software developers often need to use the Dotnet core framework on the Linux system to test, run, and build the packages. The notion of using Dotnet on Linux comes true through the new Dotnet core, which is an API based modular system of Microsoft’s Dotnet framework. But the Dotnet core doesn’t act as a single API; it functions as a shared or public library of API and codes. Programmers and developers can use those shared API and codes to automate some tasks or reduce the workload.

Dotnet Core on Linux


Dotnet core supports more than thirty programming languages. But C# is the most used language on the Dotnet core framework. The architecture of the Dotnet core is very much flexible and modular-based. Visual Studio, Visual Studio Code, Unity, and many other applications require the Dotnet core pre-installed to run on Linux.

Very often, you might need to install the Dotnet core packages on your Linux system to run some specific games and other applications on your system. Previously, the Dotnet framework was not open-source and available for Linux-based operating systems, but later, Microsoft has made it open-source.

The Dotnet core is available for Debian, Red Hat, CentOS, OpenSUSE, and other Linux distributions. Unfortunately, the Dotnet core’s official packages are still not available for the Arch and Arch-based Linux system. But don’t worry, we will work on that. In this post, we will see how to install the Dotnet core packages on various Linux distributions.

1. Install Dotnet Core on Ubuntu Linux


Ubuntu and other Debian Linux users can install the Dotnet core packages from Linux’s official package repository by using the aptitude package manager. Before installing the Dotnet core on your Ubuntu system, you should check whether the package is already installed on your Debian system or not. Run the following command-lines on your terminal shell to check if the dotnet core is installed or not.

dotnet --list-sdks
dotnet --list-runtimes

check dotnet core

Step 1: Download and Install MS Prob on Ubuntu


As Microsoft builds the Dotnet framework, we need to install the Microsoft prob functions on our Debian system to make our Linux environment appropriate for the Dotnet framework. Now, we will download and install the Microsoft prob package on our Ubuntu system. Use the following wget command to download the Microsoft prob package on your Ubuntu.

wget https://packages.microsoft.com/config/ubuntu/18.04/packages-microsoft-prod.deb

Now, run the following Debian package installer command to install the MS prob package on your Ubuntu machine.

sudo dpkg -i packages-microsoft-prod.deb

Step 2: Install the Dotnet SDK


This step will see how to install the Dotnet core library and functions on our Debian system. The complete dotnet core packages are known as the Dotnet SDK. You can check the source codes of the Dotnet core here in GitHub.

First, you need to update your system repository and install the transport-HTTP tools to install the Dotnet SDK package. Run the following aptitude commands on your terminal shell to install the transport-HTTP packages and the Dotnet SDK packages on your Debian system.

sudo apt update
sudo apt install apt-transport-https -y
sudo apt install dotnet-sdk-3.1

When the download and installation are finished, you would see the ‘Welcome to .NET Core’ message on your terminal shell. You can now close your terminal shell.

Step 3: Install Dotnet Runtime


A Dotnet runtime package is an essential tool for the Dotnet framework. It enables the system to share the code and API with other existing applications on your Linux system. You can run the following command-lines on your terminal shell to install the Dotnet core runtime package on your Ubuntu Linux.

sudo apt update
sudo apt install apt-transport-https -y
sudo apt install dotnet-runtime-3.1

Step 4: Create a New Project


We have now seen how to install the Dotnet core on your Ubuntu and other Debian Linux system. We will now see how you can create a simple ‘Hellow World’ project to test the Dotnet core on Linux.

We will use the console command to create a new project on Linux. You can run the following command-line given below to create a simple project. The project will be stored in the /home/ubuntupit/UbuntuPIT/ directory.

dotnet new console -o UbuntuPIT

You can now run the following cd command to open the project’s directory. Then run the dotnet run command to run your project.

cd UbuntuPIT
dotnet run

2. Install Dotnet Core on Fedora and Red Hat Linux


Microsoft has officially developed the Dotnet core package for Fedora, Red Hat, and CentOS Linux. You can install it on your Red Hat-based Linux system by running the DNF and YUM commands. However, you can also check the Dotnet core package on the Snap store.

Step 1: Install SDK on Fedora


If you are a Fedora or CentOS user, you can run the following DNF command on your terminal shell to install the Dotnet SDK package on your Linux system. The SDK package includes the modular tool, java, and host tools.

sudo dnf install dotnet-sdk-3.0

If you are a Red Hat Linux user, you can run the following Yum command to install the Dotnet core SDK package on your machine. In Red Hat Linux, the YUM command automatically installs the runtime tool, ASP.NET Core, host tool, and other required tools on your Red Hat Linux system. You don’t need to install the other packages furthermore. However, Fedora users can also run the following YUM command.

sudo yum install dotnet-sdk-3.1

Step 2: Install Runtime on Fedora


Once the SDK package is installed on your Fedora Linux, it’s now time to install the runtime and ASP.NET core packages on your system. Run the following DNF commands given below to install the runtime and ASP.NET packages on your system.

sudo dnf install aspnetcore-runtime-3.1
sudo dnf install dotnet-runtime-3.1

3. Install Dotnet on openSUSE


On OpenSUSE Linux, installing the Dotnet core package is a bit different than other Linux distributions. We will have to download the package repositories from Microsoft and install them on our OpenSUSE Linux to get the Dotnet framework on our system.

Step 1: Install LibICU on OpenSUSE


At the beginning of installing the Dotnet core on OpenSUSE, we need to install the library functions of the International Components for Unicode (LibICU). Run the following zypper command to install the LibICU on your SUSE Linux.

sudo zypper install libicu

Now, run the following RPM command to import the microsoft.asc file on your OpenSuSE Linux.

sudo rpm --import https://packages.microsoft.com/keys/microsoft.asc

Then, run the wget command given below to download the openSUSE package repositories from Microsoft.

wget https://packages.microsoft.com/config/opensuse/15/prod.repo

Now, move the file to the etc directory and run the chown command given below to get access to the Microsoft prob file.

sudo mv prod.repo /etc/zypp/repos.d/microsoft-prod.repo
sudo chown root:root /etc/zypp/repos.d/microsoft-prod.repo

Step 2: Install the Dotnet SDK and Runtime Package


In this step, we will install the Dotnet core SDK package on our SuSE Linux system. Run the zypper command given below to install the SDK package on OpenSUSE Linux.

sudo zypper install dotnet-sdk-3.1

After the SDK tool is installed successfully, you can now install the Runtime package and the ASP.NET tool on your SuSE Linux. You can run the following command-lines given below to install the ASP.NET and Runtime package.

sudo zypper install aspnetcore-runtime-3.1
sudo zypper install dotnet-runtime-3.1

4. Install Dotnet Core on Arch Linux


As I have mentioned earlier that Microsoft has not developed any official package of Dotnet core for the Arch and Arch-based Linux system; as a result, you can’t find any official release of Dotnet core for Arch Linux. But fortunately, Microsoft has made the Dotnet core open-source, so developers have designed and built the Dotnet core packages for Arch Linux.

Method 1: Install Dotnet SDK and Runtime on Arch


This method will use the Package manager (pacman) commands to install the Dotnet SDK on our system. If you are a Manjaro and other Arch Linux user, you can run the following Pacman command on your terminal shell to install both SDK and Runtime packages on your Arch Linux.

sudo pacman -S dotnet-runtime dotnet-sdk

If you don’t need the Runtime package for Dotnet core, you can find the other packages here and install only the SDK package.

Method 2: Install Dotnet Core on Arch by SNAP


SNAP is a great alternative way to install packages on Linux distributions. Here is another option for Arch Linux users, you can install the Dotnet core package on your system through the SNAP package manager.

Run the following command-lines given below to install the SNAP package manager on our system.

sudo pacman -S snapd
sudo systemctl enable --now snapd.socket
sudo ln -s /var/lib/snapd/snap /snap

Now, run the command-line given below to install the Dotnet core on your system.

sudo snap install dotnet-sdk --classic

Ending Words


If you are a regular desktop user, maybe you don’t need to get the Dotnet framework installed inside your Linux system. But, programmers, API developers even gammers need the Dotnet core installed on Linux to continue the software testing and gamming smoothly. I have described how you can install the Dotnet core on various Linux distributions in the entire post.

If you find this post useful and handy, please share it with your friends and the Linux community. You can write if you have any opinions regarding this post in the comment section.

NO COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here


Exit mobile version