Chapter 1. Install .NET Core 1.1 on Red Hat Enterprise Linux
This Getting Started Guide describes how to install .NET Core 1.1 on Red Hat Enterprise Linux (RHEL).
Install RHEL 7 using one of the following images:
Register the system by following the appropriate steps in Registering and Unregistering a System in the Red Hat Subscription Management document. You can also use the following command to register the system.
subscription-manager register
# subscription-manager registerCopy to Clipboard Copied! Toggle word wrap Toggle overflow Display a list of all subscriptions that are available for your system and identify the pool ID for the subscription.
subscription-manager list --available
# subscription-manager list --availableCopy to Clipboard Copied! Toggle word wrap Toggle overflow This command displays its name, unique identifier, expiration date, and other details related to it. The pool ID is listed on a line beginning with Pool ID.
Attach the subscription that provides access to the
dotNET on RHELrepository. Replace pool_id with the pool ID you identified in the previous step.subscription-manager attach --pool=<appropriate pool ID from the above step>
# subscription-manager attach --pool=<appropriate pool ID from the above step>Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the list of subscriptions attached to your system.
subscription-manager list --consumed
# subscription-manager list --consumedCopy to Clipboard Copied! Toggle word wrap Toggle overflow Enable the .NET Core channel for Red Hat Enterprise 7 Server, Red Hat Enterprise 7 Workstation, or HPC Compute Node with one of the following commands, respectively.
subscription-manager repos --enable=rhel-7-server-dotnet-rpms subscription-manager repos --enable=rhel-7-workstation-dotnet-rpms subscription-manager repos --enable=rhel-7-hpc-node-dotnet-rpms
# subscription-manager repos --enable=rhel-7-server-dotnet-rpms # subscription-manager repos --enable=rhel-7-workstation-dotnet-rpms # subscription-manager repos --enable=rhel-7-hpc-node-dotnet-rpmsCopy to Clipboard Copied! Toggle word wrap Toggle overflow Install the scl tool.
yum install scl-utils
# yum install scl-utilsCopy to Clipboard Copied! Toggle word wrap Toggle overflow
1.1. Install .NET Core 1.1 Copy linkLink copied to clipboard!
Install .NET Core 1.1 and all of its dependencies.
yum install rh-dotnetcore11
# yum install rh-dotnetcore11Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enable the rh-dotnetcore11 collection environment.
scl enable rh-dotnetcore11 bash
$ scl enable rh-dotnetcore11 bashCopy to Clipboard Copied! Toggle word wrap Toggle overflow This command does not persist; it creates a new shell, and the
dotnetcommand is only available within that shell. If you log out, use another shell, or open up a new terminal, thedotnetcommand is no longer enabled. Consider permanently enabling it by adding the following line to your~/.bashrcfile.source scl_source enable rh-dotnetcore11
source scl_source enable rh-dotnetcore11Copy to Clipboard Copied! Toggle word wrap Toggle overflow Run the following command to prove the installation succeeded.
dotnet --help
$ dotnet --helpCopy to Clipboard Copied! Toggle word wrap Toggle overflow
1.2. Create a .NET Core 1.1 Project Copy linkLink copied to clipboard!
If you want to run the classic "Hello World" test case, create the following directory.
mkdir hello-world
$ mkdir hello-worldCopy to Clipboard Copied! Toggle word wrap Toggle overflow Navigate to the
hello-worlddirectory.cd hello-world
$ cd hello-worldCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a .NET Core 1.1 project.
dotnet new
$ dotnet newCopy to Clipboard Copied! Toggle word wrap Toggle overflow Pull the dependencies needed for the .NET Core 1.1 project.
dotnet restore
$ dotnet restoreCopy to Clipboard Copied! Toggle word wrap Toggle overflow Run the .NET Core 1.1 project.
dotnet run
$ dotnet runCopy to Clipboard Copied! Toggle word wrap Toggle overflow