In this article, we’ll explain how to install Dotnet Core on Ubuntu.
.NET Core is a free, cross-platform, open-source developer platform for building many different types of applications. 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.
- An Ubuntu installed system.
- A root user access of normal user with administrative privileges.
Install Dotnet Core on Ubuntu
Step 1: Download and Install MS Prob on Ubuntu
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. Following link is for Ubuntu 20.04. You can check your Ubuntu version’s package link.
# wget https://packages.microsoft.com/config/ubuntu/20.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
Following commands will install the Dotnet core library and functions on our Ubuntu system. You can check the source codes of the Dotnet core here in GitHub.
First, update and install the transport-HTTP tools to install the Dotnet SDK package.
# apt update
# apt install apt-transport-https -y
Now, install the Dotnet SDK packages
# apt install dotnet-sdk-3.1
Once the installation gets completed, follow output will show:
Welcome to .NET Core 3.1!
SDK Version: 3.1.409
Step 3: Create a New Project
We have completed with the installation. Now, lets create a simple 'Hello World!' project to test Dotnet core in Linux
Run following command to create a project:
# dotnet new console -o HostnExtra
The project will be stored in the ~/HostnExtra/ directory.
Run the following cd command to open the project’s directory. Then run the Dotnet run command to run your project.
# cd HostnExtra
# dotnet run
That’s it. We have completed with the installation.
In this article, we have seen how to install Dotnet Core on Ubuntu.