Skip to main content
Redhat Developers  Logo
  • AI

    Get started with AI

    • Red Hat AI
      Accelerate the development and deployment of enterprise AI solutions.
    • AI learning hub
      Explore learning materials and tools, organized by task.
    • AI interactive demos
      Click through scenarios with Red Hat AI, including training LLMs and more.
    • AI/ML learning paths
      Expand your OpenShift AI knowledge using these learning resources.
    • AI quickstarts
      Focused AI use cases designed for fast deployment on Red Hat AI platforms.
    • No-cost AI training
      Foundational Red Hat AI training.

    Featured resources

    • OpenShift AI learning
    • Open source AI for developers
    • AI product application development
    • Open source-powered AI/ML for hybrid cloud
    • AI and Node.js cheat sheet

    Red Hat AI Factory with NVIDIA

    • Red Hat AI Factory with NVIDIA is a co-engineered, enterprise-grade AI solution for building, deploying, and managing AI at scale across hybrid cloud environments.
    • Explore the solution
  • Learn

    Self-guided

    • Documentation
      Find answers, get step-by-step guidance, and learn how to use Red Hat products.
    • Learning paths
      Explore curated walkthroughs for common development tasks.
    • Guided learning
      Receive custom learning paths powered by our AI assistant.
    • See all learning

    Hands-on

    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.
    • Interactive labs
      Learn by doing in these hands-on, browser-based experiences.
    • Interactive demos
      Click through product features in these guided tours.

    Browse by topic

    • AI/ML
    • Automation
    • Java
    • Kubernetes
    • Linux
    • See all topics

    Training & certifications

    • Courses and exams
    • Certifications
    • Skills assessments
    • Red Hat Academy
    • Learning subscription
    • Explore training
  • Build

    Get started

    • Red Hat build of Podman Desktop
      A downloadable, local development hub to experiment with our products and builds.
    • Developer Sandbox
      Spin up Red Hat's products and technologies without setup or configuration.

    Download products

    • Access product downloads to start building and testing right away.
    • Red Hat Enterprise Linux
    • Red Hat AI
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Featured

    • Red Hat build of OpenJDK
    • Red Hat JBoss Enterprise Application Platform
    • Red Hat OpenShift Dev Spaces
    • Red Hat Developer Toolset

    References

    • E-books
    • Documentation
    • Cheat sheets
    • Architecture center
  • Community

    Get involved

    • Events
    • Live AI events
    • Red Hat Summit
    • Red Hat Accelerators
    • Community discussions

    Follow along

    • Articles & blogs
    • Developer newsletter
    • Videos
    • Github

    Get help

    • Customer service
    • Customer support
    • Regional contacts
    • Find a partner

    Join the Red Hat Developer program

    • Download Red Hat products and project builds, access support documentation, learning content, and more.
    • Explore the benefits

.NET Core on Red Hat platforms

January 17, 2020
Tom Deseyn
Related topics:
.NETContainers
Related products:
Red Hat OpenShift

    In this article, we look at the various ways .NET Core is made available on Red Hat platforms. We start with an overview of the available platforms, and then show how to install .NET Core on each of them.

    Platform overview

    Let's start with the overview. If you are familiar with these platforms already, you can skip to the sections that cover specific platforms.

    Operating systems

    From an operating system point of view, we’ll look at four distributions:

    • Fedora is a community maintained distribution that moves fast. It is a great option for developers who want access to the latest development tools and the latest kernel.
    • Red Hat Enterprise Linux (RHEL) is a long-term support (LTS) distribution by Red Hat that is based on Fedora.
    • CentOS is a community maintained downstream rebuild of Red Hat Enterprise Linux.
    • CentOS Stream is a rolling preview distribution of future Red Hat Enterprise Linux versions.

    All of these distributions are Free as in Freedom, so the software is available and open for change. Fedora and CentOS have no cost (Free as in Beer). For Red Hat Enterprise Linux, you pay a support subscription to Red Hat. For development purposes, however, you can use a no-cost Red Hat Developer subscription and download Red Hat Enterprise Linux, as well as our other products and tools at no cost.

    Containers

    Most public cloud vendors support creating Red Hat Enterprise Linux- and CentOS-based virtual machines (VMs). The VMs based on RHEL are supported by Red Hat, and the VMs based on CentOS are supported by the CentOS community.

    With container technology, operating systems are now also packaged into container images. These images contain packages from the OS, but not the kernel. Red Hat provides Red Hat Enterprise Linux 7- and RHEL 8-based images. Red Hat Enterprise Linux 8-based images are based on the Universal Base Image (UBI). For Red Hat Enterprise Linux 7, some images are provided as UBI images and others as non-UBI images. The RHEL 7 non-UBI images are hosted on registry.redhat.io and require subscription credentials to be pulled. The UBI images are hosted on registry.access.redhat.com and require no subscription for download. These images may be used in production without a Red Hat subscription, on any platform. However, when the UBI images run on a Red Hat Enterprise Linux platform, subscribers get support from Red Hat. The CentOS community also provides images that are hosted on registry.centos.org.

    OpenShift

    For running container-based applications, Red Hat provides Red Hat OpenShift, which is based on Kubernetes. Kubernetes provides the core functionality for scheduling containers across multiple machines. OpenShift packages Kubernetes in a form that is usable, deployable, and maintainable. Red Hat provides a supported version of OpenShift that can be deployed on-prem and in public clouds (e.g., Azure, AWS, and GCP). Red Hat OpenShift is based on the open source, upstream okd project. To run OpenShift on your development machine, you can use Red Hat CodeReady Containers (CRC) for OpenShift 4.x, and the Red Hat Container Development Kit (CDK) for OpenShift 3.x.

    .NET Core on each platform

    Now, let's take a look at how to install .NET Core onto each Red Hat platform.

    .NET Core on Fedora

    .NET Core on Fedora is built by the Fedora .NET Special Interest Group (SIG). Because .NET Core doesn’t meet the Fedora packaging guidelines, it is distributed from a separate repository.

    To install .NET Core on Fedora, you need to enable the copr repository and install the sdk package:

    $ sudo dnf copr enable @dotnet-sig/dotnet
    $ sudo dnf install dotnet-sdk-2.1
    

    When possible, the SIG also builds preview versions of .NET Core. These preview versions are distributed from a separate repository:

    $ sudo dnf copr enable @dotnet-sig/dotnet-preview
    $ sudo dnf install dotnet-sdk-3.1
    

    For more information about running .NET Core on Fedora, see the Fedora .NET documentation.

    .NET Core on Red Hat Enterprise Linux 7 and CentOS 7

    On Red Hat Enterprise Linux 7 and CentOS 7, .NET Core versions are packaged into their own software collection (SCLs). This method of packaging allows .NET Core to include libraries that are newer than those provided by the base OS.

    To install .NET Core on Red Hat Enterprise Linux, the machine needs to be registered with the Red Hat subscription management system. Depending on the OS flavor (e.g., Server, Workstation, or HPC Compute node), you need to enable the proper .NET Core repository:

    $ sudo subscription-manager repos --enable=rhel-7-server-dotnet-rpms
    $ sudo subscription-manager repos --enable=rhel-7-workstation-dotnet-rpms
    $ sudo subscription-manager repos --enable=rhel-7-hpc-node-dotnet-rpms
    

    Next, the SCL tooling needs to be installed:

    $ sudo yum install scl-utils
    

    Now we can install a specific version of .NET Core:

    $ sudo yum install rh-dotnet21 -y
    

    To use the .NET Core SCL, we first need to enable it. For example, we can run bash in the SCL by running:

    $ scl enable rh-dotnet30 bash
    

    For more information about running .NET Core on Red Hat Enterprise Linux 7, see the .NET Core Getting Started Guides.

    .NET Core on Red Hat Enterprise Linux 8/CentOS 8

    On the newer RHEL 8, .NET Core is included in the AppStream repositories, which are enabled by default. A version of .NET Core can be installed by running:

    $ sudo dnf install dotnet-sdk-2.1
    

    For more information about running .NET Core on Red Hat Enterprise Linux 8, see the .NET Core Getting Started Guides.

    .NET Core in containers

    Two images are provided per the different .NET Core versions: a runtime image that contains everything necessary to run a .NET Core application, and an SDK image that contains the runtime plus the tooling needed to build applications.

    Table 1 shows the names of the images for .NET Core 2.1. For other versions, just change the version numbers in the name.

    Table 1: .NET Core images for version 2.1.
    Base image SDK/runtime image
    rhel7 registry.redhat.io/dotnet/dotnet-21-rhel7:2.1
    registry.redhat.io/dotnet/dotnet-21-runtime-rhel7:2.1
    centos7 registry.centos.org/dotnet/dotnet-21-centos7:latest
    registry.centos.org/dotnet/dotnet-21-runtime-centos7:latest
    ubi8 registry.access.redhat.com/ubi8/dotnet-21:2.1
    registry.access.redhat.com/ubi8/dotnet-21-runtime:2.1

    Note: Depending on the version, an image might not (yet) be available for a specific base. For example, CentOS images are made available by the CentOS community after Red Hat Enterprise Linux images are created by Red Hat.

    The following example prints out the SDK version that is available in the .NET Core 2.1 ubi8 image:

    $ podman run registry.access.redhat.com/ubi8/dotnet-21:2.1 dotnet --version
    2.1.509
    

    For more information about the .NET Core images, see the s2i-dotnetcore GitHub repo, and the .NET Core Getting Started Guides.

    .NET Core on OpenShift

    The .NET Core images provide an environment for running and building .NET Core applications. They are also compatible with OpenShift’s source-to-image (S2I) build strategy. This factor means that the OpenShift container platform can build a .NET Core application from source.

    .NET images are imported in OpenShift using the OpenShift CLI client (oc) with an image stream definition file from the s2i-dotnetcore GitHub repo. The file differs depending on the base image, as shown in Table 2.

    Table 2: .NET Core image stream definitions by base image.
    Base image Image stream definition
    rhel7 https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/master/dotnet_imagestreams.json
    centos7 https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/master/dotnet_imagestreams_centos.json
    ubi8 https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/master/dotnet_imagestreams_rhel8.json

    Retrieving the Red Hat Enterprise Linux 7 images requires authentication. Registry Authentication describes how you can set up the pull secret.

    The image streams can be imported using oc. For example, to import the ubi8-based images, run:

    $ oc create -f https://raw.githubusercontent.com/redhat-developer/s2i-dotnetcore/master/dotnet_imagestreams_rhel8.json
    

    Note: If there are already image streams present for .NET Core, you must use replace instead of create.

    The s2i-dotnetcore repository includes a script for installing these image streams on Windows, Linux, and macOS. See Installing for more information. This script can also create the pull secret needed for pulling the Red Hat Enterprise Linux 7 images.

    Once the image streams are installed, OpenShift can directly build and deploy an application from a Git repo, for example:

    $ oc new-app dotnet:3.1~https://github.com/redhat-developer/s2i-dotnetcore-ex#dotnetcore-3.1 --context-dir=app
    

    For more information about using .NET Core on OpenShift, see the corresponding chapter in the .NET Core Getting Started Guides.

    Conclusion

    In this article, you got an overview of the Red Hat platforms that support .NET Core, and how to install .NET Core on each of them.

    Last updated: March 26, 2023

    Recent Posts

    • Protect data offloaded to GPU-accelerated environments with OpenShift sandboxed containers

    • Case study: Measuring energy efficiency on the x64 platform

    • How to prevent AI inference stack silent failures

    • Preventing GPU waste: A guide to JIT checkpointing with Kubeflow Trainer on OpenShift AI

    • How to manage TLS certificates used by OpenShift GitOps operator

    Red Hat Developers logo LinkedIn YouTube Twitter Facebook

    Platforms

    • Red Hat AI
    • Red Hat Enterprise Linux
    • Red Hat OpenShift
    • Red Hat Ansible Automation Platform
    • See all products

    Build

    • Developer Sandbox
    • Developer tools
    • Interactive tutorials
    • API catalog

    Quicklinks

    • Learning resources
    • E-books
    • Cheat sheets
    • Blog
    • Events
    • Newsletter

    Communicate

    • About us
    • Contact sales
    • Find a partner
    • Report a website issue
    • Site status dashboard
    • Report a security problem

    RED HAT DEVELOPER

    Build here. Go anywhere.

    We serve the builders. The problem solvers who create careers with code.

    Join us if you’re a developer, software engineer, web designer, front-end designer, UX designer, computer scientist, architect, tester, product manager, project manager or team lead.

    Sign me up

    Red Hat legal and privacy links

    • About Red Hat
    • Jobs
    • Events
    • Locations
    • Contact Red Hat
    • Red Hat Blog
    • Inclusion at Red Hat
    • Cool Stuff Store
    • Red Hat Summit
    © 2026 Red Hat

    Red Hat legal and privacy links

    • Privacy statement
    • Terms of use
    • All policies and guidelines
    • Digital accessibility

    Chat Support

    Please log in with your Red Hat account to access chat support.