install .NET on Red Hat

How to install .NET on Red Hat Enterprise Linux?

How To - A help section for how to do a task

Install .NET on Red Hat Enterprise Linux 7

To install .NET on Red Hat, first of all, you need to register via Red Hat Subscription Manager. Then we will proceed towards .NET core installation.

How to register via Subscription Manager? (Learn here)

If you have registered via Subscription Manager and enabled your .NET core channel, you can proceed to install & run the .NET SDK.

Open your terminal or command prompt and execute the following commands:

~$ yum install rh-dotnet20 -y
~$ scl enable rh-dotnet20 bash

Now you have to create your app. Close the command prompt and reopen it. Now, type the following commands:

~$ dotnet new console -o myApp
~$ cd myApp

The dotnet command will create the new app of console type. The -o parameter will create new folder or directory naming it myApp. Your app and its files will be stored here. To navigate to newly created folder myApp, you will use cd myApp command. There will be a file Program.cs in myApp folder which contains hello world code.

using System;

namespace myApp

{

class Program{

static void Main(string[] args){

Console.WriteLine("Hello World");

}

}

}

 

Now its time to run your app. To run your app, open your command prompt or terminal and write the following command and press enter to execute.

~$ dotnet run

 

Thanks for reading our tutorial. Check more!

Leave a Reply

Your email address will not be published. Required fields are marked *