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

Creating your first ASP.NET MVC web site on RHEL

February 3, 2017
Don Schenck
Related topics:
.NETLinux
Related products:
Red Hat Enterprise Linux

    Follow this blog post, and within minutes you will have an ASP.NET MVC website running on Red Hat Enterprise Linux (RHEL). Yes, I'm talking to you, Windows .NET developer; you're about to double your OS skillset. Let's do this.

    I'm going to start with some assumptions:

    1. You are running Windows.
    2. You are not running Linux.

    Based on those two assumptions, we're going to:

    1. Install a RHEL Virtual Machine (VM) on your Windows PC.
    2. Start and run the VM.
    3. Install .NET on your VM.
    4. Create an ASP.NET MVC website.

    Install a RHEL VM on your Windows PC

    The quickest and most useful way to get Linux running in a VM is to download and install the Red Hat Development Suite. Sure, it has some pieces you probably don't want -- Java-related stuff -- but the remaining bits are great. You'll get a RHEL VM with kubernetes, Linux container, and OpenShift added in for container development.

    (Such a deal; you're not only going to have an ASP.NET MVC website running in a few minutes, but you're also going to have all you need to start creating and using containers. Hey man ... we .NET developers need to look out for each other, am I right?)

    Run the install and use the default installation path. You can change it if you wish, but you'll need to use that path in the next step.

    Start and Run  the VM

    Open PowerShell and run some commands. Here's the list of commands you'll need:
    cd C:\DevelopmentSuite\cdk\components\rhel\rhel-ose\
    vagrant up

    That's it! That's the list! Move it into the proper directory and run vagrant up. You'll use this magic every time you want to start your RHEL VM. Pretty easy, eh?

    When the VM is starting, you'll be asked if you want to register the system now. Answer 'y' and then use your Red Hat account credentials to register. Registering means, you have a proper, valid, full-fledged installation of RHEL; complete with the subscriptions you need to be a productive RHEL developer.

    Install .NET on your VM

    At the command line, use the following command to use ssh to get into your RHEL VM:

    vagrant ssh

    The installation automatically sets up the public and private keys needed for security. For the record, both user id and password is 'vagrant'.

    Now you're at a RHEL command prompt.

    Now we can install .NET. Note that this is .NET Core 1.1.

    First, run the command sudo subscription-manager register. If prompted for a password, it's vagrant, as mentioned earlier. If you're new to Linux, 'sudo' is like running a program "as Administrator" on Windows.

    Next, sudo subscription-manager list --available. This will give you the Pool ID you need next.

    Use that Pool ID in the following command: sudo subscription-manager attach --pool={pool id from previous step}

    Next, sudo subscription-manager repos --enable=rhel-7-server-dotnet-rpms

    sudo yum install -y scl-utils

    sudo yum install -y rh-dotnetcore11

    scl enable rh-dotnetcore11 bash

    Finally, prove the installation by running dotnet.

    These instructions, with more explanation, can be found at the Red Hat .NET installation web page.

    Create an ASP.NET MVC website

    Create a directory for your new site and move the following into it.

    mkdir mvc

    cd mvc

    Now to create the website.

    dotnet new --type web

    dotnet restore

    dotnet run

    That's it; you now have a basic ASP.NET MVC website running on your RHEL VM.

    There's a tiny issue: You see, the generated code is meant to run on localhost:5000. Well, localhost is the VM, so you won't be able to view the website outside of the VM.

    Before we change any code, open another PowerShell session, navigate to your VM directory, C:\DevelopmentSuite\cdk\components\rhel\rhel-ose\, and run the vagrant ssh command to get a second VM command prompt. Now you can run cURL to see the website; use the command curl localhost:5000. You'll see the HTML for the web page.

    More: Viewing the site from outside the VM

    This is fine, but cURL isn't exactly the user experience of choice. Instead, viewing the page from a browser would be what we really want.

    Fortunately, all it takes is a change to one line of code. Unfortunately, this involves using an editor that's built into RHEL: VI. It's ... uh ... not exactly intuitive (understatement of the year right there!). In fact, it's so challenging that at this point you can just search the Internet for a "VI Cheat Sheet" and use it.

    The line of code to be changed is line 18 in the file Program.cs. Change the code from .UseStartup<Startup>() to .UseStartup<Startup>.UseUrls("http://*:5000"). The following illustrates the change:

    Now, after you start the program (using dotnet run), you can access the web page from your browser in your Windows host by using the IP address of your VM -- which is 10.1.2.2.

    So there you have it; your first ASP.NET Core MVC web site, running on RHEL. In a production environment, you'll want to put the Kestrel web server behind NGINX or Apache ... but that's another blog post.

    For additional information and articles on .NET Core visit our .NET Core web page for more on this topic.

     

    Last updated: May 26, 2022

    Recent Posts

    • Red Hat Hardened Images: Top 5 benefits for software developers

    • How EvalHub manages two-layer Kubernetes control planes

    • Tekton joins the CNCF as an incubating project

    • Federated identity across the hybrid cloud using zero trust workload identity manager

    • Confidential virtual machine storage attack scenarios

    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.