Enable .NET channel

In order to install .NET Core from Red Hat on RHEL, you first need to register using the Red Hat Subscription Manager. If this has not been done on your system, or if you are unsure, see the Red Hat Getting Started Guide.

Install the .NET SDK

After registering with the Subscription Manager and enabling the .NET Core channel, you are ready to install and enable the .NET SDK.

In your terminal, run the following commands:

Terminal

yum install rh-dotnet22 -yscl enable rh-dotnet22 bash

Register Microsoft key and feed

Before installing .NET, you'll need to register the Microsoft key, register the product repository, and install required dependencies. This only needs to be done once per machine.

Check everything installed correctly

Once you've installed, open a new command prompt and run the following command:

Once you've installed, open a new terminal and run the following command:

Terminal

dotnet

If the command runs, printing out information about how to use dotnet, you're good to go.

If you receive a 'dotnet' is not recognized as an internal or external command error, make sure you opened a new command prompt. If you can't resolve the issue, use the I ran into an issue button to get help fixing the problem.

Create your app

In your command prompt, run the following commands:

In your terminal, run the following commands:

Terminal

dotnet new console -o myAppcd myApp

The dotnet command creates a new application of type console for you. The -o parameter creates a directory named myApp where your app is stored, and populates it with the required files. The cd myApp command puts you into the newly created app directory.

The main file in the myApp folder is Program.cs. By default, it already contains the necessary code to write "Hello World!" to the Console.