Chapter 1. Install .NET Core 1.0 on Red Hat Enterprise Linux
This Getting Started Guide describes how to install .NET Core 1.0 on Red Hat Enterprise Linux and perform a simple Hello World! script.
Install Red Hat Enterprise Linux using:
Register the system by following the appropriate steps in Registering and Unregistering a System in the Red Hat Subscription Management document. You can also register the system with the following command.
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 determine the pool ID of a subscription that provides access to the .NET Core repository.
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 .NET Core repository. Replace pool_id with the pool ID you determined 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 your system has currently attached.
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 Linux 7. If you are using a Workstation edition of Red Hat Enterprise Linux 7, change -server- to -workstation- in the following command.
subscription-manager repos --enable=rhel-7-server-dotnet-rpms
# subscription-manager repos --enable=rhel-7-server-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 Install .NET Core 1.0 and all of its dependencies.
yum install rh-dotnetcore10
# yum install rh-dotnetcore10Copy to Clipboard Copied! Toggle word wrap Toggle overflow Enable the rh-dotnetcore10 collection environment.
scl enable rh-dotnetcore10 bash
$ scl enable rh-dotnetcore10 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, the enabling does not carry over. Consider permanently enabling it.source scl_source enable rh-dotnetcore10
$ source scl_source enable rh-dotnetcore10Copy 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 Create the following directory.
mkdir hello-world
$ mkdir hello-worldCopy to Clipboard Copied! Toggle word wrap Toggle overflow Navigate to the following directory.
cd hello-world
$ cd hello-worldCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create a new .NET Core project.
dotnet new
$ dotnet newCopy to Clipboard Copied! Toggle word wrap Toggle overflow Pull the dependencies needed for the .NET Core project.
dotnet restore
$ dotnet restoreCopy to Clipboard Copied! Toggle word wrap Toggle overflow Run the .NET Core project.
dotnet run
$ dotnet runCopy to Clipboard Copied! Toggle word wrap Toggle overflow